blob: 9dbbb04987c9ddb0f25d98c6f953f5e2a46bf6bd (
plain) (
blame)
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
|
CFLAGS = --std=c99 -Wpedantic -Wall
CFLAGS += $(shell llvm-config --cflags)
CXXFLAGS += $(shell llvm-config --cppflags)
LDFLAGS += $(shell llvm-config --ldflags)
LDLIBS += $(shell llvm-config --libs core analysis --system-libs)
.PHONY: default all clean
default: all
all: basic
basic.o: basic.h parse.h debug.h error.h scope.h
parse.o: basic.h
lex.o: basic.h parse.h
scope.o: scope.h error.h
basic: basic.o parse.o lex.o scope.o
$(LINK.cc) $(OUTPUT_OPTION) $^ $(LDLIBS)
parse.h: parse.y
$(YACC) -d -o /dev/null $<
mv -f y.tab.h $@
# test stuff (warning: influenced by compiler flags declared above!)
# TODO should probably rearrange the system so tests don't use the same build
# configs as the compiler
simple: simple.o common.o
%.o: %.c
$(COMPILE.c) $(OUTPUT_OPTION) $<
%.o: %.ll
clang -c $(OUTPUT_OPTION) $<
%.ll: %.int basic
< $< ./basic > $@
%.ll: %.c
clang -S -emit-llvm $(OUTPUT_OPTION) $<
clean:
$(RM) basic simple y.tab.* *.ll *.o lex.c parse.c parse.h
|