-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
42 lines (32 loc) · 886 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
CXXFLAGS := "-g"
CXX="clang++"
LD = /usr/bin/ld
AS = /usr/bin/as
CLANG = /usr/bin/clang
LLC = /usr/bin/llc
OPT = /usr/bin/opt
lang.o: lang.cc lang.h
${CXX} ${CXXFLAGS} -o $@ -c $<
main: main.cc lang.o
${CXX} ${CXXFLAGS} -o $@ lang.o $<
print.s: print.c
${CLANG} -emit-llvm -c -S $<
${LLC} print.ll
${OPT} -S -mem2reg -instnamer print.ll -o print_before_opt.ll
print.o: print.s
${AS} $< -o $@
print: print.o
${LD} -e main -dynamic-linker /lib64/ld-linux-x86-64.so.2 \
/lib64/crt1.o /lib64/crti.o -lc -arch x86_64 [email protected] \
/lib64/crtn.o -o $@
lto_a.o: lto_a.c
${CLANG} -flto -g -c -o $@ $<
lto_main.o: lto_main.c
${CLANG} -g -c -o $@ $<
lto_main: lto_main.o
${CLANG} -flto lto_a.o lto_main.o -o main
libunwind: libunwind.c
${CC} -g -o $@ -lunwind $<
.PHONY: clean
clean:
@${RM} lang.o main print print.o print.s print.ll print_before_opt.ll lto_a.o