(Problems and suggestions, in increasing order of unlikeliness.)
.cc.o: -> $(CXX) $(CXXFLAGS) ...Remember that C compilation, and the built in rule for linking of .o files use CC and CFLAGS and that C++ compilation uses CXX and CXXFLAGS. If you've added a -I only to CFLAGS, it won't show up when you compile C++. The fix I use is as follows:
CFLAGS = -g -I$(OLA) ... CXXFLAGS = $(CFLAGS)
.o : -> $(CC) ...Make's built in rules are something like that. Remember that C compilation, and the built in rule for linking of .o files uses CC and CFLAGS and that C++ compilation use CXX and CXXFLAGS. If you use gcc to link C++ object files, it doesn't know to add in the C++ library, which has the code for ostreams and such. The quickest fix is to add:
CXX = g++ CC = $(CXX)
PRINTER = teerlp2 print: -> print -p$(PRINTER) $(FILES)Make has this feature where it reads your environment variables (strings such as your path and X display which you change with the setenv command) and defines macros based on them. Just be forewarned that occasionally something funny happens to makefile macros that have the same name as environment variables. This feature can be useful, but also confusing.
You're more likely to notice this if you make a typo or forget the name of your variable:
PRYNTER = teerlp2 # OOPS. PRINT_COMMAND = print print: -> $(PRINTCMD) -p$(PRINTER) $(FILES) # OOPS.
printout: $(SRC) $(HEADERS) -> setenv PRINTER teerlp2 -> print -p$PRINTER $WHATEVER ... #OOPS.If you need to do anything that fancy, write a shell script instead, and have make call it.