Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Can a makefile be used by both gnu make and pmake?


Asked by Dion Wheeler on Dec 07, 2021 FAQ



This can lead to disastrous results when trying to write a Makefile that can be used by both GNU Make and pmake (contrived harmless example, imagine: gcc -o $@ $< = no input sources with gmake because $< evaluates to an empty string. Worse combinations exist that can result in gcc clobbering files). – Sean May 24 '11 at 19:27
In addition,
Both GNU make (used in Linux) and nmake have include directives though, so some common things can be put in a common makefile that is included by the main makefile. Share Improve this answer Follow answered Nov 25 '11 at 14:27 Some programmer dudeSome programmer dude 368k3333 gold badges364364 silver badges560560 bronze badges 0
Keeping this in consideration, Sometimes it is useful to have a makefile that is mostly just like another makefile. You can often use the ‘include’ directive to include one in the other, and add more targets or variable definitions. However, it is invalid for two makefiles to give different recipes for the same target. But there is another way.
Thereof,
'gmake' refers specifically to GNU make. 'make' refers to the system's default make implementation; on most Linux distros this is GNU make, but on other unixes, it could refer to some other implementation of make, such as BSD make, or the make implementations of various commercial unixes.
In this manner,
GNU make. This file documents the GNU make utility, which determines automatically which pieces of a large program need to be recompiled, and issues the commands to recompile them.