On Thu, 09/12 08:34, Paolo Bonzini wrote: > Il 12/09/2013 04:52, Fam Zheng ha scritto: > >>> > > define unnest-dir > >>> > > $(foreach var,$(nested-vars),$(call push-var,$(var),$1/)) > >>> > > $(eval obj-parent-$1 := $(obj)) > >>> > > $(eval obj := $(if $(obj),$(obj)/$1,$1)) > >>> > > $(eval include $(SRC_PATH)/$1/Makefile.objs) > >>> > > +$(foreach v,$(nested-vars),$(call fix-obj-vars,$v,$(if > >>> > > $(obj),$(obj)/))) > >>> > > $(eval obj := $(obj-parent-$1)) > >>> > > $(eval obj-parent-$1 := ) > >>> > > $(foreach var,$(nested-vars),$(call pop-var,$(var),$1/)) > >>> > > > >> > > >> > I'm not sure this will work for targets in the toplevel directory when > >> > obj-base is not empty. This can be fixed later though, as part of a > >> > general revamping of obj-base. Please add a FIXME comment. > >> > > > I'm not sure about the problem, can you give an example, so I can be > > specific > > in the comment? > > Can you try using vl.o-cflags instead of a per-target QEMU_CFLAGS? I > think it won't work, because the toplevel Makefile.objs is included > directly and not through unnest-dir. > I think this case works. Only in subdir %-cflags relies on unnest-vars to prefix them, toplevel objects don't need this:
In toplevel Makefile.objs, vl.o-cflags = -DTEST_CFLAGS_FOR_VL_O Then, rm vl.o ; make vl.o V=1 | grep TEST_CFLAGS_FOR_VL_O cc <hidden options> -DTEST_CFLAGS_FOR_VL_O -c -o vl.o vl.c Fam