diff mbox series

[XEN,v8,41/47] WIP, no-VPATH: build object from generated C files

Message ID 20211125134006.1076646-42-anthony.perard@citrix.com (mailing list archive)
State Superseded
Headers show
Series xen: Build system improvements, now with out-of-tree build! | expand

Commit Message

Anthony PERARD Nov. 25, 2021, 1:40 p.m. UTC
From: Anthony PERARD <anthony.perard@gmail.com>

we need to tell that the efi source files are "generated"

Maybe listing generated sources would be better, and then we can
automaticaly select the right rule.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
 xen/Rules.mk                 | 9 ++++++++-
 xen/common/efi/efi_common.mk | 3 +++
 2 files changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/xen/Rules.mk b/xen/Rules.mk
index 45d2b72158b8..44af005fd57e 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -24,6 +24,8 @@  include $(srctree)/scripts/Kbuild.include
 obj-y :=
 lib-y :=
 targets :=
+## targets made from generated sources
+gen-objs-c :=
 subdir-y :=
 CFLAGS-y :=
 AFLAGS-y :=
@@ -96,6 +98,7 @@  targets         := $(addprefix $(obj)/,$(targets))
 lib-y           := $(addprefix $(obj)/,$(lib-y))
 obj-y           := $(addprefix $(obj)/,$(obj-y))
 obj-bin-y       := $(addprefix $(obj)/,$(obj-bin-y))
+gen-objs-c      := $(addprefix $(obj)/,$(gen-objs-c))
 subdir-y        := $(addprefix $(obj)/,$(subdir-y))
 nocov-y         := $(addprefix $(obj)/,$(nocov-y))
 noubsan-y       := $(addprefix $(obj)/,$(noubsan-y))
@@ -242,7 +245,11 @@  define rule_cc_o_c
     $(call cmd,objcopy_fix_sym)
 endef
 
-$(obj)/%.o: $(src)/%.c FORCE
+ifdef building_out_of_srctree
+$(gen-objs-c): $(obj)/%.o: $(obj)/%.c FORCE
+	$(call if_changed_rule,cc_o_c)
+endif
+$(obj)/%.o: $(srctree)/$(src)/%.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
 quiet_cmd_cc_o_S = CC      $@
diff --git a/xen/common/efi/efi_common.mk b/xen/common/efi/efi_common.mk
index d059bb30afa5..232cb508ee85 100644
--- a/xen/common/efi/efi_common.mk
+++ b/xen/common/efi/efi_common.mk
@@ -1,6 +1,9 @@ 
 EFIOBJ-y := boot.init.o pe.init.o ebmalloc.o runtime.o
 EFIOBJ-$(CONFIG_COMPAT) += compat.o
 
+# common-efi-objs := boot.c  compat.c  ebmalloc.c  pe.c  runtime.c
+gen-objs-c := boot.o compat.o ebmalloc.o pe.o runtime.o
+
 CFLAGS-y += -fshort-wchar
 CFLAGS-y += -iquote $(srctree)/common/efi
 CFLAGS-y += -iquote $(srcdir)