summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-09 14:31:48 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-10 10:26:59 +0100
commite982b78f24d1dca3d2bc92a39b8e9fcf35b39a37 (patch)
tree8bddb17c245e191be4d45a1f67c31ba2cdd0afc0 /Makefile
parentaf2e707d0fc447b84699eb10928a71507e90a02e (diff)
downloadvyos-1x-e982b78f24d1dca3d2bc92a39b8e9fcf35b39a37.tar.gz
vyos-1x-e982b78f24d1dca3d2bc92a39b8e9fcf35b39a37.zip
xml: op-mode: add preprocessor support as known from configuration mode
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile21
1 files changed, 10 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 588595e42..3f13c66a0 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,15 +25,12 @@ 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)
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
@@ -62,10 +61,10 @@ interface_definitions: $(BUILD_DIR) $(obj)
.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
@@ -87,7 +86,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