summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile41
1 files changed, 14 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index beaac80a7..92db9886f 100644
--- a/Makefile
+++ b/Makefile
@@ -8,8 +8,10 @@ CC := gcc
LIBS := -lzmq
CFLAGS :=
-src = $(wildcard interface-definitions/*.xml.in)
-obj = $(src:.xml.in=.xml)
+config_xml_src = $(wildcard interface-definitions/*.xml.in)
+config_xml_obj = $(config_xml_src:.xml.in=.xml)
+op_xml_src = $(wildcard op-mode-definitions/*.xml.in)
+op_xml_obj = $(op_xml_src:.xml.in=.xml)
%.xml: %.xml.in
@echo Generating $(BUILD_DIR)/$@ from $<
@@ -23,51 +25,36 @@ obj = $(src:.xml.in=.xml)
# -nostdinc Do not search the standard system directories for header files
# -P Inhibit generation of linemarkers in the output from the
# preprocessor
- @$(CC) -x c-header -E -undef -nostdinc -P -I$(CURDIR)/interface-definitions -o $(BUILD_DIR)/$@ -c $<
-
-$(BUILD_DIR):
- install -d -m 0755 $(BUILD_DIR)/interface-definitions
- install -d -m 0755 $(BUILD_DIR)/op-mode-definitions
+ mkdir -p $(BUILD_DIR)/$(dir $@)
+ @$(CC) -x c-header -E -undef -nostdinc -P -I$(CURDIR)/$(dir $<) -o $(BUILD_DIR)/$@ -c $<
.PHONY: interface_definitions
.ONESHELL:
-interface_definitions: $(BUILD_DIR) $(obj)
+interface_definitions: $(config_xml_obj)
mkdir -p $(TMPL_DIR)
+ $(CURDIR)/scripts/override-default $(BUILD_DIR)/interface-definitions
+
find $(BUILD_DIR)/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)/protocols/node.def
- rm -rf $(TMPL_DIR)/protocols/nbgp
- rm -f $(TMPL_DIR)/protocols/static/node.def
rm -f $(TMPL_DIR)/policy/node.def
rm -f $(TMPL_DIR)/system/node.def
rm -f $(TMPL_DIR)/vpn/node.def
rm -f $(TMPL_DIR)/vpn/ipsec/node.def
rm -rf $(TMPL_DIR)/vpn/nipsec
-
- # XXX: required until OSPF and RIP is migrated from vyatta-cfg-quagga to vyos-1x
- mkdir $(TMPL_DIR)/interfaces/loopback/node.tag/ipv6
- mkdir $(TMPL_DIR)/interfaces/dummy/node.tag/ipv6
- mkdir $(TMPL_DIR)/interfaces/openvpn/node.tag/ip
- mkdir -p $(TMPL_DIR)/interfaces/vti/node.tag/ip
- mkdir -p $(TMPL_DIR)/interfaces/vti/node.tag/ipv6
- cp $(TMPL_DIR)/interfaces/ethernet/node.tag/ipv6/node.def $(TMPL_DIR)/interfaces/loopback/node.tag/ipv6
- cp $(TMPL_DIR)/interfaces/ethernet/node.tag/ipv6/node.def $(TMPL_DIR)/interfaces/dummy/node.tag/ipv6
- cp $(TMPL_DIR)/interfaces/ethernet/node.tag/ip/node.def $(TMPL_DIR)/interfaces/openvpn/node.tag/ip
- cp $(TMPL_DIR)/interfaces/ethernet/node.tag/ip/node.def $(TMPL_DIR)/interfaces/vti/node.tag/ip
- cp $(TMPL_DIR)/interfaces/ethernet/node.tag/ipv6/node.def $(TMPL_DIR)/interfaces/vti/node.tag/ipv6
+ rm -rf $(TMPL_DIR)/npolicy
find $(TMPL_DIR) -name node.def -empty && sh -c 'echo "There are empty node.def files! Check your interface definitions." && exit 1'
.PHONY: op_mode_definitions
.ONESHELL:
-op_mode_definitions:
+op_mode_definitions: $(op_xml_obj)
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
+ find $(BUILD_DIR)/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)/add/node.def
@@ -91,7 +78,7 @@ op_mode_definitions:
.PHONY: component_versions
.ONESHELL:
-component_versions: $(BUILD_DIR) $(obj)
+component_versions: interface_definitions
$(CURDIR)/scripts/build-component-versions $(BUILD_DIR)/interface-definitions $(DATA_DIR)
.PHONY: vyshim
@@ -103,7 +90,7 @@ vyxdp:
$(MAKE) -C $(XDP_DIR)
.PHONY: all
-all: clean interface_definitions op_mode_definitions component_versions vyshim vyxdp
+all: clean interface_definitions op_mode_definitions component_versions vyshim
.PHONY: clean
clean: