-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (71 loc) · 2.33 KB
/
Makefile
File metadata and controls
99 lines (71 loc) · 2.33 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
PYTHON ?= python3
PANDOC ?= pandoc
SCION_ROOT ?= $(HOME)/scionproto-scion
SRC_ROOT := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
BUILD_DIR := $(SRC_ROOT)/build
PKG_DIR := $(SRC_ROOT)/out
PYTHONPATH := $(PYTHONPATH):$(SRC_ROOT)/python
DOCKER_TAG := 0.0.4
HOST_UID := $(shell id -u):$(shell id -g)
TEST_DATA=$(addsuffix .bin,$(basename $(shell find tests scitra/tests -name '*.py')))
MAN_PAGES=$(addsuffix .gz,$(basename $(shell find scitra interposer -name '*.*.md')))
# Build library and examples
.PHONY: release-shared
release-shared:
@mkdir -p "$(BUILD_DIR)"
cmake -G 'Ninja Multi-Config' -DBUILD_SHARED_LIBS=ON -B build
cmake --build "$(BUILD_DIR)" --config Release
.PHONY: release
release:
cmake --build "$(BUILD_DIR)" --config Release
.PHONY: debug
debug:
cmake --build "$(BUILD_DIR)" --config Debug
# Run tests
.PHONY: test
test:
TEST_BASE_PATH=$(realpath tests) "$(BUILD_DIR)/Debug/unit-tests"
.PHONY: test-scitra
test-scitra:
TEST_BASE_PATH=$(realpath scitra/tests) "$(BUILD_DIR)/scitra/Debug/scitra-tests"
.PHONY: test-interposer
test-interposer:
SCION_CONFIG="$(SRC_ROOT)/interposer/integration/config/scion_interposer.toml" \
"$(BUILD_DIR)/interposer/Debug/interposer-tests"
# Integration tests
.PHONY: test-integration
test-integration:
$(PYTHON) integration-tests/all_tests.py -b "$(BUILD_DIR)" -s "$(SCION_ROOT)"
$(PYTHON) scitra/integration-test/run_ipv4_tests.py -b "$(BUILD_DIR)" -s "$(SCION_ROOT)"
$(PYTHON) scitra/integration-test/run_ipv6_tests.py -b "$(BUILD_DIR)" -s "$(SCION_ROOT)"
# Make test data
.PHONY: test-data clean-test-data
test-data: $(TEST_DATA)
clean-test-data: $(TEST_DATA)
rm $^
$(TEST_DATA): %.bin: %.py
PYTHONPATH=$(PYTHONPATH) $(PYTHON) $<
# Doxygen
.PHONY: docs
docs:
@mkdir -p "$(BUILD_DIR)/docs"
doxygen
# Manual Pages
.PHONY: man clean-man
man: $(MAN_PAGES)
$(MAN_PAGES): %.gz: %.md
$(PANDOC) --standalone --to man $< | gzip > $@
clean-man: $(MAN_PAGES)
rm $^
# Debian Packages
.PHONY: deb
deb: release man
@mkdir -p "$(PKG_DIR)"
cd "$(PKG_DIR)" && cpack -G DEB --config "$(BUILD_DIR)/CPackConfig.cmake"
# Docker build
.PHONY: deb-docker
deb-docker: man
@mkdir -p "$(PKG_DIR)"
docker build -t scion-cpp-builder:$(DOCKER_TAG) "$(SRC_ROOT)/docker/package"
docker run -e HOST_UID=$(HOST_UID) -v "$(SRC_ROOT)":/scion-cpp:ro -v "$(PKG_DIR)":/out --rm \
scion-cpp-builder:$(DOCKER_TAG)