-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMakefile
74 lines (59 loc) · 1.79 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Makefile
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
SANITIZERS = none msan asan usan tsan
.PHONY: default check ce todo distclean clean build test all $(SANITIZERS)
CXX_FLAGS = -g
SANITIZER = none
BUILDROOT = build
BUILD = $(BUILDROOT)/none
ifeq ($(SANITIZER),none)
CXX_FLAGS = -O3 -pedantic -Wall -Wextra -Werror
endif
ifeq ($(SANITIZER),usan)
SAN_FLAGS = -fsanitize=memory
BUILD = $(BUILDROOT)/msan
endif
ifeq ($(SANITIZER),asan)
SAN_FLAGS = -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize-address-use-after-scope
BUILD = $(BUILDROOT)/asan
endif
ifeq ($(SANITIZER),usan)
SAN_FLAGS = -fsanitize=undefined
BUILD = $(BUILDROOT)/usan
endif
ifeq ($(SANITIZER),tsan)
SAN_FLAGS = -fsanitize=thread
BUILD = $(BUILDROOT)/tsan
endif
ifeq ($(SANITIZER),lsan)
SAN_FLAGS = -fsanitize=leak
BUILD = $(BUILDROOT)/lsan
endif
default: test
all: $(SANITIZERS)
none: test
$(SANITIZERS):
$(MAKE) SANITIZER=$@
SYSROOT = -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.sdk
# TOOLCHAIN = -DCMAKE_TOOLCHAIN_FILE=$(CURDIR)/etc/gcc-toolchain.cmake
build:
@mkdir -p $(BUILD)
cd $(BUILD); CC=$(CXX) cmake ../.. $(TOOLCHAIN) $(SYSROOT) -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_CXX_FLAGS="$(CXX_FLAGS) $(SAN_FLAGS)"
cmake --build $(BUILD)
test: build
cd $(BUILD); $(MAKE) test
ce:
@mkdir -p $(BUILD)
bin/mk-compiler-explorer.py $(BUILD)
check:
@for h in `find include -name \*.hpp`; \
do \
from=`echo -n $$h | sed -n 's@.*Beman/\(.*\).hpp.*@\1@p'`; \
< $$h sed -n "/^ *# *include <Beman\//s@.*[</]Beman/\(.*\).hpp>.*@$$from \1@p"; \
done | tsort > /dev/null
todo:
bin/mk-todo.py
clean:
$(RM) mkerr olderr *~
distclean: clean
$(RM) -r $(BUILDROOT)