build: pass .d file name to scripts/make_device_config.sh, fix makefile target
PATCH 1/1 build: pass .d file name to scripts/make_device_config.sh, fix makefile target
The .d file name must match exactly what is used in the SUBDIR_DEVICES_MAK_DEP variable. Instead of making assumptions in the make_device_config.sh script, just pass it in.
Similarly, the makefile target may not match the output file name, because Makefile uses a temporary file. Instead of making assumptions on what the Makefile does, emit the config-devices.mak file to stdout, and use the passed-in destination as the makefile target
--- Makefile | 3 ++- scripts/make_device_config.sh | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-)
Makefile +2 -1
@@ -112,7 +112,8 @@ endif -include $(SUBDIR_DEVICES_MAK_DEP) %/config-devices.mak: default-configs/%.mak - $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh [email protected] $<, " GEN [email protected]") + $(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 \ if cmp -s [email protected] $@; then \ mv [email protected] $@; \
scripts/make_device_config.sh +10 -8
@@ -1,10 +1,12 @@ #! /bin/sh -# Construct a target device config file from a default, pulling in any -# files from include directives. +# Writes a target device config file to stdout, from a default and from +# include directives therein. Also emits Makefile dependencies. +# +# Usage: make_device_config.sh SRC DEPFILE-NAME DEPFILE-TARGET > DEST -dest=$1 -dep=`dirname $1`-`basename $1`.d -src=$2 +src=$1 +dep=$2 +target=$3 src_dir=`dirname $src` all_includes=
@@ -22,7 +24,7 @@ while [ -n "$f" ] ; do [ $? = 0 ] || exit 1 all_includes="$all_includes $f" done -process_includes $src > $dest +process_includes $src -cat $src $all_includes | grep -v '^include' > $dest -echo "$1: $all_includes" > $dep +cat $src $all_includes | grep -v '^include' +echo "$target: $all_includes" > $dep
Signature · 1 line
2.3.0
Quoted 22 lines · Paolo Bonzini
The .d file name must match exactly what is used in the
SUBDIR_DEVICES_MAK_DEPvariable. Instead of making assumptions in themake_device_config.shscript, just pass it in.Similarly, the makefile target may not match the output file name, because
Makefileuses a temporary file. Instead of making assumptions on what theMakefiledoes, emit the config-devices.mak file to stdout, and use the passed-in destination as the makefile targetReported-by Peter Maydell <[email protected]>Cc Michael S. Tsirkin <[email protected]>Signed-off-by Paolo Bonzini <[email protected]>--- Makefile | 3 ++- scripts/make_device_config.sh | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-)Makefile +0
-0
Makefile endif · line 118
Quoted 8 lines
Makefile +2
-1@@ -112,7 +112,8 @@ endif -include $(SUBDIR_DEVICES_MAK_DEP) %/config-devices.mak: default-configs/%.mak - $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh [email protected] $<, " GEN [email protected]") + $(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 \ if cmp -s [email protected] $@; then \
Should this compare [email protected] to [email protected]?
Quoted 36 lines
Makefile +0
-0mv [email protected] $@; \scripts/make_device_config.sh +10
-8@@ -1,10 +1,12 @@ #! /bin/sh -# Construct a target device config file from a default, pulling in any -# files from include directives. +# Writes a target device config file to stdout, from a default and from +# include directives therein. Also emits Makefile dependencies. +# +# Usage: make_device_config.sh SRC DEPFILE-NAME DEPFILE-TARGET > DEST -dest=$1 -dep=`dirname $1`-`basename $1`.d -src=$2 +src=$1 +dep=$2 +target=$3 src_dir=`dirname $src` all_includes=@@ -22,7 +24,7 @@ while [ -n "$f" ] ; do [ $? = 0 ] || exit 1 all_includes="$all_includes $f" done -process_includes $src > $dest +process_includes $src -cat $src $all_includes | grep -v '^include' > $dest -echo "$1: $all_includes" > $dep +cat $src $all_includes | grep -v '^include' +echo "$target: $all_includes" > $depSignature · 1 line
2.3.0
Quoted 7 lines · Michael S. Tsirkin
Makefile endif · line 118
Quoted 5 lines
Makefile +2
-1- $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh [email protected] $<, " GEN [email protected]") + $(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 \ if cmp -s [email protected] $@; then \Should this compare [email protected] to [email protected]?
It is trying to detect user-modified */config-devices.mak, so $@ is fine.
Paolo