Makefile experts, unite!

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 11 23:38:34 PDT 2017


Sebastien Alaiwan wrote:

> The selling points, to me, are:
> 1) the automatic dependency detection through filesystem hooks
> 2) recipes also are dependencies
> 3) the genericity/low-level. I believe build systems should let me define 
> my own abstractions, instead of trying to define for me what an 
> "executable" or a "static library" should be.

i'm not that all excited by "1", though. tbh, i prefer simplier things, 
like regexp scanning. while regexp scanners may find more dependencies than 
there really are, they doesn't require any dirty tricks to work.

i have my own fork of Perforce Jam, and such scanners works surprisingly 
well with it (for years). i even extended it to support D.

one of the great things in Jam is that it can simply call a "rule" (this is 
jam's name for something like function) when it need to get dependencies. 
and i can do regexp scan there, or run arbitrary system command and get 
it's result. also, while my jam comes with a set of predefined rules, there 
is nothing hardcoded, and everything can be redefined. it is also highly 
extensible via special "hook rules", which are empty by default.

the simpliest Jamrule can be as simple as this:

	Main myapp : [ Glob src/*.c ] ;

it also correctly processes subdirs (not via recursive invocations), can 
replace "configure" to some extend, and so on. i was using it exclusively 
for years before i completely switched to D (and even after the switch, to 
build projects with GDC).


More information about the Digitalmars-d mailing list