开发者_开发百科When I want to run make
to generate some executables it always uses the Sun make
located
at /usr/local/bin/make
rather than GNU make which can be found at /usr/sfw/bin/gmake
.
How can I tell the OS to use GNU make rather than Sun's? Do I need to overwrite the path somehow?
For two executables named identically, reorder paths in the PATH
variable, since the first match will be used.
Otherwise, define an alias in your ~/.profile
or ~/.bashrc
file:
alias make="/usr/sfw/bin/gmake"
Or a function:
make() { /usr/sfw/bin/gmake "$@"; }
Note, that aliases work only in interactive mode. Scripts will not see them. Use functions in such case.
you can link /usr/sfw/bin/gmake to /usr/bin for example as long as the directory where you link it to is before /usr/local/bin in the PATH variable thus
cd /usr/bin
ln -s /usr/sfw/bin/gmake make
just be sure there is no make already in the path. otherwise you always can call gmake instead of make to use gnu-make and leave make for the sun-version-make.
otherwise you can use the alias as in the previous post
If you're manually running the make command, then simply type gmake
instead of make
. It will run the GNU version (assuming that your PATH
) variable is set properly.
If there's an IDE or some other tool that's invoking make
, you need to tell it to use gmake rather than make and the way to do that depends on which tool you're using.
精彩评论