-
Notifications
You must be signed in to change notification settings - Fork 160
/
Makefile
67 lines (48 loc) · 1.68 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
.PHONY: all clean goenv gogen vendor mocks bazel bazel_bin_clean gazelle setcap clibs libscion libfilter dispatcher uninstall tags
BRACCEPT = bin/braccept
GAZELLE_MODE?=fix
SRC_DIRS = c/lib/scion c/lib/filter c/dispatcher
all: tags clibs dispatcher bazel gogen
clean:
$(foreach var,$(SRC_DIRS),$(MAKE) -C $(var) clean || exit 1;)
bazel clean
rm -f bin/* tags
if [ -e go/vendor ]; then rm -r go/vendor; fi
goenv: vendor
gogen:
ifndef GOGEN_SKIP
rm -f go/proto/*.gen.go go/proto/*.capnp.go
rm -f bazel-genfiles/go/proto/gogen/* # clean stale files
bazel build //go/proto:structs //go/proto:capnp
cp --no-preserve=mode bazel-genfiles/go/proto/gogen/* go/proto/
else
echo "gogen: skipped"
endif
vendor:
./tools/vendor.sh
bazel: vendor bazel_bin_clean
bazel build //:scion //:scion-ci --workspace_status_command=./tools/bazel-build-env
tar -kxf bazel-bin/scion.tar -C bin
tar -kxf bazel-bin/scion-ci.tar -C bin
# Delete everything in bin/ that isn't bin/dispatcher or a hidden file, as
# those aren't created by bazel.
bazel_bin_clean:
find bin/ -mindepth 1 ! -iname dispatcher -a ! -iname ".*" -exec rm {} +
mocks: goenv
./tools/gomocks
gazelle:
bazel run //:gazelle -- update -mode=$(GAZELLE_MODE) -index=false -external=external -exclude go/vendor -exclude docker/_build ./go
setcap:
tools/setcap cap_net_admin,cap_net_raw+ep $(BRACCEPT)
# Order is important
clibs: libscion libfilter
libscion:
$(MAKE) -C c/lib/scion install
libfilter: libscion
$(MAKE) -C c/lib/filter install
dispatcher: clibs
$(MAKE) -C c/dispatcher install
uninstall:
$(foreach var,$(SRC_DIRS),$(MAKE) -C $(var) uninstall || exit 1;)
tags:
which ctags >/dev/null 2>&1 || exit 0; git ls-files c | ctags -L -