-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (45 loc) · 1.1 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
CC := gcc
CCFLAGS := -Wall -Wextra -std=c17 -pthread
OPFLAGS := -O3 -flto -DNO_VALIDATE
DBFLAGS := -g -DDEBUG
OBJ := obj
TARGET := bin
SRC := util
LIB := lib
OBJ_IFACE := $(OBJ)/iface.o
OBJ_SETREC := $(OBJ)/setRec.o
OBJ_EXPAND := $(OBJ)/expand.o
OBJ_NULTEST := $(OBJ)/nulTest.o
SRC_GEN := $(SRC)/generation.c
SRC_WEED := $(SRC)/weed.c
SRC_EVAL := $(SRC)/evaluate.c
SRC_CREATE := $(SRC)/create.c
DEP_UTIL := $(OBJ_IFACE) $(OBJ_SETREC)
DEP_GEN := $(OBJ_EXPAND)
DEP_WEED := $(OBJ_NULTEST)
DEP_EVAL :=
DEP_CREATE :=
GEN := $(TARGET)/gen
WEED := $(TARGET)/weed
EVAL := $(TARGET)/eval
CREATE := $(TARGET)/create
UTILS := $(GEN) $(WEED) $(EVAL) $(CREATE)
.PHONY: all out debug clean utils dirs
all: out
out: CCFLAGS += $(OPFLAGS)
out: utils
debug: CCFLAGS += $(DBFLAGS)
debug: utils
utils: dirs $(UTILS)
dirs:
mkdir -p $(OBJ) $(TARGET)
clean:
rm -r $(OBJ) $(TARGET)
$(OBJ)/%.o: $(LIB)/%.c
$(CC) $(CCFLAGS) -c $< -o $@
$(GEN): $(DEP_GEN) $(SRC_GEN)
$(WEED): $(DEP_WEED) $(SRC_WEED)
$(EVAL): $(DEP_EVAL) $(SRC_EVAL)
$(CREATE): $(DEP_CREATE) $(SRC_CREATE)
$(UTILS): $(DEP_UTIL)
$(CC) $(CCFLAGS) $^ -o $@