From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vg7R9-0000sp-7M for qemu-devel@nongnu.org; Tue, 12 Nov 2013 01:27:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vg7R4-0006Hv-Ck for qemu-devel@nongnu.org; Tue, 12 Nov 2013 01:26:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vg7R4-0006Hr-3z for qemu-devel@nongnu.org; Tue, 12 Nov 2013 01:26:50 -0500 Message-ID: <5281CA12.4000903@redhat.com> Date: Tue, 12 Nov 2013 14:26:26 +0800 From: Fam Zheng MIME-Version: 1.0 References: <1381894008-29164-1-git-send-email-famz@redhat.com> <1381894008-29164-3-git-send-email-famz@redhat.com> <525FFAD0.8080603@redhat.com> In-Reply-To: <525FFAD0.8080603@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v14 2/8] make.rule: fix $(obj) to a real relative path List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, peter.maydell@linaro.org, stefanha@redhat.com, mjt@tls.msk.ru, qemu-devel@nongnu.org, xiawenc@linux.vnet.ibm.com, alex@alex.org.uk, vilanova@ac.upc.edu, rth@twiddle.net On 2013=E5=B9=B410=E6=9C=8817=E6=97=A5 22:57, Paolo Bonzini wrote: > Il 16/10/2013 05:26, Fam Zheng ha scritto: >> Makefile.target includes rule.mak and unnested common-obj-y, then pref= ix >> them with '../', this will ignore object specific QEMU_CFLAGS in subdi= r >> Makefile.objs: >> >> $(obj)/curl.o: QEMU_CFLAGS +=3D $(CURL_CFLAGS) >> >> Because $(obj) here is './block', instead of '../block'. This doesn't >> hurt compiling because we basically build all .o from top Makefile, >> before entering Makefile.target, but it will affact arriving per-objec= t >> libs support. >> >> The starting point of $(obj) is passed in as argument of unnest-vars, = as >> well as nested variables, so that different Makefiles can pass in a >> right value. >> >> Signed-off-by: Fam Zheng >> --- >> Makefile | 14 ++++++++++++++ >> Makefile.objs | 17 +---------------- >> Makefile.target | 20 ++++++++++++++++---- >> configure | 1 + >> rules.mak | 14 +++++++++----- >> 5 files changed, 41 insertions(+), 25 deletions(-) >> >> diff --git a/Makefile b/Makefile >> index b15003f..94dae51 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -115,6 +115,16 @@ defconfig: >> >> ifneq ($(wildcard config-host.mak),) >> include $(SRC_PATH)/Makefile.objs >> +endif >> + >> +dummy :=3D $(call unnest-vars,, \ >> + stub-obj-y \ >> + util-obj-y \ >> + qga-obj-y \ >> + block-obj-y \ >> + common-obj-y) >> + >> +ifneq ($(wildcard config-host.mak),) >> include $(SRC_PATH)/tests/Makefile >> endif >> ifeq ($(CONFIG_SMARTCARD_NSS),y) >> @@ -123,6 +133,10 @@ endif >> >> all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all >> >> +vl.o: QEMU_CFLAGS+=3D$(GPROF_CFLAGS) >> + >> +vl.o: QEMU_CFLAGS+=3D$(SDL_CFLAGS) >> + >> config-host.h: config-host.h-timestamp >> config-host.h-timestamp: config-host.mak >> qemu-options.def: $(SRC_PATH)/qemu-options.hx >> diff --git a/Makefile.objs b/Makefile.objs >> index 2b6c1fe..91235a6 100644 >> --- a/Makefile.objs >> +++ b/Makefile.objs >> @@ -41,7 +41,7 @@ libcacard-y +=3D libcacard/vcardt.o >> # single QEMU executable should support all CPUs and machines. >> >> ifeq ($(CONFIG_SOFTMMU),y) >> -common-obj-y =3D $(block-obj-y) blockdev.o blockdev-nbd.o block/ >> +common-obj-y =3D blockdev.o blockdev-nbd.o block/ >> common-obj-y +=3D net/ >> common-obj-y +=3D readline.o >> common-obj-y +=3D qdev-monitor.o device-hotplug.o >> @@ -110,18 +110,3 @@ version-lobj-$(CONFIG_WIN32) +=3D $(BUILD_DIR)/ve= rsion.lo >> # by libqemuutil.a. These should be moved to a separate .json schem= a. >> qga-obj-y =3D qga/ qapi-types.o qapi-visit.o >> qga-vss-dll-obj-y =3D qga/ >> - >> -vl.o: QEMU_CFLAGS+=3D$(GPROF_CFLAGS) >> - >> -vl.o: QEMU_CFLAGS+=3D$(SDL_CFLAGS) >> - >> -QEMU_CFLAGS+=3D$(GLIB_CFLAGS) >> - >> -nested-vars +=3D \ >> - stub-obj-y \ >> - util-obj-y \ >> - qga-obj-y \ >> - qga-vss-dll-obj-y \ >> - block-obj-y \ >> - common-obj-y >> -dummy :=3D $(call unnest-vars) >> diff --git a/Makefile.target b/Makefile.target >> index 9a49852..fb3a970 100644 >> --- a/Makefile.target >> +++ b/Makefile.target >> @@ -143,13 +143,25 @@ endif # CONFIG_SOFTMMU >> # Workaround for http://gcc.gnu.org/PR55489, see configure. >> %/translate.o: QEMU_CFLAGS +=3D $(TRANSLATE_OPT_CFLAGS) >> >> -nested-vars +=3D obj-y >> +dummy :=3D $(call unnest-vars,,obj-y) >> >> -# This resolves all nested paths, so it must come last >> +# we are making another call to unnest-vars with different vars, prot= ect obj-y, >> +# it can be overriden in subdir Makefile.objs >> +obj-y-save :=3D $(obj-y) >> + >> +block-obj-y :=3D >> +common-obj-y :=3D >> include $(SRC_PATH)/Makefile.objs >> +dummy :=3D $(call unnest-vars,..,block-obj-y common-obj-y) >> + >> +# Now restore obj-y >> +obj-y :=3D $(obj-y-save) >> + >> +all-obj-y =3D $(obj-y) $(common-obj-y) >> >> -all-obj-y =3D $(obj-y) >> -all-obj-y +=3D $(addprefix ../, $(common-obj-y)) >> +ifdef CONFIG_SOFTMMU >> +all-obj-y +=3D $(block-obj-y) >> +endif > > Just: > > all-obj-$(CONFIG_SOFTMMU) +=3D $(block-obj-y) > Paolo. I think this is the only comment on this series. Do you want me=20 to respin? Thanks, Fam >> ifndef CONFIG_HAIKU >> LIBS+=3D-lm >> diff --git a/configure b/configure >> index 57ee62a..3381264 100755 >> --- a/configure >> +++ b/configure >> @@ -2283,6 +2283,7 @@ fi >> if $pkg_config --atleast-version=3D$glib_req_ver gthread-2.0; then >> glib_cflags=3D`$pkg_config --cflags gthread-2.0` >> glib_libs=3D`$pkg_config --libs gthread-2.0` >> + CFLAGS=3D"$glib_cflags $CFLAGS" >> LIBS=3D"$glib_libs $LIBS" >> libs_qga=3D"$glib_libs $libs_qga" >> else >> diff --git a/rules.mak b/rules.mak >> index abc2e84..01e552e 100644 >> --- a/rules.mak >> +++ b/rules.mak >> @@ -110,9 +110,6 @@ clean: clean-timestamp >> >> # magic to descend into other directories >> >> -obj :=3D . >> -old-nested-dirs :=3D >> - >> define push-var >> $(eval save-$2-$1 =3D $(value $1)) >> $(eval $1 :=3D) >> @@ -126,9 +123,11 @@ endef >> >> define unnest-dir >> $(foreach var,$(nested-vars),$(call push-var,$(var),$1/)) >> -$(eval obj :=3D $(obj)/$1) >> +$(eval obj-parent-$1 :=3D $(obj)) >> +$(eval obj :=3D $(if $(obj),$(obj)/$1,$1)) >> $(eval include $(SRC_PATH)/$1/Makefile.objs) >> -$(eval obj :=3D $(patsubst %/$1,%,$(obj))) >> +$(eval obj :=3D $(obj-parent-$1)) >> +$(eval obj-parent-$1 :=3D ) >> $(foreach var,$(nested-vars),$(call pop-var,$(var),$1/)) >> endef >> >> @@ -143,7 +142,12 @@ $(if $(nested-dirs), >> endef >> >> define unnest-vars >> +$(eval obj :=3D $1) >> +$(eval nested-vars :=3D $2) >> +$(eval old-nested-dirs :=3D ) >> $(call unnest-vars-1) >> +$(if $1,$(foreach v,$(nested-vars),$(eval \ >> + $v :=3D $(addprefix $1/,$($v))))) >> $(foreach var,$(nested-vars),$(eval $(var) :=3D $(filter-out %/, $($= (var))))) >> $(shell mkdir -p $(sort $(foreach var,$(nested-vars),$(dir $($(var))= )))) >> $(foreach var,$(nested-vars), $(eval \ >> > >