-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (40 loc) · 1.09 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
CFLAGS ?= -O3 -Wall
CXXFLAGS ?= -O3 -Wall
CXXFLAGS += $(shell llvm-config --cxxflags)
LDFLAGS += $(shell llvm-config --ldflags --system-libs --libs all) -flto -lLLVM
EXE_NAME ?= adscript
OUTPUT ?= ./$(EXE_NAME)
PREFIX ?= /usr/local
SFILES = $(wildcard src/*.cc)
OFILES = $(SFILES:.cc=.o)
all: $(OUTPUT) compile_flags.txt SPEC.pdf
$(OUTPUT): $(OFILES)
clang++ $(LDFLAGS) $(OFILES) -o $(OUTPUT)
strip $(OUTPUT)
compile_flags.txt: Makefile
echo '$(CXXFLAGS)' | tr ' ' '\n' > compile_flags.txt
%.o: %.cc
clang++ $(CXXFLAGS) -c $< -o $@
%.o: %.c
clang $(CFLAGS) -c $< -o $@
%.o: %.adscript $(OUTPUT)
$(OUTPUT) -o $@ $<
test/test.out: test/main.o test/basic.o
clang++ $^ -o $@
test/bench.out: test/lel.o test/bench.o
clang++ $^ -o $@
%.pdf: %.md
pandoc $< -o $@
test: test/test.out
test/test.out
bench: test/bench.out
test/bench.out
clean:
rm -f $(OUTPUT) $(OFILES) test/*.o test/*.out
install: all
cp -f $(OUTPUT) $(PREFIX)/bin/$(EXE_NAME)
# this should not exist
reinstall: clean install
uninstall:
rm -f $(PREFIX)/bin/$(EXE_NAME)
.PHONY: all test clean install reinstall uninstall