-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
55 lines (42 loc) · 1.29 KB
/
makefile
File metadata and controls
55 lines (42 loc) · 1.29 KB
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
53
54
55
CXX = g++
CC = gcc
INC_DIR = include
SRC_DIR = src
OBJ_DIR = obj
DOC_DIR = doc
LIB_DIR = libs
INC_SUBDIRS = formula_token formula_token/data_types operation operation/visitors
CXXFLAGS = -Wall -pedantic -std=c++17 -g -I $(INC_DIR) $(addprefix -I $(INC_DIR)/, $(INC_SUBDIRS))
CCFLAGS = -I $(LIB_DIR)
# include lib folder
SRC_FILES := $(wildcard $(SRC_DIR)/*/*/*.cpp $(SRC_DIR)/*/*.cpp $(SRC_DIR)/*.cpp)
OBJ_FILES = $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRC_FILES))
DEP_FILES = $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.d,$(SRC_FILES))
EXE_FILE = kaninfed
.PHONY: doc
all: $(EXE_FILE) doc
compile: $(EXE_FILE)
run: $(EXE_FILE)
./$(EXE_FILE)
# docs in doc directory
doc:
doxygen Doxyfile
# rule to compile linenoise.c
$(OBJ_DIR)/linenoise.o: $(LIB_DIR)/linenoise.c $(LIB_DIR)/linenoise.h
@mkdir -p $(@D)
$(CC) $(CCFLAGS) -c $< -o $@
$(EXE_FILE): $(OBJ_FILES) $(OBJ_DIR)/linenoise.o
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) $^ -o $@
# create each .o file from its corresponding .cpp file
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(CXX) $(CXXFLAGS) -MM -MT $@ -MF $(patsubst %.o,%.d,$@) $<
clean:
rm -rf $(OBJ_DIR)
rm -f $(EXE_FILE)
rm -rf $(DOC_DIR)
rm -f table_tmp.txt kaninfed.zip json.txt *.tmp
# include the dependency files
-include $(DEP_FILES)