[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev] [rfc] Making a Makefile respect custom CFLAGS
From:       Michał Górny <gentoo () mgorny ! alt ! pl>
Date:       2010-08-23 21:47:50
Message-ID: 20100823234750.2324c228 () pomiocik ! lan
[Download RAW message or body]


On Mon, 23 Aug 2010 23:01:10 +0200
Sebastian Pipping <sping@gentoo.org> wrote:

> I assume this Makefile to work with any non-GNU make:
> 
>   CFLAGS=`sdl-config --cflags` -Wall -Wextra
>   LDFLAGS=`sdl-config --libs`
>   OBJ=tron.o pixel.o
> 
>   .PHONY: clean run
> 
>   tron: $(OBJ)
> 
>   run: tron
>   	./tron
> 
>   clean:
>   	rm -f *.o tron

I wouldn't be so sure about that. POSIX make manpage doesn't seem to
provide a suffix-rule to link multiple .o files into a binary; but that
might be just not expressed clearly enough for me.

> Now how would we fix this to respect custom CFLAGS (and LDFLAGS) in a
> way that does not require GNU make (i.e. simply-expanded variables):
> 
>    "[Recursively-expanded variables are] the only sort supported
>     by other versions of make". [1]
> 
> Any proposals for a generic solution that is upstream-suitable?
> While the Makefile presented here is not likely to go into the tree I
> had similar cases before so I felt like bringing this up.  Thanks!

I personally tend to completely redefine the suffix rules, moving
'private' CFLAGS/LIBS to a LCFLAGS/LLIBS or similar.

For a reference, you may take a look at:
http://github.com/mgorny/autoupnp/blob/master/Makefile

-- 
Best regards,
Michał Górny

<http://mgorny.alt.pl>
<xmpp:mgorny@jabber.ru>

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic