You can incorporate different file suffixes into C++ by adding them to your makefile. The following example adds .cpp as a valid suffix for C++ files. Add the SUFFIXES macro to your makefile:
SUFFIXES: .cpp .cpp~
(This line can be located anywhere in the makefile.)
Add the following lines to your makefile. Indented lines must start with a tab.
.cpp: $(LINK.cc) -o $@ $< $(LDLIBS) .cpp~: $(GET) $(GFLAGS) -p $< > $*.cpp $(LINK.cc) -o $@ $*.cpp $(LDLIBS) .cpp.o: $(COMPILE.cc) $(OUTPUT_OPTION) $< .cpp~.o: $(GET) $(GFLAGS) -p $< > $*.cpp $(COMPILE.cc) $(OUTPUT_OPTION) $< .cpp.a: $(COMPILE.cc) -o $% $< $(COMPILE.cc) -xar $@ $% $(RM) $% .cpp~.a: $(GET) $(GFLAGS) -p $< > $*.cpp $(COMPILE.cc) -o $% $< $(COMPILE.cc) -xar $@ $% $(RM) $% |