-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (30 loc) · 913 Bytes
/
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
OUTDIR=build
# Default target
default: build16
.PHONY: default
# Recursive call targets
ifneq ($(MAKELEVEL), 0)
# Build aliases
build16: $(OUTDIR)/hhh.json
.PHONY: build16
# Compilation of P4 v16 source code
$(OUTDIR)/hhh.json: src/hhh.p4 $(wildcard src/includes/*.p4)
${P4C} -o $@ --p4v 16 $<
# Run aliases
run: run16
.PHONY: run
# Run P4 v16 description of switch
run16: $(OUTDIR)/hhh.json
sudo $(SSMN) --mode l2 --num-hosts 1 --behavioral-exe ${SWITCH_PATH} --json $< --cli ${CLI_PATH} --switch-config $(<:.json=.config)
# Clean-up
clean:
rm -f ${OUTDIR}/*.json
# Pack
pack:
rm -f p4code.zip
zip -r --symlinks p4code.zip Makefile env.sh README.md src/* build/hhh.config doc/example.png tools/*.sh tools/*.py tools/mininet/* tools/controller/*
# Top-level make target
else
%:
@bash -c "source ./env.sh; for var in \$$(compgen -v); do export \$$var; done; $(MAKE) --no-print-directory $@"
endif