-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
63 lines (45 loc) · 2.08 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
CFLAGS?=-ansi -g -Ic_src -Lc_src
LCFLAGS?=-ansi -pedantic -g -Wall -Werror -Ic_src -Lc_src
##### libtamsin #####
OBJECTS=c_src/dict.o c_src/scanner.o c_src/term.o c_src/tamsin.o
PROGS=bin/tamsin-compiler bin/micro-tamsin
all: c_src/libtamsin.a
c_src/scanner.o: c_src/tamsin.h c_src/scanner.c
$(CC) $(LCFLAGS) -c c_src/scanner.c -o $@
c_src/term.o: c_src/tamsin.h c_src/term.c
$(CC) $(LCFLAGS) -c c_src/term.c -o $@
c_src/tamsin.o: c_src/tamsin.h c_src/tamsin.c
$(CC) $(LCFLAGS) -c c_src/tamsin.c -o $@
c_src/libtamsin.a: $(OBJECTS)
ar -r $@ $(OBJECTS)
##### executables #####
TAMSIN_COMPILER_LIBS=lib/list.tamsin lib/tamsin_scanner.tamsin \
lib/tamsin_parser.tamsin lib/tamsin_analyzer.tamsin
bin/tamsin-compiler: c_src/libtamsin.a c_src/tamsin.h \
$(TAMSIN_COMPILER_LIBS) \
mains/compiler.tamsin
bin/tamsin compile $(TAMSIN_COMPILER_LIBS) mains/compiler.tamsin > tmp/foo.c
$(CC) $(CFLAGS) tmp/foo.c -o $@ -ltamsin
bin/bootstrapped-compiler: c_src/libtamsin.a c_src/tamsin.h \
bin/tamsin-compiler \
$(TAMSIN_COMPILER_LIBS) \
mains/compiler.tamsin
bin/tamsin-compiler $(TAMSIN_COMPILER_LIBS) mains/compiler.tamsin > tmp/foo.c
$(CC) $(CFLAGS) tmp/foo.c -o $@ -ltamsin
MICRO_TAMSIN_LIBS=lib/list.tamsin lib/tamsin_scanner.tamsin \
lib/tamsin_parser.tamsin
bin/micro-tamsin: c_src/libtamsin.a c_src/tamsin.h \
$(MICRO_TAMSIN_LIBS) \
mains/micro-tamsin.tamsin
bin/tamsin compile $(MICRO_TAMSIN_LIBS) mains/micro-tamsin.tamsin > tmp/foo.c
$(CC) $(CFLAGS) tmp/foo.c -o $@ -ltamsin
MINI_TAMSIN_LIBS=lib/list.tamsin lib/tamsin_scanner.tamsin \
lib/tamsin_parser.tamsin
bin/mini-tamsin: c_src/libtamsin.a c_src/tamsin.h \
$(MINI_TAMSIN_LIBS) \
mains/mini-tamsin.tamsin
bin/tamsin compile $(MINI_TAMSIN_LIBS) mains/mini-tamsin.tamsin > tmp/foo.c
$(CC) $(CFLAGS) tmp/foo.c -o $@ -ltamsin
clean:
rm -f c_src/libtamsin.a c_src/*.o $(PROGS)