[NTLUG:Discuss] makefile guidance..

Gregory L. Camp Greg.Camp at osc.com
Wed Apr 25 11:19:38 CDT 2001


What about about setting an environment variable, say "DEBUG_OPTS", based on
"alldebug" or "allnodebug"?  If you pass in "allnodebug" then you set
DEBUG_OPTS to null, but if you pass in "alldebug" then you set
DEBUG_OPTS=-g, or whatever options you need.
 
Then you can modify your CC/CXX lines to include ${DEBUG_OPTS}.  If it's
null, it won't affect anything.  If it's got an option in it, then it will
modify the CC or CXX lines appropriately.  Obviously you could have a
DEBUG_CC_OPTS and DEBUG_CXX_OPTS if that's necessary.
 
Greg

-----Original Message-----
From: don [mailto:tx.saluki at verizon.net]
Sent: Tuesday, April 24, 2001 5:05 PM
To: discuss at ntlug.org
Subject: Re: [NTLUG:Discuss] makefile guidance..


No, but I have thought of that.  We have one part of the project that has to
be compiled with gcc and another part that has to be compiled with g++.  It
has to be this way for reasons I can't go into.  That's why everything has
to be contained within the the makefiles and specified with a "make
tgt=<platform> <all/alldebug/allnodebug> ".   

Don

George E. Lass wrote:


I *think* you can just pass the compiler into the makefile:

make CC=gcc -g -Wall (and don't forget -Werror)

--or--

make CC=g++ -g .......


This *should* override the the CC= whatever that is contained in the 
makefile itself.  Is this what you want to do?


george

don wrote:

Any one have any insight of how to structure a makefile to produce a
non-debug executable and a debug executable ?  I could do this in a
brute force option, but I was wondering if anyone has any tricks up
his/her sleeve they'd like to share.   Using -d on the command line
isn't really an option due to the size and existing setup of the project.

Currently, we have to do "make tgt=xxx all" to build all the
executables.  I'd like to modify it so that the target "all" is
unchanged,  and add a "alldebug" and "allnodebug" option.  We currently
have to define the compilers as such :

$CC = gcc -g -Wall ...
$CXX = g++ -g -Wall....

and cannot change this either.

Any suggestions ?  I have a few ideas, but would be interested  in what
y'all have to say.

Thanks in advance,
Don

_______________________________________________
http://www.ntlug.org/mailman/listinfo/discuss
<http://www.ntlug.org/mailman/listinfo/discuss> 




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ntlug.org/pipermail/discuss/attachments/20010425/a783d6f2/attachment.html


More information about the Discuss mailing list