# certainly allowed to go that route if you wish.
.SECONDEXPANSION:
$(C_PROGRAMS): % : $$($$(@)_OBJECTS)
- $(CC) $(LDFLAGS) -o $@ $^ $($(@)_LIBS)
+ $(CC) $(LDFLAGS) -o "$@" $^ $($(@)_LIBS)
.SECONDEXPANSION:
$(CXX_PROGRAMS): % : $$($$(*)_OBJECTS)
- $(CXX) $(LDFLAGS) -o $@ $^ $($(@)_LIBS)
+ $(CXX) $(LDFLAGS) -o "$@" $^ $($(@)_LIBS)
# target: run - use the program for its intended purpose
# Here we just execute RUN_PROGRAM, but you could also use something
# for example, try
# $ make CXX=/usr/local/bin/g++ CXXFLAGS=-Wall
%.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $<
+ $(CXX) $(CXXFLAGS) -c "$<"
# Pattern rule for compiling object files from C source
# The comments from the C++ rule above also apply here
%.o: %.c
- $(CC) $(CFLAGS) -c $<
+ $(CC) $(CFLAGS) -c "$<"
# target: print-% - display a variable value (e.g. print-PROGRAMS)
# Take some of the mystery out of variable manipulation. For example,