FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 08-23-2010, 09:44 PM
Mike Frysinger
 
Default Making a Makefile respect custom CFLAGS

On Monday, August 23, 2010 17:01:10 Sebastian Pipping wrote:
> CFLAGS=`sdl-config --cflags` -Wall -Wextra
> LDFLAGS=`sdl-config --libs`

SDL_CONFIG = sdl-config
CPPFLAGS += `$(SDL_CONFIG) --cflags`
CFLAGS += -Wall -Wextra
LDLIBS += `$(SDL_CONFIG) --libs`

although the SDL_CONFIG is crap anyways and you should be using autoconf

and using gcc-specific-ish flags like -Wall -Wextra while not using GNU make
seems kind of dumb.

> 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):

why is that a problem ? everyone and their dog has `gmake`.
-mike
 
Old 08-23-2010, 09:47 PM
Michał Górny
 
Default Making a Makefile respect custom CFLAGS

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>
 

Thread Tools




All times are GMT. The time now is 02:17 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org