@@ -22,6 +22,7 @@ include $(srctree)/scripts/Kbuild.include
# Initialise some variables
obj-y :=
+obj-gen-y :=
lib-y :=
targets :=
## targets made from generated sources
@@ -98,6 +99,7 @@ always-y := $(addprefix $(obj)/,$(always-y))
targets := $(addprefix $(obj)/,$(targets))
lib-y := $(addprefix $(obj)/,$(lib-y))
obj-y := $(addprefix $(obj)/,$(obj-y))
+obj-gen-y := $(addprefix $(obj)/,$(obj-gen-y))
obj-bin-y := $(addprefix $(obj)/,$(obj-bin-y))
gen-objs-c := $(addprefix $(obj)/,$(gen-objs-c))
gen-objs-S := $(addprefix $(obj)/,$(gen-objs-S))
@@ -112,6 +114,11 @@ ifneq ($(hostprogs-y),)
include $(srctree)/scripts/Makefile.host
endif
+ifndef building_out_of_srctree
+ obj-y += $(obj-gen-y)
+ obj-gen-y :=
+endif
+
# subdir-builtin may contain duplications. Use $(sort ...)
subdir-builtin := $(sort $(filter %/built_in.o, $(obj-y)))
@@ -144,7 +151,7 @@ else
endif
# Reset COV_FLAGS in cases where an objects has another one as prerequisite
-$(nocov-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+$(nocov-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(obj-gen-y) $(extra-y)): \
COV_FLAGS :=
$(non-init-objects): _c_flags += $(COV_FLAGS)
@@ -155,7 +162,7 @@ ifeq ($(CONFIG_UBSAN),y)
UBSAN_FLAGS := $(filter-out -fno-%,$(CFLAGS_UBSAN)) $(filter -fno-%,$(CFLAGS_UBSAN))
# Reset UBSAN_FLAGS in cases where an objects has another one as prerequisite
-$(noubsan-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(extra-y)): \
+$(noubsan-y) $(filter %.init.o, $(obj-y) $(obj-bin-y) $(obj-gen-y) $(extra-y)): \
UBSAN_FLAGS :=
$(non-init-objects): _c_flags += $(UBSAN_FLAGS)
@@ -209,13 +216,13 @@ cmd_ld_builtin = \
$(LD) $(XEN_LDFLAGS) -r -o $@ $(real-prereqs)
endif
-$(obj)/built_in.o: $(obj-y) FORCE
- $(call if_changed,$(if $(strip $(obj-y)),ld_builtin,cc_builtin))
+$(obj)/built_in.o: $(obj-y) $(obj-gen-y) FORCE
+ $(call if_changed,$(if $(strip $(obj-y) $(obj-gen-y)),ld_builtin,cc_builtin))
$(obj)/lib.a: $(lib-y) FORCE
$(call if_changed,ar)
-targets += $(filter-out $(subdir-builtin), $(obj-y))
+targets += $(filter-out $(subdir-builtin), $(obj-y) $(obj-gen-y))
targets += $(lib-y) $(MAKECMDGOALS)
$(obj)/built_in_bin.o: $(obj-bin-y)
@@ -258,7 +265,7 @@ quiet_cmd_cc_o_S = CC $@
cmd_cc_o_S = $(CC) $(a_flags) -c $< -o $@
ifdef building_out_of_srctree
-$(gen-objs-S): $(obj)/%.o: $(obj)/%.S FORCE
+$(gen-objs-S) $(obj-gen-y): $(obj)/%.o: $(obj)/%.S FORCE
$(call if_changed_dep,cc_o_S)
endif
$(obj)/%.o: $(src)/%.S FORCE
@@ -279,7 +286,7 @@ define cmd_obj_init_o
$(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
endef
-$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): $(obj)/%.init.o: $(obj)/%.o FORCE
+$(filter %.init.o,$(obj-y) $(obj-bin-y) $(obj-gen-y) $(extra-y)): $(obj)/%.init.o: $(obj)/%.o FORCE
$(call if_changed,obj_init_o)
quiet_cmd_cpp_i_c = CPP $@
@@ -1,6 +1,6 @@
obj-$(CONFIG_ARGO) += argo.o
obj-y += bitmap.o
-obj-$(CONFIG_HYPFS_CONFIG) += config_data.o
+obj-gen-$(CONFIG_HYPFS_CONFIG) += config_data.o
obj-$(CONFIG_CORE_PARKING) += core_parking.o
obj-y += cpu.o
obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
similair to gen-objs-S, but obj-gen-y will be added to build_in.o Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- Notes: we could maybe use $(targets) instead of introducing new variables. xen/Rules.mk | 21 ++++++++++++++------- xen/common/Makefile | 2 +- 2 files changed, 15 insertions(+), 8 deletions(-)