Skip to contentSkip to conversation

Makefile: don't silence mak file test with V=1

PATCH Applied Michael S. Tsirkin 5 participants 11 messages Feb 19, 2015 – Mar 11, 2015 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Makefile: don't silence mak file test with V=1

V=1 should show what's going on, it's not nice
to silence things unconditionally.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 6817c6f..84ca8be 100644
@@ -110,7 +110,7 @@ endif
 
 %/config-devices.mak: default-configs/%.mak
 	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
-	@if test -f $@; then \
+	$(call quiet-command, if test -f $@; then \
 	  if cmp -s [email protected] $@; then \
 	    mv [email protected] $@; \
 	    cp -p $@ [email protected]; \
@@ -126,7 +126,7 @@ endif
 	 else \
 	  mv [email protected] $@; \
 	  cp -p $@ [email protected]; \
-	 fi
+	 fi, "  TEST $@");
 
 defconfig:
 	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
Signature · 1 line
MST
#1 lore raw

PATCH 2/2 Makefile.target: binary depends on config-devices

relink binary whenever config-devices.mak changes:
this makes sense as we are adding/removing devices, so binary has to be relinked to be up to date.

---
 Makefile.target | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile.target +3 -1
index 58c6ae1..2262d89 100644
@@ -175,9 +175,11 @@ all-obj-y += $(common-obj-y)
 all-obj-y += $(target-obj-y)
 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
 
+$(QEMU_PROG_BUILD): config-devices.mak
+
 # build either PROG or PROGW
 $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
-	$(call LINK,$^)
+	$(call LINK, $(filter-out %.mak, $^))
 
 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)$@")
Signature · 1 line
MST
Reviewed-by on v1 2/2
#2 lore raw

Re: [Qemu-devel] [PATCH 2/2] Makefile.target: binary depends on config-devices

Quoted 29 lines · Michael S. Tsirkin

relink binary whenever config-devices.mak changes:
this makes sense as we are adding/removing devices, so binary has to be relinked to be up to date.

---
 Makefile.target | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile.target +3 -1
index 58c6ae1..2262d89 100644
@@ -175,9 +175,11 @@ all-obj-y += $(common-obj-y)
 all-obj-y += $(target-obj-y)
 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
 
+$(QEMU_PROG_BUILD): config-devices.mak
+
 # build either PROG or PROGW
 $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
-	$(call LINK,$^)
+	$(call LINK, $(filter-out %.mak, $^))
 
 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)$@")
Signature · 1 line
MST
#3 lore raw

Re: [Qemu-devel] [PATCH 2/2] Makefile.target: binary depends on config-devices

In reply to Michael S. Tsirkin
Quoted 17 lines · Michael S. Tsirkin

relink binary whenever config-devices.mak changes:
this makes sense as we are adding/removing devices, so binary has to be relinked to be up to date.

---
 Makefile.target | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile.target +0 -0
index 58c6ae1..2262d89 100644
@@ -175,9 +175,11 @@ all-obj-y += $(common-obj-y)
 all-obj-y += $(target-obj-y)
 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)

Makefile.target all-obj-y += $(common-obj-y) · line 185

Quoted 10 lines
Makefile.target +3 -1
 
+$(QEMU_PROG_BUILD): config-devices.mak
+
 # build either PROG or PROGW
 $(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
-	$(call LINK,$^)
+	$(call LINK, $(filter-out %.mak, $^))
 
 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)$@")

Not exactly beautiful, but I don't have any better idea.

Applied, thanks.

Paolo

Reviewed-by on v1 1/2
#4 lore raw
In reply to Michael S. Tsirkin
Quoted 22 lines · Michael S. Tsirkin

V=1 should show what's going on, it's not nice
to silence things unconditionally.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 6817c6f..84ca8be 100644
@@ -110,7 +110,7 @@ endif
 
 %/config-devices.mak: default-configs/%.mak
 	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
-	@if test -f $@; then \
+	$(call quiet-command, if test -f $@; then \
 	  if cmp -s [email protected] $@; then \
 	    mv [email protected] $@; \
 	    cp -p $@ [email protected]; \

Makefile endif · line 129

Quoted 5 lines
Makefile +1 -1
@@ -126,7 +126,7 @@ endif
 	 else \
 	  mv [email protected] $@; \
 	  cp -p $@ [email protected]; \
-	 fi
+	 fi, "  TEST $@");

Probably " GEN $@" is better, otherwise:

Quoted 6 lines
Makefile +0 -1
 defconfig:
 	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
-- 

MST

