@@ -173,19 +173,27 @@ FORCE:
SRCPATH := $(patsubst $(BASEDIR)/%,%,$(CURDIR))
-%.o: %.c Makefile
+quiet_cmd_cc_o_c = CC $@
ifeq ($(CONFIG_ENFORCE_UNIQUE_SYMBOLS),y)
- $(CC) $(c_flags) -c $< -o $(@D)/.$(@F).tmp -MQ $@
-ifeq ($(CONFIG_CC_IS_CLANG),y)
- $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(@D)/.$(@F).tmp $@
-else
- $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(@D)/.$(@F).tmp $@
-endif
- rm -f $(@D)/.$(@F).tmp
+ cmd_cc_o_c = $(CC) $(c_flags) -c $< -o $(dot-target).tmp -MQ $@
+ ifeq ($(CONFIG_CC_IS_CLANG),y)
+ cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $<=$(SRCPATH)/$< $(dot-target).tmp $@
+ else
+ cmd_objcopy_fix_sym = $(OBJCOPY) --redefine-sym $(<F)=$(SRCPATH)/$< $(dot-target).tmp $@
+ endif
+ cmd_objcopy_fix_sym += && rm -f $(dot-target).tmp
else
- $(CC) $(c_flags) -c $< -o $@
+ cmd_cc_o_c = $(CC) $(c_flags) -c $< -o $@
endif
+define rule_cc_o_c
+ $(call cmd_and_record,cc_o_c)
+ $(call cmd,objcopy_fix_sym)
+endef
+
+%.o: %.c FORCE
+ $(call if_changed_rule,cc_o_c)
+
quiet_cmd_cc_o_S = CC $@
cmd_cc_o_S = $(CC) $(a_flags) -c $< -o $@