* [Qemu-devel] [PATCH] build: pass .d file name to scripts/make_device_config.sh, fix makefile target
@ 2015-03-12 15:16 Paolo Bonzini
2015-03-12 15:24 ` Michael S. Tsirkin
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2015-03-12 15:16 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell, Michael S. Tsirkin
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
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
Makefile | 3 ++-
scripts/make_device_config.sh | 18 ++++++++++--------
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 884b59d..88bce56 100644
--- a/Makefile
+++ b/Makefile
@@ -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 $@.tmp $<, " GEN $@.tmp")
+ $(call quiet-command, \
+ $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp, " GEN $@.tmp")
$(call quiet-command, if test -f $@; then \
if cmp -s $@.old $@; then \
mv $@.tmp $@; \
diff --git a/scripts/make_device_config.sh b/scripts/make_device_config.sh
index 7958086..c1afb3f 100644
--- a/scripts/make_device_config.sh
+++ b/scripts/make_device_config.sh
@@ -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
--
2.3.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] build: pass .d file name to scripts/make_device_config.sh, fix makefile target
2015-03-12 15:16 [Qemu-devel] [PATCH] build: pass .d file name to scripts/make_device_config.sh, fix makefile target Paolo Bonzini
@ 2015-03-12 15:24 ` Michael S. Tsirkin
2015-03-12 15:40 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Michael S. Tsirkin @ 2015-03-12 15:24 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: peter.maydell, qemu-devel
On Thu, Mar 12, 2015 at 04:16:28PM +0100, Paolo Bonzini wrote:
> 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
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> Makefile | 3 ++-
> scripts/make_device_config.sh | 18 ++++++++++--------
> 2 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 884b59d..88bce56 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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 $@.tmp $<, " GEN $@.tmp")
> + $(call quiet-command, \
> + $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp, " GEN $@.tmp")
> $(call quiet-command, if test -f $@; then \
> if cmp -s $@.old $@; then \
Should this compare $@.old to $@.tmp?
> mv $@.tmp $@; \
> diff --git a/scripts/make_device_config.sh b/scripts/make_device_config.sh
> index 7958086..c1afb3f 100644
> --- a/scripts/make_device_config.sh
> +++ b/scripts/make_device_config.sh
> @@ -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
> --
> 2.3.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] build: pass .d file name to scripts/make_device_config.sh, fix makefile target
2015-03-12 15:24 ` Michael S. Tsirkin
@ 2015-03-12 15:40 ` Paolo Bonzini
0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-03-12 15:40 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: peter.maydell, qemu-devel
On 12/03/2015 16:24, Michael S. Tsirkin wrote:
> > - $(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@.tmp $<, " GEN $@.tmp")
> > + $(call quiet-command, \
> > + $(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $< $*-config-devices.mak.d $@ > $@.tmp, " GEN $@.tmp")
> > $(call quiet-command, if test -f $@; then \
> > if cmp -s $@.old $@; then \
> Should this compare $@.old to $@.tmp?
>
It is trying to detect user-modified */config-devices.mak, so $@ is fine.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-03-12 15:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-12 15:16 [Qemu-devel] [PATCH] build: pass .d file name to scripts/make_device_config.sh, fix makefile target Paolo Bonzini
2015-03-12 15:24 ` Michael S. Tsirkin
2015-03-12 15:40 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).