Message ID | 20220322112238.1117737-2-anthony.perard@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xen: Build system improvements, now with out-of-tree build! | expand |
Hi Julien, Stefano, Bertrand, Could I get a ack on this patch and the next one "[XEN PATCH v10 2/7] build: replace $(BASEDIR) by $(objtree)" for the Arm part? Cheers, On Tue, Mar 22, 2022 at 11:22:32AM +0000, Anthony PERARD wrote: > Rather than preparing the efi source file, we will make the symbolic > link as needed from the build location. > > The `ln` command is run every time to allow to update the link in case > the source tree change location. > > This patch also introduce "efi-common.mk" which allow to reuse the > common make instructions without having to duplicate them into each > arch. > > And now that we have a list of common source file, we can start to > remove the links to the source files on clean. > > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> > Acked-by: Jan Beulich <jbeulich@suse.com>
Hi Anthony, On 22/03/2022 11:22, Anthony PERARD wrote: > Rather than preparing the efi source file, we will make the symbolic > link as needed from the build location. > > The `ln` command is run every time to allow to update the link in case > the source tree change location. > > This patch also introduce "efi-common.mk" which allow to reuse the > common make instructions without having to duplicate them into each > arch. > > And now that we have a list of common source file, we can start to > remove the links to the source files on clean. > > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> > Acked-by: Jan Beulich <jbeulich@suse.com> Acked-by: Julien Grall <jgrall@amazon.com> Cheers,
diff --git a/xen/Makefile b/xen/Makefile index 18a4f7e1015a..dec489f2a909 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -441,11 +441,6 @@ $(TARGET).gz: $(TARGET) $(TARGET): FORCE $(Q)$(MAKE) $(build)=tools $(Q)$(MAKE) $(build)=. include/xen/compile.h - [ -e arch/$(TARGET_ARCH)/efi ] && for f in $$(cd common/efi; echo *.[ch]); \ - do test -r arch/$(TARGET_ARCH)/efi/$$f || \ - ln -nsf ../../../common/efi/$$f arch/$(TARGET_ARCH)/efi/; \ - done; \ - true $(Q)$(MAKE) $(build)=include all $(Q)$(MAKE) $(build)=arch/$(TARGET_ARCH) include $(Q)$(MAKE) $(build)=. arch/$(TARGET_ARCH)/include/asm/asm-offsets.h diff --git a/xen/arch/arm/efi/Makefile b/xen/arch/arm/efi/Makefile index 1b1ed06feddc..4313c390665f 100644 --- a/xen/arch/arm/efi/Makefile +++ b/xen/arch/arm/efi/Makefile @@ -1,4 +1,4 @@ -CFLAGS-y += -fshort-wchar +include $(srctree)/common/efi/efi-common.mk -obj-y += boot.init.o pe.init.o ebmalloc.o runtime.o +obj-y += $(EFIOBJ-y) obj-$(CONFIG_ACPI) += efi-dom0.init.o diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile index e08b4d8e4808..034ec87895df 100644 --- a/xen/arch/x86/efi/Makefile +++ b/xen/arch/x86/efi/Makefile @@ -1,4 +1,4 @@ -CFLAGS-y += -fshort-wchar +include $(srctree)/common/efi/efi-common.mk quiet_cmd_objcopy_o_ihex = OBJCOPY $@ cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@ @@ -8,9 +8,6 @@ $(obj)/%.o: $(src)/%.ihex FORCE $(obj)/boot.init.o: $(obj)/buildid.o -EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o -EFIOBJ-$(CONFIG_COMPAT) += compat.o - $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4) $(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS_stack_boundary := $(cflags-stack-boundary) diff --git a/xen/common/efi/efi-common.mk b/xen/common/efi/efi-common.mk new file mode 100644 index 000000000000..960d44a6d55b --- /dev/null +++ b/xen/common/efi/efi-common.mk @@ -0,0 +1,15 @@ +EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o +EFIOBJ-$(CONFIG_COMPAT) += compat.o + +CFLAGS-y += -fshort-wchar +CFLAGS-y += -iquote $(srctree)/common/efi + +# Part of the command line transforms $(obj) +# e.g.: It transforms "dir/foo/bar" into successively +# "dir foo bar", ".. .. ..", "../../.." +$(obj)/%.c: $(srctree)/common/efi/%.c FORCE + $(Q)ln -nfs $(subst $(space),/,$(patsubst %,..,$(subst /, ,$(obj))))/common/efi/$(<F) $@ + +clean-files += $(patsubst %.o, %.c, $(EFIOBJ-y:.init.o=.o) $(EFIOBJ-)) + +.PRECIOUS: $(obj)/%.c