build: convert binfile use to if_changed
authorAnthony PERARD <anthony.perard@citrix.com>
Thu, 7 Oct 2021 15:55:27 +0000 (17:55 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 7 Oct 2021 15:55:27 +0000 (17:55 +0200)
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>
xen/Rules.mk
xen/common/Makefile
xen/xsm/flask/Makefile

index b7827a56a5e067cae1da99c68e28c31fcf4af5c2..8b8f9d347fb858884a0339911fb48f41f172f7b5 100644 (file)
@@ -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
index 54de70d42278e159236fcde67b53a634f5610d23..141d7d40d3dcadea259477912ef4601c0859fc4e 100644 (file)
@@ -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
index af95697ed9d23f198538f75a4a11453b4a6d0518..11c530dcf458895581c5c18a135289aa4071180b 100644 (file)
@@ -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)