1 # override with `make BUILD=release`
2 # default to debug build
11 TEMP_DIR := ./include/core
13 CC_FLAGS.debug := -O0 -g3 -Wall -c -fmessage-length=0 -std=c++0x -pedantic -fpic
14 CC_FLAGS.release := -O0 -g3 -Wall -c -fmessage-length=0 -std=c++0x -fpic
15 CC_FLAGS := $(CC_FLAGS.$(BUILD))
18 INC += -I./include/core
20 INC += -I../include/controller
24 #LIBS += -lboost_thread-mt
25 #LIBS += -lboost_thread
27 # using make's computed variables to select object and bin folders
28 # depending on the build type
29 OBJ_DIR.debug := ./obj/debug
30 OBJ_DIR.release := ./obj/release
31 OBJ_DIR := $(OBJ_DIR.$(BUILD))
33 BIN_DIR.debug := ./bin/debug
34 BIN_DIR.release := ./bin/release
35 BIN_DIR := $(BIN_DIR.$(BUILD))
37 CPP_FILES := $(wildcard $(SRC_DIR)/*.cpp)
38 CPP_FILES += $(wildcard $(TEST_DIR)/*.cpp)
39 CPP_FILES += $(wildcard $(TEMP_DIR)/*.cpp)
40 OBJ_FILES := $(addprefix $(OBJ_DIR)/,$(notdir $(CPP_FILES:.cpp=.o)))
41 H_FILES := $(wildcard ./include/core/*.hpp)
42 H_FILES += $(wildcard ./include/core/*.h)
43 H_FILES += $(wildcard $(TEST_DIR)/*.h)
44 LD_FLAGS := -L/usr/lib
50 $(CC) -o $@ $^ $(LD_FLAGS) $(LIBS)
51 mv ./$(PROG) ./$(BIN_DIR)
54 $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(SRC_DIR)/%.h $(H_FILES)
55 $(CC) $(CC_FLAGS) $(INC) -c -o $@ $<
57 $(OBJ_DIR)/%.o: $(TEST_DIR)/%.cpp $(H_FILES)
58 $(CC) $(CC_FLAGS) $(INC) -c -o $@ $<
60 $(OBJ_DIR)/%.o: $(TEMP_DIR)/%.cpp $(H_FILES)
61 $(CC) $(CC_FLAGS) $(INC) -c -o $@ $<
66 rm -rf ./obj/release/*
68 rm -rf ./bin/release/*
75 @echo 'BUILD = '$(value BUILD)
76 @echo 'INC = '$(value INC)
77 @echo 'CPP_FILES = '$(value CPP_FILES)
78 @echo 'LIBS = '$(value LIBS)