File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # names of the basic deriectories
2+ SRC_DIR = src
3+ INC_DIR = include
4+ LIB_DIR = libs
5+ BUILD_DIR = build
6+
7+ LIB_INCLUDE = -I$(LIB_DIR ) /tclap-1.2.1/include
8+ LIB_LINK = -L/usr/lib64 -Wl,-Bstatic -llua -Wl,-Bdynamic
9+
10+ # list all source files in SRC_DIR
11+ SRC_FILES += $(wildcard $(SRC_DIR ) /* .cpp)
12+
13+ # set the flags for the compilers
14+ CXX_FLAGS := -g -O0 -Wall -pedantic -std=c++11
15+ CC_FLAGS := -g -O0 -Wall -pedantic
16+
17+ ifdef OPT
18+ CXX_FLAGS := -O3 -Wall -pedantic -std=c++11
19+ CC_FLAGS := -O3 -Wall -pedantic
20+ endif
21+
22+ CXX := g++
23+ CC := gcc
24+
25+ # cpu dco
26+ OBJ_FILES_T = $(patsubst $(SRC_DIR ) /% .cpp,$(BUILD_DIR ) /% .o,$(SRC_FILES ) )
27+ OBJ_FILES = $(patsubst $(SRC_DIR ) /% .c,$(BUILD_DIR ) /% .o,$(OBJ_FILES_T ) )
28+
29+
30+ INC = -I$(INC_DIR ) $(LIB_INCLUDE )
31+
32+ FactorioViewer : $(OBJ_FILES )
33+ $(CXX ) $(CXX_FLAGS ) -o FactorioViewer $(OBJ_FILES ) $(LIB_LINK )
34+
35+ $(BUILD_DIR ) /% .o : $(SRC_DIR ) /% .c
36+ @mkdir -p $(@D )
37+ $(CC ) $(CC_FLAGS ) -c $< -o $@ $(INC )
38+ @$(CC ) $(CC_FLAGS ) -MM $< -MP -MT $@ -MF $(@:.o=.d ) $(INC )
39+
40+ $(BUILD_DIR ) /% .o : $(SRC_DIR ) /% .cpp
41+ @mkdir -p $(@D )
42+ $(CXX ) $(CXX_FLAGS ) -c $< -o $@ $(INC )
43+ @$(CXX ) $(CXX_FLAGS ) -MM $< -MP -MT $@ -MF $(@:.o=.d ) $(INC )
44+
45+ .PHONY : clean
46+ clean :
47+ rm -f FactorioViewer
48+ rm -r build/*
49+
50+ # include the dependencie files
51+ -include $(OBJ_FILES :.o=.d)
You can’t perform that action at this time.
0 commit comments