-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
49 lines (29 loc) · 797 Bytes
/
Makefile
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
# --- DIRECTORIES ---
CCC = g++ -std=gnu++11 -no-pie -Iincludes
# --- OPTIMIZATION FLAGS ---
DEBUG_OPT = -DNDEBUG -O3
#DEBUG_OPT = -g3 -O0
#PROF = -pg
PROF =
CFLAGS += $(CCOPT) -I./include $(DEBUG_OPT) -c $(PROF)
# ---- COMPILE ----
SRC_DIR := src
OBJ_DIR := obj
SRC_DIRS := $(shell find $(SRC_DIR) -type d)
OBJ_DIRS := $(addprefix $(OBJ_DIR)/,$(SRC_DIRS))
SOURCES := $(shell find $(SRC_DIR) -name '*.cpp')
OBJ_FILES := $(addprefix $(OBJ_DIR)/, $(SOURCES:.cpp=.o))
vpath %.cpp $(SRC_DIRS)
# ---- TARGETS ----
EXECUTABLE=MPP
all: $(EXECUTABLE)
$(EXECUTABLE): makedir $(SOURCES) $(OBJ_FILES)
$(CCC) $(OBJ_FILES) $(PROF) -o $@
$(OBJ_DIR)/%.o: %.cpp
$(CCC) $(CFLAGS) $< -o $@
makedir: $(OBJ_DIRS)
$(OBJ_DIRS):
@mkdir -p $@
clean:
@rm -rf obj
@rm -rf $(EXECUTABLE)