-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
45 lines (33 loc) · 1.13 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
MAIN_CPP_INCLUDES := meta_brainfuck_compiler.h
BINARY_NAME := test_program
CPP_STD := c++20
OPTIMIZATION_LEVEL := O3
USE_WALL := true
ifeq ($(USE_WALL), true)
POSSIBLE_WALL := -Wall
else
undefine POSSIBLE_WALL
endif
undefine CUSTOM_RECURSIVE_TEMPLATE_MAX_DEPTH
undefine CUSTOM_RECURSIVE_TEMPLATE_MAX_DEPTH_FLAG
ifdef CUSTOM_RECURSIVE_TEMPLATE_MAX_DEPTH
CUSTOM_RECURSIVE_TEMPLATE_MAX_DEPTH_FLAG := -ftemplate-depth=$(CUSTOM_RECURSIVE_TEMPLATE_MAX_DEPTH)
endif
CLANG_PREAMBLE := clang++-15 -std=$(CPP_STD) -$(OPTIMIZATION_LEVEL) $(POSSIBLE_WALL) -fno-exceptions $(CUSTOM_RECURSIVE_TEMPLATE_MAX_DEPTH_FLAG)
EMIT_ASSEMBLY := false
.PHONY: all unoptimized clean
all: test/bin/$(BINARY_NAME)
unoptimized:
$(MAKE) OPTIMIZATION_LEVEL:=O0
test/bin/$(BINARY_NAME): test/bin/main.o
$(CLANG_PREAMBLE) -o test/bin/$(BINARY_NAME) test/bin/main.o
test/bin/main.o: test/main.cpp $(MAIN_CPP_INCLUDES) test/bin/.dirstamp
$(CLANG_PREAMBLE) -c -I. -o test/bin/main.o test/main.cpp
ifeq ($(EMIT_ASSEMBLY), true)
$(CLANG_PREAMBLE) -S -I. -o test/bin/main.s test/main.cpp
endif
test/bin/.dirstamp:
mkdir -p test/bin
touch test/bin/.dirstamp
clean:
git clean -fdx