qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 02/31] Move generation of config-host.h to Makefile from configure
Date: Wed,  7 Oct 2009 02:40:58 +0200	[thread overview]
Message-ID: <479bbb59a908a1b60cb921e5f9718b7cd54d58d0.1254875337.git.quintela@redhat.com> (raw)
In-Reply-To: <cover.1254875337.git.quintela@redhat.com>
In-Reply-To: <cover.1254875337.git.quintela@redhat.com>

Use timestamp based appreach to avoid not needed recompilation.
Add it to rules.mak

Many thanks to Paolo Bonzini for helpding the design, and the debug.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 Makefile      |   13 +++++++++----
 configure     |   20 +-------------------
 create_config |    2 ++
 rules.mak     |    9 +++++++++
 4 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile
index c552739..144b392 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,10 @@ else
 DOCS=
 endif

-build-all: $(TOOLS) $(DOCS) recurse-all
+SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
+
+build-all: config-host.h
+	$(call quiet-command, $(MAKE) $(SUBDIR_MAKEFLAGS) $(TOOLS) $(DOCS) recurse-all,)

 config-host.mak: configure
 ifneq ($(wildcard config-host.mak),)
@@ -37,10 +40,12 @@ ifneq ($(wildcard config-host.mak),)
 	@sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
 endif

-SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory)
+config-host.h: config-host.h-timestamp
+config-host.h-timestamp: config-host.mak
+
 SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))

-subdir-%:
+subdir-%: config-host.h
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)

 $(filter %-softmmu,$(SUBDIR_RULES)): libqemu_common.a
@@ -200,7 +205,7 @@ clean:
         done

 distclean: clean
-	rm -f config-host.mak config-host.h config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi
+	rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi
 	rm -f qemu-{doc,tech}.{info,aux,cp,dvi,fn,info,ky,log,pg,toc,tp,vr}
 	for d in $(TARGET_DIRS) libhw32 libhw64 libuser; do \
 	rm -rf $$d || exit 1 ; \
diff --git a/configure b/configure
index ed5d7d6..fd3cb24 100755
--- a/configure
+++ b/configure
@@ -1800,13 +1800,8 @@ echo "-> Your SDL version is too old - please upgrade to have SDL support"
 fi

 config_host_mak="config-host.mak"
-config_host_h="config-host.h"
 config_host_ld="config-host.ld"

-#echo "Creating $config_host_mak and $config_host_h"
-
-test -f $config_host_h && mv $config_host_h ${config_host_h}~
-
 echo "# Automatically generated by configure - do not modify" > $config_host_mak
 printf "# Configured with:" >> $config_host_mak
 printf " '%s'" "$0" "$@" >> $config_host_mak
@@ -2064,18 +2059,6 @@ echo "LIBS+=$LIBS" >> $config_host_mak
 echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak

-echo "/* Automatically generated by configure - do not modify */" > $config_host_h
-
-/bin/sh $source_path/create_config < $config_host_mak >> $config_host_h
-
-if test -f ${config_host_h}~ ; then
-  if cmp -s $config_host_h ${config_host_h}~ ; then
-    mv ${config_host_h}~ $config_host_h
-  else
-    rm ${config_host_h}~
-  fi
-fi
-
 # generate list of library paths for linker script

 $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
@@ -2474,8 +2457,7 @@ fi
 echo "LDFLAGS+=$ldflags" >> $config_mak
 echo "QEMU_CFLAGS+=$cflags" >> $config_mak

-echo "/* Automatically generated by configure - do not modify */" > $config_h
-echo "#include \"../config-host.h\"" >> $config_h
+echo "#include \"../config-host.h\"" > $config_h

 /bin/sh $source_path/create_config < $config_mak >> $config_h

diff --git a/create_config b/create_config
index 5bc8fb6..30d0487 100755
--- a/create_config
+++ b/create_config
@@ -1,5 +1,7 @@
 #!/bin/sh

+echo "/* Automatically generated by create_config - do not modify */"
+
 while read line; do

 case $line in
diff --git a/rules.mak b/rules.mak
index b380903..ca95351 100644
--- a/rules.mak
+++ b/rules.mak
@@ -35,3 +35,12 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))

 cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
               >/dev/null 2>&1 && echo OK), $2, $3)
+
+# Generate timestamp files for .h include files
+
+%.h: %.h-timestamp
+	@test -f $@ || cp $< $@
+
+%.h-timestamp: %.mak
+	$(call quiet-command, $(SRC_PATH)/create_config < $< > $@, "  GEN   $*.h")
+	@cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h
-- 
1.6.2.5

  parent reply	other threads:[~2009-10-07  0:41 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-07  0:40 [Qemu-devel] [PATCH v5 00/31] Compile only devices that are used Juan Quintela
2009-10-07  0:40 ` [Qemu-devel] [PATCH 01/31] Don't include config-host.mak from inside config.mak Juan Quintela
2009-10-07  0:40 ` Juan Quintela [this message]
2009-10-09  7:06   ` [Qemu-devel] Re: [PATCH 02/31] Move generation of config-host.h to Makefile from configure Jan Kiszka
2009-10-07  0:40 ` [Qemu-devel] [PATCH 03/31] Remove useless check for config-host.mak Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 04/31] Rename config.{h, mak} config-target.{h, mak} Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 05/31] Move generation of config-target.h to Makefile from configure Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 06/31] Add new config-devices.mak for each target Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 07/31] Generate config-devices.h Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 08/31] Generate gdbstub-xml.c only when needed Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 09/31] Only compile usb_ohci when one target uses it Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 10/31] Only compile isa_mmio " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 11/31] Only compile qdev_addr " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 12/31] Only compile nand " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 13/31] Only compile ecc " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 14/31] Only compile esp " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 15/31] Only compile escc " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 16/31] Only compile m48t59 " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 17/31] Only compile ptimer " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 18/31] Only compile sd " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 19/31] Only compile max7310 " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 20/31] Only compile wm8750 " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 21/31] Only compile twl92230 " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 22/31] Only compile tsc2005 " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 23/31] Only compile lm832x " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 24/31] Only compile tmp105 " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 25/31] Only compile stellaris_input " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 26/31] Only compile sd0303 " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 27/31] Only compile sd0323 " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 28/31] Only compile ads7846 " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 29/31] Only compile max111x " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 30/31] Only compile ssi-sd " Juan Quintela
2009-10-07  0:41 ` [Qemu-devel] [PATCH 31/31] Only compile ssi " Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=479bbb59a908a1b60cb921e5f9718b7cd54d58d0.1254875337.git.quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).