|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Makefile debug target
Hello,
I'm having a problem with a makefile script i'm trying to write. I want to compile a C++ program in two possible ways: "make" (default target, main) and "make debug". When i supply the debug target, exactly the same as main should be built, but then with the DEBUG flag (-g -D DEBUG). This sounds really logical, but i can't find the answer anywhere in the forums. This is the script: CXX=g++ CXXFLAGS=-ansi -std=c++98 -Wall -W DEBUG=-g -D DEBUG OBJS=main.o NgramCreator.o main: $(OBJS) $(CXX) $(OBJS) -o $@ $(OBJS): NgramCreator.h $(CXX) $(CXXFLAGS) $(DEBUG) -c $*.cpp clean: rm -f *~ *.o main *.gch I don't have a clue how to do this, can anybody help me? Thanks Steven |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Call the same makefile recursively in the debug target including the required flags. Don't set $(DEBUG) as a macro, but pass it in on the recursive call. Something like...
Quote:
Jerry |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
It worked
Hi,
It worked great! Thanks! Steven |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Makefile problem - How to run module load in a Makefile | hernandinho | UNIX for Advanced & Expert Users | 2 | 04-13-2009 10:20 AM |
| Oracle 9i install: Error in invoking target install of makefile | chris2005 | HP-UX | 5 | 02-21-2007 08:45 AM |
| tar - Selecting target dir | GNMIKE | UNIX for Dummies Questions & Answers | 3 | 11-05-2005 05:52 AM |
| Makefile:57: *** multiple target patterns. Stop. | nileshborate | Solaris | 0 | 09-20-2005 10:19 AM |
| vi, c/source/target g? | yls177 | UNIX for Dummies Questions & Answers | 7 | 12-02-2002 10:46 AM |
|
|