-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (27 loc) · 832 Bytes
/
Makefile
File metadata and controls
38 lines (27 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
SRC_DIR = src
OBJ_DIR = obj
BIN_DIR = bin
EXE = $(BIN_DIR)/tsp
SRC = $(wildcard $(SRC_DIR)/*.cpp $(SRC_DIR)/**/*.cpp)
OBJ = $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRC))
CPPFLAGS = -MMD -MP
CXXFLAGS = -O3 -Wall #-pg
LDFLAGS = #-pg
LDLIBS =
$(shell mkdir -p $(dir $(OBJ)) >/dev/null)
$(shell mkdir -p $(dir $(EXE)) >/dev/null)
.PHONY: all clean win
all: $(EXE)
$(EXE): $(OBJ)
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
win:
if [ ! -d bin ]; then mkdir bin; fi
x86_64-w64-mingw32-g++ -O3 -static $(SRC_DIR)/**/*.cpp $(SRC_DIR)/*.cpp -o $(EXE).exe
win32:
if [ ! -d bin ]; then mkdir bin; fi
i686-w64-mingw32-g++ -O3 -static $(SRC_DIR)/**/*.cpp $(SRC_DIR)/*.cpp -o $(EXE)32.exe
clean:
@$(RM) -rv $(BIN_DIR) $(OBJ_DIR)
-include $(OBJ:.o=.d)