"Portable" conditionalization of Makefiles

andrew clarke mail at ozzmosis.com
Wed Mar 21 20:12:17 UTC 2018


On Tue 2018-03-20 17:45:19 UTC-0700, Ronald F. Guilmette (rfg at tristatelogic.com) wrote:

> Of course, these two make programs have implemented different, and
> apparently incompatable syntaxes for conditionalization... with the
> FreeBSD make using directives like ifeq/else/endif and GNU make using
> directives like .if/.else/.endif
>
> I *really* don't want to use any mechanism which builds the Makefile
> on the fly, like configure/autoconf and friends.  (I have always felt
> that those things were abominations... basically elephant guns, often
> used ridiculously to kill mere gnats.)

Another option would be to use CMake, but autotools are overkill for small
projects.

The easiest thing to do is just to require GNU Make for the FreeBSD version.
"pkg install gmake" as root, then build with "gmake" instead of "make".

The alternative is just to write two separate makefiles, but that is
error-prone.


More information about the freebsd-questions mailing list