help-make
[Top][All Lists]
Advanced

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

how to do libraries of Make code?


From: Britton Kerin
Subject: how to do libraries of Make code?
Date: Sun, 11 Nov 2012 22:09:41 -0900

First, are there any libraries out there that attempt to factor out the
common code to build object files, link into programs/static/shared libs, etc.?
Essentially I'm thinking of a replacement for the old built-in rules implicit
rules but with everything visible in a fragment that you include.

I found GNU Make Standard Library which looks nice but its geared more
towards providing data types than factoring out conventions like what
automake/libtool/autoconf, CMAKE, scons etc. do.

It just always seems a bit sad to me that we have to have all the above
stuff instead of doing it with Make, for huge portability I guess I don't
care but for working on my own prototypes and such I don't want all
the portability baggage, I just want ordinary build conventions captured
in library form.

Second, does anyone have any good thoughts how best to do this?  Some
random thoughts I've had for general design rules:

* Use recursive vars for settings, so users can override things

* vars are like database entries, assigned vars shouldn't be reused
  except where their default value are being changed or extended

* static pattern rules yield better error messages in my experience
  and should be preferred over implicit rules.  The file sets to which
  they apply can be explicitly computed by functions

* var default settings should go in fragments that get included *before*
  client code, so users can replace or extend default values

* any actual rules provided should go in separate files, so they can be
  included *after* client code.  This is unfortunate but otherwise clients
  can't alter or extend things like the file sets to which static pattern
  rules apply.  Also, having separate fragments for rules allows users
  to decide to forgo the default rules, which is otherwise impossible

Any thoughts about how I'm crazy with the above would be appreciated.



reply via email to

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