开发者

Getting GNU Make and NMake to use different makefiles by default

开发者 https://www.devze.com 2023-01-31 23:49 出处:网络
I want a project to be buildable with both GNU Make (on Linux) and NMake (on Windows). Obviously, I can have the makefiles called Makefile and Nmakefile and build by using make and nmake /F Nmakefile

I want a project to be buildable with both GNU Make (on Linux) and NMake (on Windows). Obviously, I can have the makefiles called Makefile and Nmakefile and build by using make and nmake /F Nmakefile respectively. Is there a pair 开发者_JAVA百科of names such that make and nmake without -f//F options work?

According to documentation, NMake looks for .mak files, so I've tried to use Makefile.mk and Nmakefile.mak, but it didn't work.


According to the man page of GNU make, it will first look for a file called GNUmakefile.


from man make:

Normally you should call your makefile either makefile or Makefile. (We recommend Makefile because it appears prominently near the beginning of a directory listing, right near other important files such as README.) The first name checked, GNUmakefile, is not recommended for most makefiles. You should use this name if you have a makefile that is specific to GNU make, and will not be understood by other versions of make. If makefile is `-', the standard input is read.

so call your gnu Makefile GNUmakefile

0

精彩评论

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