forked from andrewchambers/c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (58 loc) · 1.44 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
CFLAGS = -std=c89 -g -Wfatal-errors -Wno-unused-parameter -Wall -Wextra -D_DEFAULT_SOURCE
# NOTE if one of these headers does not exist, the wildcard rule fails.
HFILES = src/u.h src/cc/cc.h src/ds/ds.h src/mem/mem.h
CCO = src/cc/cpp.o \
src/cc/lex.o \
src/cc/parse.o \
src/cc/types.o \
src/cc/foldexpr.o \
src/cc/error.o
GCO = src/mem/mem.o
DSO = src/ds/list.o \
src/ds/map.o \
src/ds/vec.o \
src/ds/strset.o
LIBO = src/panic.o $(CCO) $(GCO) $(DSO)
LIBA = lib/libcompiler.a
CPPO = src/cmd/cpp/main.o
_6CO = src/cmd/6c/emit.o \
src/cmd/6c/frontend.o \
src/cmd/6c/main.o
ABIFZO = src/cmd/abifuzz/main.o
all: bin/6c \
bin/cpp \
bin/abifuzz
.PHONY: all clean test selfhost
test:
make clean
make all
./test.sh
selfhost:
make clean
make all
./test.sh
./selfhost.sh
mv ./bin/selfhosted ./bin/6c
./test.sh
./selfhost.sh
mv ./bin/selfhosted ./bin/6c
./test.sh
./selfhost.sh
mv ./bin/selfhosted ./bin/6c
./test.sh
.c.o: $(HFILES)
$(CC) $(CFLAGS) -Isrc/ -o $@ -c $<
bin/6c: $(_6CO) $(LIBA)
@ mkdir -p bin
$(CC) $(LDFLAGS) $(_6CO) $(LIBA) -o $@
bin/cpp: $(CPPO) $(LIBA)
@ mkdir -p bin
$(CC) $(LDFLAGS) $(CPPO) $(LIBA) -o $@
bin/abifuzz: $(ABIFZO) $(LIBA)
@ mkdir -p bin
$(CC) $(LDFLAGS) $(ABIFZO) $(LIBA) -o $@
$(LIBA): $(LIBO)
@ mkdir -p lib
$(AR) rcs $(LIBA) $(LIBO)
clean:
rm -rf $(LIBO) $(CPPO) $(_6CO) $(ABIFZO) lib bin