Re: [dev] Reasonable Makefiles

From: sin <sin_AT_2f30.org>
Date: Tue, 11 Feb 2014 13:28:42 +0000

On Tue, Feb 11, 2014 at 01:28:25PM +0100, Markus Teich wrote:
> Nick wrote:
> > I was reading the opengroup specifications for make(1) recently[0],
> > and found that even our standard makefile practise of using 'include'
> > for config variables is nonstandard, as far as they're concerned.
> > Needless to say I think 'include' is a perfectly reasonable feature
> > to use, and it evidently works everywhere that people care about.
>
> Heyho,
>
> Regarding the include config.mk used in various suckless projects: What is the
> benefit? If a user needs to adapt it to his system, he effectively has to edit a
> file. Would there be a problem if this file would be the Makefile instead of the
> config.mk file?

It is clear separation between user-configured variables and generic
code.

It also makes it easy to have a configure script like as shown below:

#!/bin/sh

case `uname` in
OpenBSD)
        ln config.bsd config.mk
        ;;
*)
        ln config.posix config.mk
        ;;
esac

This was taken from utmp[1].
This doesn't duplicate the entire Makefile.

[1] http://git.suckless.org/utmp

cheers,
sin
Received on Tue Feb 11 2014 - 14:28:42 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 11 2014 - 14:36:09 CET