开发者

Mingw and make variables

I'm trying to compile an open source project on windows under mingw/msys.

The makefile contains (among others) this line

@${MAKE} --no-print-directory -C . -f physfs.make

physfs.make contains (among others) these lines:

ifndef CC
  CC = gcc
endif

when I ran make I get the following error:

Creating obj/Debug/physfs
physfs.c
make[1]: cc: Command not found
make[1]: *** [obj/Debug/physfs/physfs.o] Error 127
make: *** [physfs] Error 2

If I comment the ifndef / endif pair leaving CC = gcc intact, the build works. If instead of make I issue this command:

make -e CC=gcc

the build works as well. But when I run the following command in msys:

echo $CC

nothing is displayed.

I think there is something basic about how environment variables work in MSYS and make that I don't understand.

Could please some help me troubleshoot this issue, so I can understand why simple 'make' command complains and why开发者_运维技巧 the ifndef block doesn't function as I expect it to function.


CC is one of several implicit variables automatically defined in a make session, so the line ifndef CC should never evaluate to true.

This explains why you see nothing on the command line for echo $CC. The MSYS environment has no concept of CC.

If you want to see the value of variables from within a make session, you can always use the info function:

$(info $(CC))

This will echo the value of the CC variable to the console at the point when that line in the makefile is evaluated.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