Skip to contentSkip to conversation

Makefile: add dependencies on scripts

PATCH Superseded Paolo Bonzini 2 participants 10 messages Jun 7, 2016 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Makefile: add dependencies on scripts

There are already many cases of generated files that depend on the scripts that generate them. Complete it whenever it's missing, to avoid wrecking the build upon changes to the scripts.

Paolo

Paolo Bonzini (3):
Makefile: add dependency on scripts/create_config
Makefile: add dependency on scripts/make_device_config.sh
Makefile: add dependency on scripts/hxtool

 Makefile        | 18 +++++++++---------
 Makefile.target |  8 ++++----
 2 files changed, 13 insertions(+), 13 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 Makefile: add dependency on scripts/create_config

Make sure that config-host.h and config-target.h are rebuilt whenever there is a change in the scripts that generates them.

---
 Makefile        | 2 +-
 Makefile.target | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 59af636..9e0e1f8 100644
@@ -168,7 +168,7 @@ endif
 all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
 
 config-host.h: config-host.h-timestamp
-config-host.h-timestamp: config-host.mak
+config-host.h-timestamp: config-host.mak $(SRC_PATH)/scripts/create_config
 qemu-options.def: $(SRC_PATH)/qemu-options.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
 
Makefile.target +1 -1
index 5b80dd7..0bb5e78 100644
@@ -37,7 +37,7 @@ PROGS=$(QEMU_PROG) $(QEMU_PROGW)
 STPFILES=
 
 config-target.h: config-target.h-timestamp
-config-target.h-timestamp: config-target.mak
+config-target.h-timestamp: config-target.mak $(SRC_PATH)/scripts/create_config
 
 ifdef CONFIG_TRACE_SYSTEMTAP
 stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] Makefile: add dependency on scripts/create_config

Quoted 37 lines · Paolo Bonzini

Make sure that config-host.h and config-target.h are rebuilt whenever there is a change in the scripts that generates them.

---
 Makefile        | 2 +-
 Makefile.target | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 59af636..9e0e1f8 100644
@@ -168,7 +168,7 @@ endif
 all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
 
 config-host.h: config-host.h-timestamp
-config-host.h-timestamp: config-host.mak
+config-host.h-timestamp: config-host.mak $(SRC_PATH)/scripts/create_config
 qemu-options.def: $(SRC_PATH)/qemu-options.hx
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
 
Makefile.target +1 -2
index 5b80dd7..0bb5e78 100644
@@ -37,7 +37,7 @@ PROGS=$(QEMU_PROG) $(QEMU_PROGW)
 STPFILES=
 
 config-target.h: config-target.h-timestamp
-config-target.h-timestamp: config-target.mak
+config-target.h-timestamp: config-target.mak $(SRC_PATH)/scripts/create_config
 
 ifdef CONFIG_TRACE_SYSTEMTAP
 stap: $(QEMU_PROG).stp-installed $(QEMU_PROG).stp $(QEMU_PROG)-simpletrace.stp
--
Quoted 1 line

1.8.3.1

Does it work to add the dependency on the RHS of the pattern rule instead, like:

config-%.h-timestamp: config-%.mak $(SRC_PATH)/scripts/create_config

        $(call quiet-command, sh $(SRC_PATH)/scripts/create_config <

$< > $@, " GEN $(TARGET_DIR)config-$*.h")

?

thanks
-- PMM

#3 lore raw

Re: [Qemu-devel] [PATCH 1/3] Makefile: add dependency on scripts/create_config

Quoted 6 lines · Peter Maydell

Does it work to add the dependency on the RHS of the pattern rule instead, like:

config-%.h-timestamp: config-%.mak $(SRC_PATH)/scripts/create_config

        $(call quiet-command, sh $(SRC_PATH)/scripts/create_config <

$< > $@, " GEN $(TARGET_DIR)config-$*.h")

Yes, that works too.

Paolo

#4 lore raw

Re: [Qemu-devel] [PATCH 1/3] Makefile: add dependency on scripts/create_config

Quoted 11 lines · Paolo Bonzini
Quoted 6 lines · Peter Maydell

Does it work to add the dependency on the RHS of the pattern rule instead, like:

config-%.h-timestamp: config-%.mak $(SRC_PATH)/scripts/create_config

        $(call quiet-command, sh $(SRC_PATH)/scripts/create_config <

$< > $@, " GEN $(TARGET_DIR)config-$*.h")

Yes, that works too.

Cool -- I think it's a bit clearer to add the dependency in the same place where the rule text invoking the script is.

thanks
-- PMM

#5 lore raw

Re: [Qemu-devel] [PATCH 1/3] Makefile: add dependency on scripts/create_config

Quoted 7 lines · Peter Maydell
Quoted 6 lines · Paolo Bonzini
Quoted 3 lines · Peter Maydell

Does it work to add the dependency on the RHS of the pattern rule instead, like:

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

config-%.h-timestamp: config-%.mak $(SRC_PATH)/scripts/create_config

        $(call quiet-command, sh $(SRC_PATH)/scripts/create_config <

$< > $@, " GEN $(TARGET_DIR)config-$*.h")

Yes, that works too.

Cool -- I think it's a bit clearer to add the dependency in the same place where the rule text invoking the script is.

