-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
75 lines (58 loc) · 1.64 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
75
-include settings.mk
ifeq ($(ARCH),)
ARCH := native
endif
RTTIFLAGS = -fno-rtti -fno-exceptions
CXXFLAGS += -Wall -Wextra -Werror -std=c++17 -O3 -ffast-math -ftree-vectorize -march=$(ARCH) -mtune=generic -flto $(RTTIFLAGS) $(PGOFLAGS)
version :=
ifeq ($(version),)
version := $(shell date '+%Y%m%d')
commit := $(shell git rev-parse --short HEAD)
ifneq ($(commit),)
version := $(version)-$(commit)
branch := $(shell git branch --show-current)
ifneq ($(branch),)
ifneq ($(branch),main)
version := $(version)-$(branch)
endif
endif
endif
endif
release := out/seawall-$(version)$(SUFFIX)
CPPFLAGS += -DSEAWALL_VERSION=$(version) $(EXTRA_CPPFLAGS)
ifeq ($(LLVM_PROFDATA),)
LLVM_PROFDATA=llvm-profdata
endif
all: test $(release)
ifneq ($(branch),)
branchlink := branches/seawall-$(branch)
all: $(branchlink)
$(branchlink): $(release) branches
ln -s -f ../$(release) $(branchlink)
endif
$(release): seawall out
cp $< $@
seawall: seawall.cc | profile
$(RM) profile/*
$(MAKE) PGOFLAGS=-fprofile-generate=./profile profile/seawall
./profile.sh profile/seawall
$(RM) profile/seawall
if $(CXX) --version | grep -q clang; then $(LLVM_PROFDATA) merge -o ./profile/default.profdata ./profile; fi
$(MAKE) PGOFLAGS=-fprofile-use=./profile profile/seawall
mv profile/seawall $@
profile/seawall: seawall.cc
$(LINK.cc) $^ -o $@
branches out profile:
mkdir -p $@
test: seawall
./test.sh
tune: seawall.tune
./seawall.tune < filtered/20250213-195904.csv
seawall.tune: CPPFLAGS += -DTUNE=1
seawall.tune: RTTIFLAGS =
seawall.tune: LDLIBS += -ltbb
seawall.tune: seawall.cc
$(LINK.cc) $^ $(LDLIBS) -o $@
clean:
$(RM) -r seawall seawall.tune profile
.PHONY: all test tune clean