summaryrefslogtreecommitdiff
path: root/Makefile
blob: ad05acff5eeb60df8882ff1076e46149eeeadf7e (plain)
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
TMPL_DIR := templates-cfg
OP_TMPL_DIR := templates-op

.PHONY: interface_definitions
.ONESHELL:
interface_definitions:
	mkdir -p $(TMPL_DIR)

	find $(CURDIR)/interface-definitions/ -type f -name "*.xml" | xargs -I {} $(CURDIR)/scripts/build-command-templates {} $(CURDIR)/schema/interface_definition.rng $(TMPL_DIR) || exit 1

	# XXX: delete top level node.def's that now live in other packages
	rm -f $(TMPL_DIR)/firewall/node.def
	rm -f $(TMPL_DIR)/interfaces/node.def
	rm -f $(TMPL_DIR)/interfaces/bridge/node.tag/ip/node.def
	rm -f $(TMPL_DIR)/interfaces/bonding/node.tag/ip/node.def
	rm -f $(TMPL_DIR)/interfaces/vxlan/node.tag/ip/node.def
	rm -f $(TMPL_DIR)/protocols/node.def
	rm -f $(TMPL_DIR)/protocols/static/node.def
	rm -f $(TMPL_DIR)/system/node.def
	rm -f $(TMPL_DIR)/system/options/node.def
	rm -f $(TMPL_DIR)/vpn/node.def
	rm -f $(TMPL_DIR)/vpn/ipsec/node.def

.PHONY: op_mode_definitions
.ONESHELL:
op_mode_definitions:
	mkdir -p $(OP_TMPL_DIR)

	find $(CURDIR)/op-mode-definitions/ -type f -name "*.xml" | xargs -I {} $(CURDIR)/scripts/build-command-op-templates {} $(CURDIR)/schema/op-mode-definition.rng $(OP_TMPL_DIR) || exit 1

	# XXX: delete top level op mode node.def's that now live in other packages
	rm -f $(OP_TMPL_DIR)/clear/node.def
	rm -f $(OP_TMPL_DIR)/set/node.def
	rm -f $(OP_TMPL_DIR)/show/node.def
	rm -f $(OP_TMPL_DIR)/show/interfaces/node.def
	rm -f $(OP_TMPL_DIR)/show/ip/node.def
	rm -f $(OP_TMPL_DIR)/show/ip/route/node.def
	rm -f $(OP_TMPL_DIR)/show/ipv6/node.def
	rm -f $(OP_TMPL_DIR)/show/ipv6/route/node.def
	rm -f $(OP_TMPL_DIR)/restart/node.def
	rm -f $(OP_TMPL_DIR)/monitor/node.def
	rm -f $(OP_TMPL_DIR)/generate/node.def
	rm -f $(OP_TMPL_DIR)/show/vpn/node.def
	rm -f $(OP_TMPL_DIR)/show/system/node.def
	rm -f $(OP_TMPL_DIR)/delete/node.def

.PHONY: all
all: clean interface_definitions op_mode_definitions

.PHONY: clean
clean:
	rm -rf $(TMPL_DIR)/*
	rm -rf $(OP_TMPL_DIR)/*

.PHONY: test
test:
	PYTHONPATH=python/ python3 -m "nose" --with-xunit src --with-coverage --cover-erase --cover-xml --cover-package src/conf_mode,src/op_mode,src/completion,src/helpers,src/validators,src/tests --verbose

.PHONY: sonar
sonar:
	sonar-scanner -X -Dsonar.login=${SONAR_TOKEN}

.PHONY: docs
.ONESHELL:
docs:
	sphinx-apidoc -o sphinx/source/  python/
	cd sphinx/
	PYTHONPATH=../python make html