aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 27a0c15c15be16dc3542e7a1f10f859fc49367b5 (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
BIN:=fib_eqI_b fib_ltI nfib nfib_nsa
OPTLL:=$(addsuffix .opt.ll,$(BIN))
OBJ:=$(addsuffix .o,$(BIN))
ASM:=$(addsuffix .s,$(BIN))
BC:=$(addsuffix .bc,$(BIN))
DEPS:=rts.ll

all: $(BIN)

$(BIN): %: %.o
	clang-11 $^ -o $@

$(OBJ): %.o: %.bc
	llc-11 -filetype=obj $^ -o $@

$(ASM): %.s: %.bc
	llc-11 $^ -o $@

$(BC): %.bc: %.opt.ll
	llvm-as-11 $^ -o $@

$(OPTLL): %.opt.ll: $(DEPS) %.ll
	cat $^ \
		| opt-11 -S -always-inline \
		| opt-11 -S -O3 \
		| sed 's/noinline nounwind optnone/nounwind/' \
		| opt-11 -S -O3 \
		-o $@

clean:
	$(RM) $(BIN) $(OBJ) $(ASM) $(BC)

.PHONY: all clean