-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
29 lines (23 loc) · 864 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
CPP=g++
CFLAGS=-Wall -std=c++17 -g -Iinclude
BUILD_DIR=build
CPP_FILES := $(wildcard src/*.cpp)
OBJ=$(foreach file,$(CPP_FILES),$(BUILD_DIR)/$(file:.cpp=.o))
TEST_DIR=test
TEST_FILE=test
SOFTWARE_NAME=ggram
RM=rm
$(shell mkdir -p $(BUILD_DIR))
$(shell mkdir -p $(BUILD_DIR)/src)
$(BUILD_DIR)/src/%.o: src/%.cpp
$(CPP) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/$(SOFTWARE_NAME): $(OBJ)
$(CPP) $(CFLAGS) -o $(BUILD_DIR)/$(SOFTWARE_NAME) $(OBJ)
release: $(BUILD_DIR)/$(SOFTWARE_NAME)
$(CPP) $(CFLAGS) -O3 -o $(BUILD_DIR)/$(SOFTWARE_NAME) $(OBJ)
test: $(BUILD_DIR)/$(SOFTWARE_NAME) $(TEST_DIR)/$(TEST_FILE).gg
./$(BUILD_DIR)/$(SOFTWARE_NAME) -f $(TEST_DIR)/$(TEST_FILE).gg -o $(TEST_DIR)/$(TEST_FILE).cpp
$(CPP) $(CFLAGS) -o $(TEST_DIR)/$(TEST_FILE) $(TEST_DIR)/$(TEST_FILE).cpp
./$(TEST_DIR)/$(TEST_FILE)
clean:
$(RM) -r $(BUILD_DIR)