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 > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 06-24-2012, 09:19 AM
"Bernhard R. Link"
 
Default which flags to pass to gcc/g++

* Serge <sergemdev@gmail.com> [120624 00:15]:
> Or you mean that they should run `gcc`/`g++` with CPPFLAGS?
> If you do, then... How should they do that?

gcc $(CPPFLAGS) $(CFLAGS) -c -o foo.o foo.c
gcc $(CFLAGS) $(LDFLAGS) -o foo foo.o
gcc $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o foo foo.c
g++ $(CPPFLAGS) $(CXXFLAGS) -c -o foo.o foo.cpp
g++ $(CXXFLAGS) $(LDFLAGS) -o foo foo.o
g++ $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o foo foo.cpp

I.e: the rules are:
* whenever calling gcc pass CFLAGS,
* whenever calling g++ pass CXXFLAGS.
* Whenever it links (i.e. without -c, -E or -S) pass LDFLAGS.
* Whenever it will preprocess anything, pass CPPFLAGS.

Note that CPPFLAGS and LDFLAGS are in the format as you need to
give them to gcc/g++, i.e. every ld option not understood by
gcc needs a -Wl, and so on...

Bernhard R. Link


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20120624091919.GA2779@client.brlink.eu">http://lists.debian.org/20120624091919.GA2779@client.brlink.eu
 

Thread Tools




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

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