Choose between makefile and Makefile on Linux

南楼画角 提交于 2021-02-09 07:15:11

问题


I want to do a make in a directory with both Makefile and makefile. By default, it will execute makefile. Is there any options I can do to execute the Makefile instead?

Thanks in advance.


回答1:


The easy option is to use -f:

$ make -f Makefile

From man 1 make (the GNU make, I presume):

If no -f option is present, make will look for the makefiles GNUmakefile, makefile, and Makefile, in that order.

So you con link your Makefile to the name GNUmakefile. But my advise, if you really want this, is to use an alias:

$ alias make='make -f Makefile'



回答2:


Read GNU make documentation. Just type

 make -f Makefile

You might consider making a symlink from Makefile to GNUmakefile but I consider horrible to have several makefile like files.

Having both Makefile and makefile makes your project unreadable. Please have mercy on your successor developer.



来源:https://stackoverflow.com/questions/21537265/choose-between-makefile-and-makefile-on-linux

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!