I agree, I've sent v2.

Paolo

#6 lore raw

PATCH 2/3 Makefile: add dependency on scripts/make_device_config.sh

In reply to Paolo Bonzini

Make sure that config-devices.mak is rebuilt whenever there is a change in the scripts that generates it.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 9e0e1f8..72e0d74 100644
@@ -117,7 +117,7 @@ endif
 
 -include $(SUBDIR_DEVICES_MAK_DEP)
 
-%/config-devices.mak: default-configs/%.mak
+%/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
 	$(call quiet-command, \
             $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > [email protected], "  GEN   [email protected]")
 	$(call quiet-command, if test -f $@; then \
Signature · 1 line
1.8.3.1
Reviewed-by on v1 2/3
#7 lore raw

Re: [Qemu-devel] [PATCH 2/3] Makefile: add dependency on scripts/make_device_config.sh

Quoted 22 lines · Paolo Bonzini

Make sure that config-devices.mak is rebuilt whenever there is a change in the scripts that generates it.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -2
index 9e0e1f8..72e0d74 100644
@@ -117,7 +117,7 @@ endif
 
 -include $(SUBDIR_DEVICES_MAK_DEP)
 
-%/config-devices.mak: default-configs/%.mak
+%/config-devices.mak: default-configs/%.mak $(SRC_PATH)/scripts/make_device_config.sh
        $(call quiet-command, \
             $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > [email protected], "  GEN   [email protected]")
        $(call quiet-command, if test -f $@; then \
--
Quoted 1 line

1.8.3.1

(In this case you have added it to the pattern rule...)

thanks
-- PMM

#8 lore raw

PATCH 3/3 Makefile: add dependency on scripts/hxtool

In reply to Paolo Bonzini

Make sure that the various documentation and C code files are rebuilt whenever there is a change in the script that splits them out of .hx files.

---
 Makefile        | 14 +++++++-------
 Makefile.target |  6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)
Makefile +7 -7
index 72e0d74..a27336d 100644
@@ -169,7 +169,7 @@ all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
 
 config-host.h: config-host.h-timestamp
 config-host.h-timestamp: config-host.mak $(SRC_PATH)/scripts/create_config
-qemu-options.def: $(SRC_PATH)/qemu-options.hx
+qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
 
 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
@@ -241,7 +241,7 @@ qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o libqemuutil.a libqemustub.a
 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o libqemuutil.a libqemustub.a
 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
 
-qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
+qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
 
 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
@@ -524,19 +524,19 @@ TEXIFLAG=$(if $(V),,--quiet)
 %.pdf: %.texi
 	$(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<,"  GEN   $@")
 
-qemu-options.texi: $(SRC_PATH)/qemu-options.hx
+qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
-qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
+qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
-qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx
+qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
-qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
+qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@,"  GEN   $@")
 
-qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
+qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
Makefile.target +3 -3
index 0bb5e78..a9646d6 100644
@@ -206,13 +206,13 @@ endif
 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
 	$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
 
-hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
+hmp-commands.h: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
-hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx
+hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
-qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
+qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx $(SRC_PATH)/scripts/hxtool
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
 clean:
Signature · 1 line
1.8.3.1
Reviewed-by on v1 3/3
#9 lore raw

Re: [Qemu-devel] [PATCH 3/3] Makefile: add dependency on scripts/hxtool

Quoted 66 lines · Paolo Bonzini

Make sure that the various documentation and C code files are rebuilt whenever there is a change in the script that splits them out of .hx files.

---
 Makefile        | 14 +++++++-------
 Makefile.target |  6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)
Makefile +7 -7
index 72e0d74..a27336d 100644
@@ -169,7 +169,7 @@ all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules
 
 config-host.h: config-host.h-timestamp
 config-host.h-timestamp: config-host.mak $(SRC_PATH)/scripts/create_config
-qemu-options.def: $(SRC_PATH)/qemu-options.hx
+qemu-options.def: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
 
 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
@@ -241,7 +241,7 @@ qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o libqemuutil.a libqemustub.a
 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/9p-marshal.o fsdev/9p-iov-marshal.o libqemuutil.a libqemustub.a
 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
 
-qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
+qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
 
 qemu-ga$(EXESUF): LIBS = $(LIBS_QGA)
@@ -524,19 +524,19 @@ TEXIFLAG=$(if $(V),,--quiet)
 %.pdf: %.texi
        $(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<,"  GEN   $@")
 
-qemu-options.texi: $(SRC_PATH)/qemu-options.hx
+qemu-options.texi: $(SRC_PATH)/qemu-options.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
-qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
+qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
-qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx
+qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
-qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
+qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@,"  GEN   $@")
 
-qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
+qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
 qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
Makefile.target +0 -1
index 0bb5e78..a9646d6 100644
@@ -206,13 +206,13 @@ endif
 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
        $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
 
-hmp-commands.h: $(SRC_PATH)/hmp-commands.hx

Makefile.target endif · line 216

Quoted 10 lines
Makefile.target +3 -2
+hmp-commands.h: $(SRC_PATH)/hmp-commands.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
-hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx
+hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
-qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
+qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")

(looks like there's scope for cleaning this up with some pattern rules later if we want to.)

thanks
-- PMM