From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgIG4-0006VC-5b for qemu-devel@nongnu.org; Sun, 17 Jun 2012 12:23:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SgIG2-0005zL-6V for qemu-devel@nongnu.org; Sun, 17 Jun 2012 12:23:23 -0400 Received: from cantor2.suse.de ([195.135.220.15]:33774 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SgIG1-0005yx-T4 for qemu-devel@nongnu.org; Sun, 17 Jun 2012 12:23:22 -0400 Message-ID: <4FDE046E.3090407@suse.de> Date: Sun, 17 Jun 2012 18:23:10 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1339945072-10816-1-git-send-email-aliguori@us.ibm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] make: automatically include dependencies in recursive subdir rules List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl , Anthony Liguori Cc: Paolo Bonzini , qemu-devel@nongnu.org Am 17.06.2012 17:20, schrieb Blue Swirl: > On Sun, Jun 17, 2012 at 2:57 PM, Anthony Liguori = wrote: >> I think I understand enough of what's going on in these rules to ensur= e this is >> right. But I could certainly use a second or third opinion... >> >> Signed-off-by: Anthony Liguori >> --- >> Makefile | 4 ++-- >> rules.mak | 1 + >> 2 files changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/Makefile b/Makefile >> index cce45fb..593bd9b 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -405,5 +405,5 @@ tar: >> Makefile: $(GENERATED_HEADERS) >> >> # Include automatically generated dependency files >> --include $(wildcard *.d audio/*.d slirp/*.d block/*.d net/*.d ui/*.d = qapi/*.d) >> --include $(wildcard qga/*.d hw/*.d hw/usb/*.d qom/*.d) >> +# All subdir dependencies come automatically from our recursive subdi= r rules >> +-include $(wildcard *.d) >=20 > include $(wildcard *.d */*.d */*/*.d */*/*/*.d) > ? No. Due to our directory structure not all dependency files apply to Makefile. Anyway, the problem is that any such "fixed" wildcard expression still silently fails when another level gets added. We've seen that simply no one notices, and the resulting errors are weird and non-telling. Therefore it was suggested to have some automatic way of deducing the dependency files from .o files. (See the "Makefile: Fix dependencies for QOM" thread.) >> diff --git a/rules.mak b/rules.mak >> index 4bc5e52..8c5ef95 100644 >> --- a/rules.mak >> +++ b/rules.mak >> @@ -94,6 +94,7 @@ define unnest-dir >> $(foreach var,$(nested-vars),$(call push-var,$(var),$1/)) >> $(eval obj :=3D $(obj)/$1) >> $(eval include $(SRC_PATH)/$1/Makefile.objs) >> +$(eval -include $(wildcard $(SRC_PATH)/$1/*.d)) >=20 > This assumes a build in the source directory, s/SRC_PATH/BUILD_DIR/. I've tested with just +$(eval -include $(wildcard $1/*.d)) and did $ touch include/qemu/object.h >>From what I see, using Anthony's original patch plus the modification above (not the other ones), {i386,x86_64}-softmmu/hw/kvm/apic.o is still not getting rebuilt despite its included hw/apic_internal.h depending on sysbus.h -> qdev.h -> qemu/object.h. They're being added via obj-$(CONFIG_KVM) +=3D kvm/filename.o, not via th= e recursive directory rule, so are not caught by Anthony's rule. Maybe fix by some explicit Makefile-specific rule such as this? diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index d43f1df..1e8423a 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -11,3 +11,5 @@ obj-$(CONFIG_KVM) +=3D kvm/clock.o kvm/apic.o kvm/i8259.o kvm/ioapic.o kvm/i8254.o obj-$(CONFIG_SPICE) +=3D qxl.o qxl-logger.o qxl-render.o obj-y :=3D $(addprefix ../,$(obj-y)) + +-include $(wildcard ../kvm/*.d) Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg