aboutsummaryrefslogtreecommitdiffstats
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile26
1 files changed, 26 insertions, 0 deletions
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..fb5c24d
--- /dev/null
+++ b/makefile
@@ -0,0 +1,26 @@
+CXX = g++
+CXX_FLAGS = -Wfatal-errors -Wall -Wextra -Wpedantic -Wconversion -Wshadow -Iinclude
+
+BIN = simplex
+BUILD_DIR = ./build
+
+CPP = $(wildcard src/*.cpp)
+
+OBJ = $(CPP:%.cpp=$(BUILD_DIR)/%.o)
+DEP = $(OBJ:%.o=%.d)
+
+$(BIN) : $(BUILD_DIR)/$(BIN)
+
+$(BUILD_DIR)/$(BIN) : $(OBJ)
+ mkdir -p $(@D)
+ $(CXX) $(CXX_FLAGS) $^ -o $@
+
+-include $(DEP)
+
+$(BUILD_DIR)/%.o : %.cpp
+ mkdir -p $(@D)
+ $(CXX) $(CXX_FLAGS) -MMD -c $< -o $@
+
+.PHONY : clean
+clean :
+ -rm $(BUILD_DIR)/$(BIN) $(OBJ) $(DEP)