开发者

Why does make tell me "Command not found"?

开发者 https://www.devze.com 2023-03-27 22:59 出处:网络
I have the following simple makefile: all: fat_imgen.exe Where fat_imgen.exe is an executable in the same directory as the makefile.When I try and run this however this happens:

I have the following simple makefile:

all:
    fat_imgen.exe

Where fat_imgen.exe is an executable in the same directory as the makefile. When I try and run this however this happens:

>make
fat_imgen.exe
make: fat_imgen.exe: Command not found
make: *** [all] Error 127

If I run fat_imgen from tha开发者_C百科t same command prompt then it starts as expected - why can't make find fat_imgen.exe?

This is all running under Mingw / Windows.


When using a simple commend like the name of an executable, GNU make will start the executable directly. If the directory where the executable is found is not in the PATH/path, make will fail.

If you put the directory in the path, your makefile should work normally.

Also, as suggested in a comment by @AlexFarber, by adding './' GNU make will assume a more complex command (since not all shells are created equal), and hand the command over to the configured shell. That will work, since the shell is created in the directory where the command is then found.

0

精彩评论

暂无评论...
验证码 换一张
取 消