-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
41 lines (30 loc) · 974 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
.PHONY: install test clean
COMPILER=bin/compiler
FLAGS=-Wall -std=c++2a
DEPS_FLAGS=-MMD -MP
SRC=$(wildcard src/*.cpp src/codegen/*.cpp)
OBJ=$(SRC:.cpp=.o)
DEPS=$(OBJ:.o=.d)
OBJ_EXCEPT_MAIN=$(filter-out src/main.o, $(OBJ))
BENCHMARKS=$(wildcard benchmarks/*)
all: $(COMPILER)
# link object files into executable
$(COMPILER): $(OBJ)
clang++ $(FLAGS) $(DEPS_FLAGS) -o $@ $(OBJ)
# build object files
%.o: %.cpp
clang++ $(FLAGS) $(DEPS_FLAGS) -c $< -o $@
test: $(COMPILER)
$< --exit
install:
mkdir -p bin
clean:
rm -f $(OBJ) $(DEPS)
debug_test: $(OBJ)
clang++ $(FLAGS) $(DEPS_FLAGS) -g -o [email protected] $(OBJ)
gdb [email protected] -- --exit
benchmark: compile_benchmarks
bin/benchmark --benchmark_out=benchmarks.txt --benchmark_out_format=console
compile_benchmarks: $(COMPILER) $(BENCHMARKS)
clang++ $(FLAGS) -o bin/benchmark $(OBJ_EXCEPT_MAIN) $(BENCHMARKS) -isystem ../../vendors/benchmark/include -L../../vendors/benchmark/build/src -lbenchmark -lpthread
-include $(DEPS)