-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmakefile
40 lines (31 loc) · 1009 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
# Flags
# ------------------------------------------------------------------------------
# Allow users to specify their preferred C++ compiler.
COMPILER=g++
# Allow users to specify custom compiler flags.
FLAGS=-O2
# Paths
# ------------------------------------------------------------------------------
# Directories
BIN_DIR=./bin
CPP_DIR=./src/cpp
TEST_DIR=./src/test
# Executables
MAIN_EXE=$(BIN_DIR)/ctgl.exe
TEST_EXE=$(BIN_DIR)/ctgl_test.exe
# Files
TEST_FILES=$(wildcard $(TEST_DIR)/*_test.cpp)
# Rules
# ------------------------------------------------------------------------------
all: bin
@rm -f $(MAIN_EXE)
@$(COMPILER) $(FLAGS) -std=c++17 -pedantic-errors -Wall -Wfatal-errors -o $(MAIN_EXE) $(CPP_DIR)/ctgl.cpp
@$(MAIN_EXE)
test: bin
@rm -f $(TEST_EXE)
@$(COMPILER) $(FLAGS) -std=c++17 -pedantic-errors -Wall -Wfatal-errors -o $(TEST_EXE) $(TEST_FILES) -lgtest -lgtest_main
@$(TEST_EXE)
bin:
@mkdir -p $(BIN_DIR)
clean:
@rm -rf $(BIN_DIR)