help-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GNU Make: Add something to CXXFLAGS when invoking make


From: Eric Lilja
Subject: GNU Make: Add something to CXXFLAGS when invoking make
Date: 8 Nov 2006 10:23:28 -0800
User-agent: G2/1.0

Hello, can you do what the topic says?
I tried:
hivemind@mindcooler
~/jobb/example_programs/overloaded_comparison_operators
$ make CXXFLAGS+='-DFRIEND
but instead of adding -DFRIEND to CXXFLAGS, it replaced it...the
Makefile itself is:
CXX =g++
CXXFLAGS = -Wall -Wextra -std=c++98 -pedantic -g -c
LDFLAGS = -o $(EXEC)
EXEC = overloaded_comparison_operators.exe
OBJECTS = overloaded_comparison_operators.o

all: $(OBJECTS)
        $(CXX) $^ $(LDFLAGS)

overloaded_comparison_operators.o: overloaded_comparison_operators.cpp
        $(CXX) $(CXXFLAGS) $<

clean:
        rm -f $(OBJECTS) $(EXEC) *~ *.stackdump

I'm trying to avoid writing several Makefiles or having to specify the
other CXXFLAGS on the command line other than the defines I want at the
moment.

/ E



reply via email to

[Prev in Thread] Current Thread [Next in Thread]