On Mon, Oct 11, 2021 at 02:39:26PM +0200, Jan Beulich wrote:
> On 24.08.2021 12:50, Anthony PERARD wrote:
> > In a future patch, when building a subdirectory, we will set
> > "obj=$subdir" rather than change directory.
> > 
> > Before that, we add "$(obj)" and "$(src)" in as many places as
> > possible where we will need to know which subdirectory is been built.
> > "$(obj)" is for files been generated during the build, and "$(src)" is
> > for files present in the source tree.
> > 
> > For now, we set both to "." in Rules.mk and Makefile.clean.
> > 
> > A few places don't tolerate the addition of "./", this is because make
> > remove the leading "./" in targets and dependencies in rules, so these
> > will be change later.
> > 
> > Signed-off-by: Anthony PERARD <[email protected]>
> 
> Acked-by: Jan Beulich <[email protected]>
> 
> Nevertheless a couple of remarks:
> 
> > --- a/xen/arch/x86/Makefile
> > +++ b/xen/arch/x86/Makefile
> >[...]
> > @@ -192,25 +192,25 @@ note_file_option ?= $(note_file)
> >  
> >  ifeq ($(XEN_BUILD_PE),y)
> >  extra-y += efi.lds
> 
> What about this? Does this for some reason also fall into the "cannot
> be converted yet" group?

$(extra-y) is treated the same way as $(obj-y), it is used to list item
to build in the current subdirectory. So there is no need to add $(obj)/

> > @@ -222,14 +222,14 @@ $(TARGET).efi: FORCE
> >  endif
> >  
> >  # These should already have been rebuilt when building the prerequisite of 
> > "prelink.o"
> > -efi/buildid.o efi/relocs-dummy.o: ;
> > +$(obj)/efi/buildid.o $(obj)/efi/relocs-dummy.o: ;
> >  
> >  .PHONY: include
> >  include: $(BASEDIR)/arch/x86/include/asm/asm-macros.h
> >  
> > -asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
> > +$(obj)/asm-macros.i: CFLAGS-y += -D__ASSEMBLY__ -P
> >  
> > -$(BASEDIR)/arch/x86/include/asm/asm-macros.h: asm-macros.i Makefile
> > +$(BASEDIR)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i 
> > $(src)/Makefile
> 
> Isn't this $(obj)/include/asm/asm-macros.h ? And in general doesn't
> use of $(BASEDIR) need to go away then, e.g. ...

I've limited this patch to add $(obj)/ and $(src)/ were needed, I think.

And yes, BASEDIR will need to go away.

> > --- a/xen/arch/x86/boot/Makefile
> > +++ b/xen/arch/x86/boot/Makefile
> > @@ -1,8 +1,8 @@
> >  obj-bin-y += head.o
> >  
> > -DEFS_H_DEPS = defs.h $(BASEDIR)/include/xen/stdbool.h
> > +DEFS_H_DEPS = $(src)/defs.h $(BASEDIR)/include/xen/stdbool.h
> 
> ... here needing to become $(src)/../../../include/xen/stdbool.h ?

BASEDIR will be dealt with later.

> > --- a/xen/scripts/Makefile.clean
> > +++ b/xen/scripts/Makefile.clean
> > @@ -3,11 +3,14 @@
> >  # Cleaning up
> >  # 
> > ==========================================================================
> >  
> > +obj := .
> > +src := $(obj)
> 
> This repeats what is also getting added to Rules.mk. To prevent
> the two going out of sync, wouldn't they better live in a central
> place (e.g. scripts/defs.mk)?

It looks like they are the same but they are not, it doesn't matter if
they go out of sync, and they actually do in my patch series.

Thanks,

-- 
Anthony PERARD

Reply via email to