-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
69 lines (36 loc) · 1.01 KB
/
makefile
File metadata and controls
69 lines (36 loc) · 1.01 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
CC = g++
RMDIR = rm -rf
RM = rm -f
DEP_FLAGS = -MT $@ -MMD -MP -MF $(DEP_PATH)/s*.DEP_PATH
DIRECTIVES = -std=c++11 -Wall -Wextra -c -I $(HEADER_PATH)
LIBS = -lSDL2 -lSDL2_image -lSDL2_mixer -lSDL2_ttf -lm
HEADER_PATH = include
SRC_PATH = src
BIN_PATH = bin
DEP_PATH = dep
CPP_FILES = $(wildcard $(SRC_PATH)/*.cpp)
OBJ_FILES = $(addprefix $(BIN_PATH)/,$(notdir $(CPP_FILES:.cpp=.o)))
DEP_FILES = $(wildcard $(DEP_PATH)/*.d)
EXEC = JOGO
all: $(EXEC)
$(EXEC): $(OBJ_FILES)
$(CC) -o $@ $^ $(LIBS)
$(BIN_PATH)/%.o: $(SRC_PATH)/%.cpp
ifeq ($(OS),Windows_NT)
@if not exist $(DEP_PATH) @mkdir $(DEP_PATH)
@if not exist $(BIN_PATH) @mkdir $(BIN_PATH)
else
@mkdir -p $(DEP_PATH) $(BIN_PATH)
endif
$(CC) $(DEP_FLAGS) -c -o $@ $< $(DIRECTIVES)
-include $(DEP_FILES)
clean:
$(RMDIR) $(BIN_PATH) $(DEP_PATH)
$(RM) $(EXEC)
.PRECIOUS: $(DEP_PATH)/%.d
.PHONY: debug clean release
print-%: ; @echo $* = $($*)
debug: DIRECTIVES += -ggdb -O0
debug: all
release: DIRECTIVES += -Ofast -mtune=native
release: all