1# Configuration section ------------------------------------------------------- 2outputName := connectfive # Filename to give to final executable 3cppExtension := .cpp # File extension of source files 4CPPFLAGS += -I /usr/local/include # List flags to pass to C/C++ preprocessor 5CXXFLAGS += -Wall -O0 -g # List flags to pass to C++ compiler 6LDFLAGS += -L /usr/local/lib -L /usr/X11R6/lib 7 # List flags to pass to linker 8LDLIBS += -lGLU32 -lOPENGL32 `sdl-config --libs` 9 # List additional system libraries to link with 10 11default : incremental 12 13# Generate intermediates variables and files ---------------------------------- 14CXXFLAGS += -MMD # update the makefiles on every compilation 15 16# Create a lists of object and .d files to create - one for each source file in the directory 17allCppMakes := ${patsubst %${strip ${cppExtension}},%.d,${wildcard *${cppExtension}}} 18allCppObjects = ${allCppMakes:.d=.o} 19 20# make any non-existant make files (using the g++ preprocessor) 21${allCppMakes} : %.d : %${cppExtension} 22 ${CXX} ${CPPFLAGS} -MM $< > $@ 23 24ifneq (${MAKECMDGOALS},clean) 25include ${allCppMakes} # include the generated make files, which make the object files 26endif 27 28# Final targets --------------------------------------------------------------- 29.PHONY : clean incremental full 30 31full : clean incremental 32 33incremental : ${outputName} 34 35clean : 36 rm -f *.o *~ *.d 37 38${outputName} : ${allCppObjects} 39 g++ -o $@ $^ ${LDFLAGS} ${LOADLIBES} ${LDLIBS} 40 41