@@ -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 $@
@@ -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)