Gentoo Archives: gentoo-dev

From: "Michał Górny" <gentoo@××××××××××.pl>
To: gentoo-dev@l.g.o
Cc: sping@g.o
Subject: Re: [gentoo-dev] [rfc] Making a Makefile respect custom CFLAGS
Date: Mon, 23 Aug 2010 21:48:42
Message-Id: 20100823234750.2324c228@pomiocik.lan
In Reply to: [gentoo-dev] [rfc] Making a Makefile respect custom CFLAGS by Sebastian Pipping
1 On Mon, 23 Aug 2010 23:01:10 +0200
2 Sebastian Pipping <sping@g.o> wrote:
3
4 > I assume this Makefile to work with any non-GNU make:
5 >
6 > CFLAGS=`sdl-config --cflags` -Wall -Wextra
7 > LDFLAGS=`sdl-config --libs`
8 > OBJ=tron.o pixel.o
9 >
10 > .PHONY: clean run
11 >
12 > tron: $(OBJ)
13 >
14 > run: tron
15 > ./tron
16 >
17 > clean:
18 > rm -f *.o tron
19
20 I wouldn't be so sure about that. POSIX make manpage doesn't seem to
21 provide a suffix-rule to link multiple .o files into a binary; but that
22 might be just not expressed clearly enough for me.
23
24 > Now how would we fix this to respect custom CFLAGS (and LDFLAGS) in a
25 > way that does not require GNU make (i.e. simply-expanded variables):
26 >
27 > "[Recursively-expanded variables are] the only sort supported
28 > by other versions of make". [1]
29 >
30 > Any proposals for a generic solution that is upstream-suitable?
31 > While the Makefile presented here is not likely to go into the tree I
32 > had similar cases before so I felt like bringing this up. Thanks!
33
34 I personally tend to completely redefine the suffix rules, moving
35 'private' CFLAGS/LIBS to a LCFLAGS/LLIBS or similar.
36
37 For a reference, you may take a look at:
38 http://github.com/mgorny/autoupnp/blob/master/Makefile
39
40 --
41 Best regards,
42 Michał Górny
43
44 <http://mgorny.alt.pl>
45 <xmpp:mgorny@××××××.ru>

Attachments

File name MIME type
signature.asc application/pgp-signature