#5 lore raw
In reply to Michael S. Tsirkin
Quoted 23 lines · Michael S. Tsirkin

V=1 should show what's going on, it's not nice
to silence things unconditionally.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 6817c6f..84ca8be 100644
@@ -110,7 +110,7 @@ endif
 
 %/config-devices.mak: default-configs/%.mak
 	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
-	@if test -f $@; then \
+	$(call quiet-command, if test -f $@; then \
 	  if cmp -s [email protected] $@; then \
 	    mv [email protected] $@; \
 	    cp -p $@ [email protected]; \

Makefile endif · line 132

Quoted 8 lines
Makefile +1 -1
@@ -126,7 +126,7 @@ endif
 	 else \
 	  mv [email protected] $@; \
 	  cp -p $@ [email protected]; \
-	 fi
+	 fi, "  TEST $@");
 
 defconfig:
 	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)

Squashing this to make the non-verbose messages clearer, ok?

Makefile +2 -2
index 5604209..d92d4cd 100644
@@ -109,7 +109,7 @@ endif
 -include $(SUBDIR_DEVICES_MAK_DEP)
 
 %/config-devices.mak: default-configs/%.mak
-	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
+	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh [email protected] $<, "  GEN   [email protected]")
 	$(call quiet-command, if test -f $@; then \
 	  if cmp -s [email protected] $@; then \
 	    mv [email protected] $@; \
@@ -126,7 +126,7 @@ endif
 	 else \
 	  mv [email protected] $@; \
 	  cp -p $@ [email protected]; \
-	 fi, "  TEST $@");
+	 fi, "  GEN  $@");
 
 defconfig:
 	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
scripts/make_device_config.sh +1 -1
index 7242707..7958086 100644
@@ -2,7 +2,7 @@
 # Construct a target device config file from a default, pulling in any
 # files from include directives.
 
-dest=$1.tmp
+dest=$1
 dep=`dirname $1`-`basename $1`.d
 src=$2
 src_dir=`dirname $src`
#6 lore raw
Quoted 64 lines · Paolo Bonzini
Quoted 23 lines · Michael S. Tsirkin

V=1 should show what's going on, it's not nice
to silence things unconditionally.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 6817c6f..84ca8be 100644
@@ -110,7 +110,7 @@ endif
 
 %/config-devices.mak: default-configs/%.mak
 	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
-	@if test -f $@; then \
+	$(call quiet-command, if test -f $@; then \
 	  if cmp -s [email protected] $@; then \
 	    mv [email protected] $@; \
 	    cp -p $@ [email protected]; \

Makefile endif · line 132

Quoted 8 lines
Makefile +1 -1
@@ -126,7 +126,7 @@ endif
 	 else \
 	  mv [email protected] $@; \
 	  cp -p $@ [email protected]; \
-	 fi
+	 fi, "  TEST $@");
 
 defconfig:
 	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)

Squashing this to make the non-verbose messages clearer, ok?

Makefile +2 -2
index 5604209..d92d4cd 100644
@@ -109,7 +109,7 @@ endif
 -include $(SUBDIR_DEVICES_MAK_DEP)
 
 %/config-devices.mak: default-configs/%.mak
-	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
+	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh [email protected] $<, "  GEN   [email protected]")
 	$(call quiet-command, if test -f $@; then \
 	  if cmp -s [email protected] $@; then \
 	    mv [email protected] $@; \
@@ -126,7 +126,7 @@ endif
 	 else \
 	  mv [email protected] $@; \
 	  cp -p $@ [email protected]; \
-	 fi, "  TEST $@");
+	 fi, "  GEN  $@");
 
 defconfig:
 	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
scripts/make_device_config.sh +0 -0
index 7242707..7958086 100644

scripts/make_device_config.sh line 8

Quoted 8 lines
scripts/make_device_config.sh +1 -1
@@ -2,7 +2,7 @@
 # Construct a target device config file from a default, pulling in any
 # files from include directives.
 
-dest=$1.tmp
+dest=$1
 dep=`dirname $1`-`basename $1`.d
 src=$2
 src_dir=`dirname $src`

Looks good to me.

Fam

#7 lore raw
Quoted 8 lines · Fam Zheng
Quoted 7 lines · Paolo Bonzini
Quoted 2 lines · Michael S. Tsirkin

V=1 should show what's going on, it's not nice
to silence things unconditionally.

Squashing this to make the non-verbose messages clearer, ok?

Also, s/mak/make/ in the subject

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#8 lore raw
Quoted 11 lines · Eric Blake
Quoted 8 lines · Fam Zheng
Quoted 7 lines · Paolo Bonzini
Quoted 2 lines · Michael S. Tsirkin

