From patchwork Fri Aug 28 18:56:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 32437 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 91D5EB7257 for ; Sat, 29 Aug 2009 05:49:28 +1000 (EST) Received: from localhost ([127.0.0.1]:33515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mh7Rr-0002Z2-Qa for incoming@patchwork.ozlabs.org; Fri, 28 Aug 2009 15:49:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mh6fm-0002sZ-Vf for qemu-devel@nongnu.org; Fri, 28 Aug 2009 14:59:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mh6fh-0002k1-Jf for qemu-devel@nongnu.org; Fri, 28 Aug 2009 14:59:42 -0400 Received: from [199.232.76.173] (port=43266 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mh6fh-0002jo-3e for qemu-devel@nongnu.org; Fri, 28 Aug 2009 14:59:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64091) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mh6fg-0007cR-Fg for qemu-devel@nongnu.org; Fri, 28 Aug 2009 14:59:36 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7SIxZLV032596; Fri, 28 Aug 2009 14:59:35 -0400 Received: from localhost.localdomain (vpn2-8-222.ams2.redhat.com [10.36.8.222]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7SIxTPf029889; Fri, 28 Aug 2009 14:59:34 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 28 Aug 2009 20:56:37 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 02/30] Move generation of config-host.h to Makefile from configure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- Makefile | 10 +++++++--- configure | 20 +------------------- create_config | 2 ++ rules.mak | 9 +++++++++ 4 files changed, 19 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index bdac9b3..bf44461 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,8 @@ else DOCS= endif -build-all: $(TOOLS) $(DOCS) recurse-all +build-all: config-host.h + $(MAKE) $(TOOLS) $(DOCS) recurse-all config-host.mak: configure ifneq ($(wildcard config-host.mak),) @@ -32,10 +33,13 @@ ifneq ($(wildcard config-host.mak),) @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh endif +config-host.h: config-host.h-timestamp +config-host.h-timestamp: config-host.mak + SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) 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 @@ -192,7 +196,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; do \ rm -rf $$d || exit 1 ; \ diff --git a/configure b/configure index b44ca4f..0b0fe2e 100755 --- a/configure +++ b/configure @@ -1691,13 +1691,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 @@ -1940,18 +1935,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} @@ -2354,8 +2337,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 c0315ac..3cbfa3d 100644 --- a/rules.mak +++ b/rules.mak @@ -23,3 +23,12 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1)) cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi ;) + +# 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