-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
52 lines (43 loc) · 1.16 KB
/
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
48
49
50
51
52
TARGET ?= vvx
BUILD_DIR := build
SRC_DIR := src
BIN_DIR := bin
SRC_FILES := $(shell find $(SRC_DIR) -name "*.cpp")
OBJ_FILES := $(subst $(SRC_DIR)/,,$(SRC_FILES:%.cpp=$(BUILD_DIR)/%.o))
DEP_FILES := $(OBJ_FILES:.o=.d)
CXX := clang++
INCLUDE_FLAGS := -I $(SRC_DIR) -I include
WARNING_FLAGS := \
-Wall \
-Wextra \
-Wwrite-strings \
-Winit-self \
-Wcast-align \
-Wcast-qual \
-Wold-style-cast \
-Wpointer-arith \
-Wstrict-aliasing \
-Wformat=2 \
-Wuninitialized \
-Wmissing-declarations \
-Woverloaded-virtual \
-Wnon-virtual-dtor \
-Wctor-dtor-privacy \
-Wno-long-long \
-Weffc++
LDLIBS := -pthread -L lib -lncurses -lsfml-system -lsfml-graphics -lsfml-window -l:vortex.a
DEBUG_FLAGS := -ferror-limit=5 -g -O0 -ftrapv
FLAGS := $(INCLUDE_FLAGS) $(WARNING_FLAGS) -MMD -MP -std=c++14 -pedantic $(DEBUG_FLAGS)
.PHONY : clean
$(BIN_DIR)/$(TARGET) : $(OBJ_FILES)
@echo "Linking..."
@mkdir -p $(BIN_DIR)
@$(CXX) $(OBJ_FILES) -o $@ $(LDFLAGS) $(LDLIBS)
$(BUILD_DIR)/%.o : $(SRC_DIR)/%.cpp
@echo "Building $@..."
@mkdir -p $(dir $@)
@$(CXX) $(FLAGS) $(CXXFLAGS) -c $< -o $@
clean :
@echo "Cleaning up..."
@$(RM) -r $(BIN_DIR) $(BUILD_DIR)
-include $(DEP_FILES)