From: Julian Ospald Date: Fri May 25 02:00:10 UTC 2012 Subject: build system --- Makefile +++ Makefile @@ -1,27 +1,67 @@ -CC = ccache gcc -CXX = ccache g++ +CC ?= gcc +CXX ?= g++ + +CFLAGS += -Wnon-virtual-dtor -Werror=return-type + +CPPFLAGS += $(shell pkg-config --cflags sdl) \ + -I/usr/include/boost \ + -I/sw/include/SDL \ + -Isrc/ +LIBS += -lSDLmain \ + $(shell pkg-config --libs sdl) \ + $(shell pkg-config --libs glu) \ + $(shell pkg-config --libs glew) \ + $(shell pkg-config --libs SDL_image) \ + $(shell pkg-config --libs SDL_ttf) \ + $(shell pkg-config --libs SDL_mixer) \ + $(shell pkg-config --libs libpng) + +LDFLAGS += -L/sw/lib \ + -L/usr/lib \ + -L. -OPT = -O2 -fno-inline-functions include Makefile.common %.o : src/%.cpp - $(CXX) $(CCFLAGS) -DIMPLEMENT_SAVE_PNG -fno-inline-functions -g $(OPT) `sdl-config --cflags` -D_GNU_SOURCE=1 -D_REENTRANT -Wnon-virtual-dtor -Werror=return-type -fthreadsafe-statics -c $< + $(CXX) \ + $(CXXFLAGS) -fno-inline-functions -fthreadsafe-statics $(CPPFLAGS) -DIMPLEMENT_SAVE_PNG \ + -c $< game: $(objects) - $(CXX) $(CCFLAGS) -g $(OPT) -D_GNU_SOURCE=1 -D_REENTRANT -Wnon-virtual-dtor -Werror=return-type $(objects) -o game -L. -L/sw/lib -L. -L/usr/lib `sdl-config --libs` -lSDLmain -lSDL -lGL -lGLU -lGLEW -lSDL_image -lSDL_ttf -lSDL_mixer -lpng -lboost_regex-mt -lboost_system-mt -lpthread -fthreadsafe-statics + $(CXX) \ + $(LDFLAGS) \ + $(CXXFLAGS) $(CPPFLAGS) \ + $(objects) -o game \ + $(LIBS) -lboost_regex-mt -lboost_system-mt -lpthread -fthreadsafe-statics server: $(server_objects) - $(CXX) -fno-inline-functions -g $(OPT) -D_GNU_SOURCE=1 -D_REENTRANT -Wnon-virtual-dtor -Werror=return-type -fthreadsafe-statics $(server_objects) -o server -L/sw/lib -L/usr/lib `sdl-config --libs` -lSDLmain -lSDL -lGL -lGLU -lSDL_image -lSDL_ttf -lSDL_mixer -lboost_regex-mt -lboost_system-mt -lboost_thread-mt -lboost_iostreams-mt + $(CXX) \ + $(LDFLAGS) \ + $(CXXFLAGS) -fno-inline-functions -fthreadsafe-statics $(CPPFLAGS) \ + $(server_objects) -o server \ + $(LIBS) -lboost_regex-mt -lboost_system-mt -lboost_thread-mt -lboost_iostreams-mt formula_test: $(formula_test_objects) - $(CXX) -O2 -g -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUNIT_TEST_FORMULA -Wnon-virtual-dtor -Werror=return-type src/formula.cpp $(formula_test_objects) -o test -L/usr/lib -lSDL -lGL -lGLU -lSDL_image -lSDL_ttf -lSDL_mixer -lboost_regex + $(CXX) \ + $(LDFLAGS) \ + $(CXXFLAGS) $(CPPFLAGS) -DUNIT_TEST_FORMULA \ + src/formula.cpp $(formula_test_objects) -o test \ + $(LIBS) -lboost_regex wml_modify_test: $(wml_modify_test_objects) - $(CXX) -O2 -g -framework Cocoa -I/usr/local/include/boost-1_34 -I/sw/include/SDL -Isrc/ -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUNIT_TEST_WML_MODIFY -Wnon-virtual-dtor -Werror=return-type src/wml_modify.cpp $(wml_modify_test_objects) -o test -L/usr/lib -lboost_regex + $(CXX) \ + $(LDFLAGS) \ + $(CXXFLAGS) -framework Cocoa $(CPPFLAGS) -DUNIT_TEST_WML_MODIFY \ + src/wml_modify.cpp $(wml_modify_test_objects) -o test \ + -lboost_regex wml_schema_test: $(wml_schema_test_objects) - $(CXX) -O2 -g -framework Cocoa -I/usr/local/include/boost-1_34 -I/sw/include/SDL -Isrc/ -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUNIT_TEST_WML_SCHEMA -Wnon-virtual-dtor -Werror=return-type src/wml_schema.cpp $(wml_schema_test_objects) -o test -L/usr/lib -lboost_regex + $(CXX) \ + $(LDFLAGS) \ + $(CXXFLAGS) -framework Cocoa $(CPPFLAGS) -DUNIT_TEST_WML_SCHEMA \ + src/wml_schema.cpp $(wml_schema_test_objects) -o test \ + -lboost_regex update-pot: utils/make-pot.sh > po/frogatto.pot.bak