automake 1.10 |
2007-07-01
|
God darn it. Apparently automake 1.10 now warns me that constructs like this:
pychecker_indep_files = $(filter-out $(pychecker_010_files),$(pychecker_all_files))
use GNU make-specific features and are thus not portable.
So I started looking for "what is POSIX make anyway" and all I could find was this page which is irritatingly concise and doesn't leave me with a whole lot of options.
Anyone know what sort of text/list manipulation one can rely on when trying to stay portable ? Or is there simply no point in trying to support anything else than GNU make ?
GNU make is free software and available for nearly everything that can crunch numbers. So I personally wonder for a long time now, what’s the point of avoiding GNU make extensions. Writing crude make scripts, just because other make variants suck is stupid.
Having said that, the question raises, what’s the point of using automake at all.
Comment by Mathias Hasselmann — 2007-07-01 @ 23:34
Maybe CMake can help you.
you have some info in cmake.org and lots of live examples in anonsvn.kde.org :)
good luck!
Comment by adrian — 2007-07-02 @ 00:09
sorry, http://websvn.kde.org
Comment by adrian — 2007-07-02 @ 00:10
I think basically the only thing you can do to manipulate strings portably is $(foo:A=B) [1].
I had to struggle with a similar problem recently and my conclusion is this: if you want to keep your Makefile.am’s clean, most of the times it’s easier to re-think your rules and don’t use GNU extensions at all. It is annoying, and can turn into an unnecessary mess, but that’s the price. Alternatively, you can maintain different Makefiles to handle the GNU-specific parts (e.g. keeping a GNUmakefile, as described in [2]).
If on the other hand, you don’t mind relying on GNU make extensions (and these days who gives a damn if you do? :) just shut up automake with -Wno-portability [3].
Anyway, if someone with deep knowledge of POSIX ‘make’ has better news, I’d be happy to read about it, so if you find a better solution, please blog about it. Thanks.
[1] http://www.gnu.org/software/make/manual/html_node/Substitution-Refs.html#Substitution-Refs
[2] http://sourceware.org/automake/automake.html#Third_002dParty-Makefiles
[3] http://sourceware.org/automake/automake.html#Invoking-Automake
Comment by Eric — 2007-07-02 @ 02:30
Those features don’t exist in POSIX make. In BSD makes (pmake, for “portable make”), text manipulation is done using attributes, like ${.TARGET:tl}, which lower-cases $@. Also, a := $(shell foo -a -s) is done as a != foo -a -s instead. OpenBSD make offers the fewest features, so it is the most “portable”; NetBSD offers the most.
I have written makefiles that use portable features, and the create GNUmakefile for the GNU features and Makefile for the BSD features. I then include the portable file in both the GNU and BSD versions (using include directives).
I don’t know how that would work with automake, though. Probably your best bet is to make pychecker_010_files and pychecker_indep_files the canonical variables, and then have pychecker_all_files the union of the two, but I don’t use auto*.
Comment by brian m. carlson — 2007-07-02 @ 03:09
> Having said that, the question raises, what’s the point of using automake at all.
Because it’s the worst build system in existence, except for all the others.
Comment by Rob — 2007-07-02 @ 07:27
gnome (and any open source projects) should just toss automake. It has never, *ever* made sense for gnome to require it, or advocate its use. The standard set of “blessed” make targets, as well as the dist/distcheck behavior we’ve all come to know and love, could easily be implemented in gnumake macros. Autoconf and libtool are good, but automake needs to go.
Comment by toshok — 2007-07-02 @ 09:05
autoconf sucks, but we know that already and it’s not relevant here.
I don’t think POSIX requires anything of a make implementation other than dependencies and the ability to execute scripts for a target. If you want to be completely portable, the only thing you are allowed to do, is write /bin/sh-compatible scripts under targets.
Having said that, however, it’s fairly safe to assume most people will be able to use GNU make these days. …and this is being said by a BSD guy…
I usually write pmake Makefiles though. I find them much friendlier than GNU make files.
Comment by Philip Paeps — 2007-07-02 @ 09:14
Manual TrackBack, as I am seem too stupid to feed this blog’s trackback URL: http://taschenorakel.de/mathias/2007/07/02/stripping-down-gnu-make/
Comment by Mathias Hasselmann — 2007-07-02 @ 18:00