![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| make multiple line containing a pattern into single line | VTAWKVT | Shell Programming and Scripting | 10 | 08-07-2008 06:54 AM |
| to make 2 lines into 1 line using awk | cdfd123 | Shell Programming and Scripting | 2 | 10-03-2007 04:44 PM |
| How to make all lines into 1 line? | earnstaf | UNIX for Dummies Questions & Answers | 8 | 06-13-2007 01:55 PM |
| Surrounding a chunk of code by #ifdef and #endif | xxxaxa | Shell Programming and Scripting | 6 | 05-09-2007 10:23 AM |
| Enable PWD command on anonymous FTP? | HiredGun79 | IP Networking | 9 | 05-20-2006 11:49 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
how to enable #ifdef macro in the command line of make?
[Keyword] Linux, C++, make, macro
In source code, we used some #ifdef macros. How can I enable #ifdef macro in the command line of "make" (NOTE: I do NOT want to change source code or makefile to define that macro from time to time). e.g. test.cpp: ... #ifdef TEST1 // code segment for test1 ... #endif ... #ifdef TEST2 // code segment for test2 ... #endif .... Question: How can I enable either macro via command line of make? e.g. make ????? -> enable TEST1 make ????? -> enable TEST2 Thanks in advance! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Compilers normally use the -D flags
eg Code:
test.o: test.cpp
$(CC) $(CFLAGS) -DTEST1 test.cpp -o $@
|
|
#3
|
|||
|
|||
|
if u wish to do it outside makefile
make CFLAGS=-DMACRO dont forget that inside your make file u are using the CFLAGS macro while compilation |
|
#4
|
|||
|
|||
|
hi porter & uvrakesh, i got it. thanks a lot.
|
|||
| Google The UNIX and Linux Forums |