From: sven.vermeulen@siphos.be (Sven Vermeulen) Date: Sun, 25 Mar 2018 13:56:37 +0200 Subject: [refpolicy] [PATCH v3 3/7] Generate template code and update genxml call for documentation generation In-Reply-To: <20180325115641.5557-1-sven.vermeulen@siphos.be> References: <20180325115641.5557-1-sven.vermeulen@siphos.be> Message-ID: <20180325115641.5557-4-sven.vermeulen@siphos.be> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com Update the Makefile to first build the template files (template code definitions) and then have all segenxml calls use these files. Signed-off-by: Sven Vermeulen --- Makefile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b4b2d43a..6252b12d 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,7 @@ m4terminate := $(support)/fatal_error.m4 # use our own genhomedircon to make sure we have a known usable one, # so policycoreutils updates are not required (RHEL4) genhomedircon := $(PYTHON) $(support)/genhomedircon.py +gentemplates := $(support)/gentemplates.sh # documentation paths docs := doc @@ -414,12 +415,20 @@ $(fcsort) : $(support)/fc_sort.c # # Documentation generation # -$(layerxml): %.xml: $(all_metaxml) $(filter $(addprefix $(moddir)/, $(notdir $*))%, $(detected_mods)) $(subst .te,.if, $(filter $(addprefix $(moddir)/, $(notdir $*))%, $(detected_mods))) +iftemplates: + @echo "generating interface templates into $(tmpdir)/iftemplates" + @test -d $(tmpdir)/iftemplates || mkdir -p $(tmpdir)/iftemplates + $(gentemplates) -g -s $(moddir) -t $(tmpdir)/iftemplates +ifdef LOCAL_ROOT + $(gentemplates) -g -s $(local_moddir) -t $(tmpdir)/iftemplates +endif + +$(layerxml): %.xml: iftemplates $(all_metaxml) $(filter $(addprefix $(moddir)/, $(notdir $*))%, $(detected_mods)) $(subst .te,.if, $(filter $(addprefix $(moddir)/, $(notdir $*))%, $(detected_mods))) @test -d $(tmpdir) || mkdir -p $(tmpdir) $(verbose) cat $(filter %$(notdir $*)/$(metaxml), $(all_metaxml)) > $@ - $(verbose) for i in $(basename $(filter $(addprefix $(moddir)/, $(notdir $*))%, $(detected_mods))); do $(genxml) -w -m $$i >> $@; done + $(verbose) for i in $(basename $(filter $(addprefix $(moddir)/, $(notdir $*))%, $(detected_mods))); do $(genxml) -w -T $(tmpdir)/iftemplates -m $$i >> $@; done ifdef LOCAL_ROOT - $(verbose) for i in $(basename $(filter $(addprefix $(local_moddir)/, $(notdir $*))%, $(detected_mods))); do $(genxml) -w -m $$i >> $@; done + $(verbose) for i in $(basename $(filter $(addprefix $(local_moddir)/, $(notdir $*))%, $(detected_mods))); do $(genxml) -w -T $(tmpdir)/iftemplates -m $$i >> $@; done endif $(tunxml): $(globaltun) -- 2.16.1