diff mbox series

[XEN,v7,13/51] build: convert binfile use to if_changed

Message ID 20210824105038.1257926-14-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series xen: Build system improvements, now with out-of-tree build! | expand

Commit Message

Anthony PERARD Aug. 24, 2021, 10:50 a.m. UTC
This will allow to detect command line changes and allow to regenerate
the file in that case.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Notes:
    v7:
    - define $(cmd_binfile) in Rules.mk so we can use the same one in both
      common/ and xsm/flask/

 xen/Rules.mk           | 5 +++++
 xen/common/Makefile    | 5 +++--
 xen/xsm/flask/Makefile | 6 ++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

Comments

Jan Beulich Oct. 7, 2021, 1:55 p.m. UTC | #1
On 24.08.2021 12:50, Anthony PERARD wrote:
> This will allow to detect command line changes and allow to regenerate
> the file in that case.
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

diff --git a/xen/Rules.mk b/xen/Rules.mk
index c313486ce0f6..f449669475bd 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -57,6 +57,11 @@  cmd_ar = rm -f $@; $(AR) cr $@ $(real-prereqs)
 quiet_cmd_objcopy = OBJCOPY $@
 cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
 
+# binfile
+# use e.g. $(call if_changed,binfile,binary-file varname)
+quiet_cmd_binfile = BINFILE $@
+cmd_binfile = $(SHELL) $(BASEDIR)/tools/binfile $(BINFILE_FLAGS) $@ $(2)
+
 define gendep
     ifneq ($(1),$(subst /,:,$(1)))
         DEPS += $(dir $(1)).$(notdir $(1)).d
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 54de70d42278..141d7d40d3dc 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -80,8 +80,9 @@  config.gz: $(CONF_FILE)
 
 config_data.o: config.gz
 
-config_data.S: $(BASEDIR)/tools/binfile
-	$(SHELL) $(BASEDIR)/tools/binfile $@ config.gz xen_config_data
+config_data.S: $(BASEDIR)/tools/binfile FORCE
+	$(call if_changed,binfile,config.gz xen_config_data)
+targets += config_data.S
 
 clean::
 	rm -f config_data.S config.gz 2>/dev/null
diff --git a/xen/xsm/flask/Makefile b/xen/xsm/flask/Makefile
index 637159ad8276..f4d4038c01bd 100644
--- a/xen/xsm/flask/Makefile
+++ b/xen/xsm/flask/Makefile
@@ -35,8 +35,10 @@  $(subst include/,%/,$(AV_H_FILES)): $(AV_H_DEPEND) $(mkaccess) FORCE
 obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
 flask-policy.o: policy.bin
 
-flask-policy.S: $(BASEDIR)/tools/binfile
-	$(SHELL) $(BASEDIR)/tools/binfile -i $@ policy.bin xsm_flask_init_policy
+flask-policy.S: BINFILE_FLAGS := -i
+flask-policy.S: $(BASEDIR)/tools/binfile FORCE
+	$(call if_changed,binfile,policy.bin xsm_flask_init_policy)
+targets += flask-policy.S
 
 FLASK_BUILD_DIR := $(CURDIR)
 POLICY_SRC := $(FLASK_BUILD_DIR)/xenpolicy-$(XEN_FULLVERSION)