V=1 should show what's going on, it's not nice to silence things unconditionally.

Squashing this to make the non-verbose messages clearer, ok?

Also, s/mak/make/ in the subject

It would be more like s/mak/.mak/ :) But I've already sent a pull request.

Paolo

author Acked-by
#9 lore raw
In reply to Paolo Bonzini
Quoted 31 lines · Paolo Bonzini
Quoted 28 lines · Michael S. Tsirkin

V=1 should show what's going on, it's not nice
to silence things unconditionally.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 6817c6f..84ca8be 100644
@@ -110,7 +110,7 @@ endif
 
 %/config-devices.mak: default-configs/%.mak
 	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
-	@if test -f $@; then \
+	$(call quiet-command, if test -f $@; then \
 	  if cmp -s [email protected] $@; then \
 	    mv [email protected] $@; \
 	    cp -p $@ [email protected]; \
@@ -126,7 +126,7 @@ endif
 	 else \
 	  mv [email protected] $@; \
 	  cp -p $@ [email protected]; \
-	 fi
+	 fi, "  TEST $@");
 
Quoted 5 lines

Makefile endif · line 132

Quoted 3 lines
Makefile +0 -0
 defconfig:
 	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)

Squashing this to make the non-verbose messages clearer, ok?

Quoted 35 lines
Makefile +2 -2
index 5604209..d92d4cd 100644
@@ -109,7 +109,7 @@ endif
 -include $(SUBDIR_DEVICES_MAK_DEP)
 
 %/config-devices.mak: default-configs/%.mak
-	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
+	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh [email protected] $<, "  GEN   [email protected]")
 	$(call quiet-command, if test -f $@; then \
 	  if cmp -s [email protected] $@; then \
 	    mv [email protected] $@; \
@@ -126,7 +126,7 @@ endif
 	 else \
 	  mv [email protected] $@; \
 	  cp -p $@ [email protected]; \
-	 fi, "  TEST $@");
+	 fi, "  GEN  $@");
 
 defconfig:
 	rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
scripts/make_device_config.sh +1 -1
index 7242707..7958086 100644
@@ -2,7 +2,7 @@
 # Construct a target device config file from a default, pulling in any
 # files from include directives.
 
-dest=$1.tmp
+dest=$1
 dep=`dirname $1`-`basename $1`.d
 src=$2
 src_dir=`dirname $src`
#10 lore raw
In reply to Paolo Bonzini
Quoted 29 lines · Paolo Bonzini

Squashing this to make the non-verbose messages clearer, ok?

Makefile +2 -2
index 5604209..d92d4cd 100644
@@ -109,7 +109,7 @@ endif
 -include $(SUBDIR_DEVICES_MAK_DEP)
 
 %/config-devices.mak: default-configs/%.mak
-       $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
+       $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh [email protected] $<, "  GEN   [email protected]")
        $(call quiet-command, if test -f $@; then \
          if cmp -s [email protected] $@; then \
            mv [email protected] $@; \
@@ -126,7 +126,7 @@ endif
         else \
          mv [email protected] $@; \
          cp -p $@ [email protected]; \
-        fi, "  TEST $@");
+        fi, "  GEN  $@");
 
 defconfig:
        rm -f config-all-devices.mak $(SUBDIR_DEVICES_MAK)
scripts/make_device_config.sh +0 -0
index 7242707..7958086 100644

scripts/make_device_config.sh line 8

Quoted 8 lines
scripts/make_device_config.sh +1 -1
@@ -2,7 +2,7 @@
 # Construct a target device config file from a default, pulling in any
 # files from include directives.
 
-dest=$1.tmp
+dest=$1
 dep=`dirname $1`-`basename $1`.d
 src=$2
 src_dir=`dirname $src`

This squashed-in change breaks automatically rebuilding the config-devices.mak file when a default-configs file indirectly included from the architecture's top level config is changed. (This is most common for AArch64 because of the way it includes the arm-softmmu config file; so any change to the arm-softmmu device configs means the aarch64-softmmu qemu isn't rebuilt as it should be.)

The problem is that we're now passing the script [email protected] as its first argument, and so the 'dep' filename it constructs
ends up as aarch64-softmmu-config-devices.mak.tmp.d. But the Makefile include line defining the dep file to pull in is:
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS)) so we never include the .d file at all.

The basic "%/config-devices.mak: default-configs/%.mak" rule means that this is only a problem for the indirectly included config files.

-- PMM