]> xenbits.xensource.com Git - xen.git/commitdiff
build: use if_changed on built_in.o
authorAnthony PERARD <anthony.perard@citrix.com>
Tue, 7 Sep 2021 07:14:32 +0000 (09:14 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 7 Sep 2021 07:14:32 +0000 (09:14 +0200)
In the case where $(obj-y) is empty, we also replace $(c_flags) by
$(XEN_CFLAGS) to avoid generating an .%.d dependency file. This avoid
make trying to include %.h file in the ld command if $(obj-y) isn't
empty anymore on a second run.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/Rules.mk

index 3503f13235600fc352701779dcb06b18a5683361..a715a4525ea9e5d5e6d4babfcd0999de89808878 100644 (file)
@@ -147,17 +147,22 @@ include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
 c_flags += $(CFLAGS-y)
 a_flags += $(CFLAGS-y) $(AFLAGS-y)
 
-built_in.o: $(obj-y) $(if $(strip $(lib-y)),lib.a) $(extra-y)
-ifeq ($(strip $(obj-y)),)
-       $(CC) $(c_flags) -c -x c /dev/null -o $@
-else
+quiet_cmd_cc_builtin = CC      $@
+cmd_cc_builtin = \
+    $(CC) $(XEN_CFLAGS) -c -x c /dev/null -o $@
+
+quiet_cmd_ld_builtin = LD      $@
 ifeq ($(CONFIG_LTO),y)
-       $(LD_LTO) -r -o $@ $(filter $(obj-y),$^)
+cmd_ld_builtin = \
+    $(LD_LTO) -r -o $@ $(filter $(obj-y),$(real-prereqs))
 else
-       $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter $(obj-y),$^)
-endif
+cmd_ld_builtin = \
+    $(LD) $(XEN_LDFLAGS) -r -o $@ $(filter $(obj-y),$(real-prereqs))
 endif
 
+built_in.o: $(obj-y) $(if $(strip $(lib-y)),lib.a) $(extra-y) FORCE
+       $(call if_changed,$(if $(strip $(obj-y)),ld_builtin,cc_builtin))
+
 lib.a: $(lib-y) FORCE
        $(call if_changed,ar)