bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detecting if a Makefile is GNU make-ish


From: Paul Smith
Subject: Re: detecting if a Makefile is GNU make-ish
Date: Fri, 01 Jan 2021 14:48:38 -0500
User-agent: Evolution 3.36.4-0ubuntu1

On Fri, 2021-01-01 at 11:02 -0500, Alfred M. Szmidt wrote:
> Is there some way of detecting or specifying that a Makefile is GNU
> make specific?  I'm kinda thinking of something similar to the
> .POSIX directive.
> 
> I'm in a situation where got a bunch of Makefiles, some BSD makefile,
> some GNU, some POSIX and to somehow handle this without having to
> remeber if one is to type make, gmake, nmake, I want to create a
> small wrapper that can sorta figure it out by itself.
> 
> Other ideas are welcome too ...

There is clearly no pseudo-target (like .POSIX) that must be provided
in any makefile in order to activate it's "GNU-ness", so that you can
rely on it being present in any makefile that uses GNU extensions.  The
same is true for BSD make.

If there were such a thing everyone would surely know about it :).

That being the case, if you can't change the makefiles, then I don't
see any way to know for sure other than by looking for common idioms
that are customized to different versions of make, as a heuristic.

My personal recommendation is to search for BSD-like operations such as
".include", ".if", etc. and choose BSD make.  If you don't see things
like that, choose GNU make.

Either make (should) be able to run a POSIX standard makefile.

If you CAN change the makefile then you can just add your own pseudo-
target to them following whatever convention you want.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]