On 24.08.2021 12:50, Anthony PERARD wrote:
> Rather than preparing the efi source file, we will copy them as needed
> from the build location.
> 
> Avoid the links as they seems fragile in out-of-tree builds. Also by
> making a copy, we don't need to figure out the relative path or we
> don't need to use absolute path.

I agree that symlinks wouldn't be nice for the out-of-tree build case.
Otoh please see
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=8c6740616cd244e5763e974cb737affbe71db385
albeit I'll admit the situation was a little different there because
it's pre-built files which get populated into the build tree.

> --- a/xen/arch/arm/efi/Makefile
> +++ b/xen/arch/arm/efi/Makefile
> @@ -1,4 +1,10 @@
>  CFLAGS-y += -fshort-wchar
> +CFLAGS-y += -I$(srctree)/common/efi

Perhaps another opportunity for -iquote?

>  obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o
>  obj-$(CONFIG_ACPI) +=  efi-dom0.init.o
> +
> +$(obj)/%.c: common/efi/%.c
> +     $(Q)cp -f $< $@

In case both trees are on the same file system, trying to hardlink first
would seem desirable. When copying, I think you should also pass -p.

> --- a/xen/arch/x86/efi/Makefile
> +++ b/xen/arch/x86/efi/Makefile
> @@ -1,4 +1,5 @@
>  CFLAGS-y += -fshort-wchar
> +CFLAGS-y += -I$(srctree)/common/efi
>  
>  quiet_cmd_objcopy_o_ihex = OBJCOPY $@
>  cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@
> @@ -19,3 +20,8 @@ obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
>  obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
>  extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
>  nocov-$(XEN_BUILD_EFI) += stub.o
> +
> +$(obj)/%.c: common/efi/%.c
> +     $(Q)cp -f $< $@
> +
> +.PRECIOUS: $(obj)/%.c

Seeing you repeat everything here, despite it not being all this much I
wonder if there wouldn't better be a makefile fragment in common/efi/
which all interested architectures' arch/<arch>/efi/Makefile would then
include. This could then also subsume -fshort-wchar.

Jan


Reply via email to