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?

> @@ -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. ...

> --- 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 ?

> --- 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)?

Jan


Reply via email to