-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
57 lines (37 loc) · 2.75 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
# SPDX-FileCopyrightText: Copyright 2023 Arm Limited and/or its affiliates <[email protected]>
# SPDX-License-Identifier: Apache-2.0 OR MIT
CHERI ?= $(HOME)/cheri
SDKPREFIX ?= $(CHERI)/output/morello-sdk/bin/
CFLAGS ?= -Wall -Wextra -pedantic -O1 -g
MORELLO_PURECAP := --config cheribsd-morello-purecap.cfg
MORELLO_HYBRID := --config cheribsd-morello-hybrid.cfg
.PHONY: all clean clang-format clang-format-check examples-morello-purecap examples-morello-hybrid
all: test-morello-purecap test-morello-hybrid libcapmap-morello-purecap.so libcapmap-morello-hybrid.so examples-morello-purecap examples-morello-hybrid
clean:
rm -rf obj test-morello-purecap test-morello-hybrid libcapmap-*.so example-*-morello-*
clang-format:
$(SDKPREFIX)clang-format -i tests/*.cc tests/*.h include/*.h src/*.cc
clang-format-check:
@! $(SDKPREFIX)clang-format -output-replacements-xml tests/*.cc tests/*.h include/*.h src/*.cc | grep -c '<replacement ' > /dev/null
examples-morello-purecap: $(patsubst examples/%.cc,example-%-morello-purecap,$(wildcard examples/*.cc))
examples-morello-hybrid: $(patsubst examples/%.cc,example-%-morello-hybrid,$(wildcard examples/*.cc))
test-morello-purecap: libcapmap-morello-purecap.so tests/*.cc tests/*.h
$(SDKPREFIX)clang++ -Wl,-rpath,. -L. -lcapmap-morello-purecap $(CFLAGS) $(MORELLO_PURECAP) -I. tests/*.cc -std=c++14 -o $@
obj/morello-purecap/%.o: src/%.cc include/*.h
@mkdir -p obj/morello-purecap
$(SDKPREFIX)clang++ -fPIC $(CFLAGS) $(MORELLO_PURECAP) -I. $< -std=c++14 -c -o $@
OBJS_MORELLO_PURECAP := $(patsubst src/%.cc,obj/morello-purecap/%.o,$(wildcard src/*.cc))
libcapmap-morello-purecap.so: $(OBJS_MORELLO_PURECAP) include/*.h
$(SDKPREFIX)clang++ -fPIC -shared $(CFLAGS) $(MORELLO_PURECAP) -lutil -I. $(OBJS_MORELLO_PURECAP) -std=c++14 -o $@
example-%-morello-purecap: examples/%.cc include/*.h libcapmap-morello-purecap.so
$(SDKPREFIX)clang++ -Wl,-rpath,. -L. -lcapmap-morello-purecap $(CFLAGS) $(MORELLO_PURECAP) -I. $< -std=c++14 -o $@
test-morello-hybrid: libcapmap-morello-hybrid.so tests/*.cc tests/*.h
$(SDKPREFIX)clang++ -Wl,-rpath,. -L. -lcapmap-morello-hybrid $(CFLAGS) $(MORELLO_HYBRID) -I. tests/*.cc -std=c++14 -o $@
obj/morello-hybrid/%.o: src/%.cc include/*.h
@mkdir -p obj/morello-hybrid
$(SDKPREFIX)clang++ -fPIC $(CFLAGS) $(MORELLO_HYBRID) -I. $< -std=c++14 -c -o $@
OBJS_MORELLO_HYBRID := $(patsubst src/%.cc,obj/morello-hybrid/%.o,$(wildcard src/*.cc))
libcapmap-morello-hybrid.so: $(OBJS_MORELLO_HYBRID) include/*.h
$(SDKPREFIX)clang++ -fPIC -shared $(CFLAGS) $(MORELLO_HYBRID) -lutil -I. $(OBJS_MORELLO_HYBRID) -std=c++14 -o $@
example-%-morello-hybrid: examples/%.cc include/*.h libcapmap-morello-hybrid.so
$(SDKPREFIX)clang++ -Wl,-rpath,. -L. -lcapmap-morello-hybrid $(CFLAGS) $(MORELLO_HYBRID) -I. $< -std=c++14 -o $@