-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (30 loc) · 937 Bytes
/
Makefile
File metadata and controls
39 lines (30 loc) · 937 Bytes
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
CC=gcc
CFLAGS=-Iinclude -Wall
TARGET=shell
DEPS=$(wildcard *.h)
SRC_DIR=src
SRC=$(wildcard $(SRC_DIR)/*.c)
OBJ=$(patsubst $(SRC_DIR)/%.c, $(SRC_DIR)/%.o, $(SRC))
DEP_SRC=$(filter-out src/$(TARGET).c, $(SRC))
DEP_OBJ=$(filter-out src/$(TARGET).o, $(OBJ))
CXX=g++
TEST_SRC_DIR=test
TEST_SRC=$(wildcard $(TEST_SRC_DIR)/*_test.c)
TEST=test/all_test
TEST_FLAGS=-lgtest -pthread -std=c++11 -I$(TEST_SRC_DIR)/include
TEST_UTIL=$(wildcard $(TEST_SRC_DIR)/*_Util.c)
TEST_UTIL_INCLUE=$(wildcard $(TEST_SRC_DIR)/include/*.h)
all: $(TARGET)
%.o: %.c $(DEPS)
$(CC) -o $@ $< -c $(CFLAGS)
shell: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
check: $(TEST)
-$(TEST)
find test/ -name "*.db" -delete
$(TEST): $(TEST_SRC) $(DEP_SRC) $(DEPS) $(TEST_UTIL) $(TEST_UTIL_INCLUE)
$(CXX) -o $@ $(TEST_SRC) $(DEP_SRC) $(TEST_UTIL) $(CFLAGS) $(TEST_FLAGS)
.PHONY: clean check
clean:
-rm $(TARGET) $(OBJ) $(TEST) $(wildcard test/*.db)
rm -rf test/system/output/*