-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
102 lines (55 loc) · 1.39 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
CMF = "init/init_c.mk"
# --------------- set compiler command ---------------
CC = gcc
CCFLAGS = -std=c99
CCFLAGS += -Wall
LIB = -lm
DEFINE =
# --------------- set various paths ---------------
SRC = src
OBJ = obj
BIN = bin
RES = res
OUT = out
SCRIPTS = scripts
INC = includes
INCLUDES += -I$(INC) -I$(AFF) -I$(LOO) -I$(OMP) -I$(UTI)
VPATH = $(SRC) $(AFF) $(LOO) $(OMP) $(UTI)
# --------------- set specific name ---------------
MAIN = $(SRC)/main
MAIN_OBJ = $(OBJ)/main.o
LEETCODE = leetcode
# --------------- set make rules ---------------
## dir: create all necessary directories
.PHONY: dir
dir:
@mkdir -p $(OBJ) $(BIN) $(OUT)
## clean: clean all directories
.PHONY: clean
clean:
@rm -rf $(OBJ) $(BIN) $(OUT)
# here is the make command, and using different flag to compile
.PHONY: all
all: dir
@make $(BIN)/$(LEETCODE) -B
# --------------- set compile rules ---------------
$(OBJ)/%.o: %.c
$(CC) $(CCFLAGS) $(DEFINE) $(INCLUDES) -o $@ -c $<
$(BIN)/$(LEETCODE): $(MAIN_OBJ)
$(CC) $(CCFLAGS) $^ -o $@ $(LIB)
# --------------- set init_c rules ---------------
# please do not modify below rules
.PHONY: cinit
cinit:
@make -f $(CMF) cinit -B
.PHONY: cnew
cnew:
@make -f $(CMF) cnew $(filter-out $@,$(MAKECMDGOALS)) -B
.PHONY: submitcheck
submitcheck:
@make -f $(CMF) submitcheck $(filter-out $@,$(MAKECMDGOALS))
.PHONY: cclean_
cclean_:
@make -f $(CMF) cclean
%:
@: