-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
51 lines (36 loc) · 849 Bytes
/
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
CC=clang-12
CFLAGS=-g `llvm-config-12 --cflags`
LD=clang-12
LDFLAGS=`llvm-config-12 --cflags --ldflags --libs core executionengine interpreter analysis native bitwriter --system-libs`
.PHONY: all
all: math fib fac main
math.o: math.c
$(CC) $(CFLAGS) -c $<
driver.o: driver.c math.bc
$(CC) $(CFLAGS) -c $<
fac.o: fac.c driver.o
$(CC) $(CFLAGS) -c $<
fib.o: fib.c driver.o
$(CC) $(CFLAGS) -c $<
fib: fib.o driver.o
$(LD) $(LDFLAGS) $^ -o $@
fac: fac.o driver.o
$(LD) $(LDFLAGS) $^ -o $@
math: math.o
$(LD) $(LDFLAGS) $< -o $@
math.bc: math
./math
math.ll: math.bc
llvm-dis-12 $<
libmath.o: math.bc
llc-12 $< -o libmath.o -filetype=obj
libmath.s: math.bc
llc-12 $< -o libmath.o
main.o: main.c
$(CC) $(CFLAGS) -c $<
main: main.o libmath.o
$(LD) $(LDFLAGS) $^ -o $@
.PHONY: clean
clean:
rm -f math math.bc math.ll
rm -f *.o