Hi,
In most Makefiles I have seen, CXXFLAGS is used in the compile rule, either implicitly or explicitly. A few days ago, however I saw a Makefile that uses CXXFLAGS in link stage. Its compile rule is implicit which I suppose to use CXXFLAGS as well. The Makefile is as follows:
ifeq ($(STATIC),yes)
LDFLAGS=-static -lm -ljpeg -lpng -lz
else
LDFLAGS=-lm -ljpeg -lpng
endif
ifeq ($(DEBUG),yes)
OPTIMIZE_FLAG = -ggdb3 -DDEBUG -fno-omit-frame-pointer
else
OPTIMIZE_FLAG = -ggdb3 -O3
endif
ifeq ($(PROFILE),yes)
PROFILE_FLAG = -pg
endif
CXXFLAGS = -Wall $(OPTIMIZE_FLAG) $(PROFILE_FLAG) $(CXXGLPK)
all: test
test: test.o rgb_image.o
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
Makefile.depend: *.h *.cc Makefile