@@ -56,6 +56,18 @@ SPECIAL_DATA_SECTIONS := rodata $(foreach a,1 2 4 8 16, \
include Makefile
+# Linking
+# ---------------------------------------------------------------------------
+
+quiet_cmd_ld = LD $@
+cmd_ld = $(LD) $(XEN_LDFLAGS) -r -o $@ $(real-prereqs)
+
+# Objcopy
+# ---------------------------------------------------------------------------
+
+quiet_cmd_objcopy = OBJCOPY $@
+cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $< $@
+
define gendep
ifneq ($(1),$(subst /,:,$(1)))
DEPS += $(dir $(1)).$(notdir $(1)).d
@@ -165,29 +177,47 @@ else
$(CC) $(c_flags) -c $< -o $@
endif
-%.o: %.S Makefile
- $(CC) $(a_flags) -c $< -o $@
+quiet_cmd_cc_o_S = CC $@
+cmd_cc_o_S = $(CC) $(a_flags) -c $< -o $@
+
+%.o: %.S FORCE
+ $(call if_changed,cc_o_S)
+
+
+quiet_cmd_obj_init_o = INIT_O $@
+define cmd_obj_init_o
+ $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | while read idx name sz rest; do \
+ case "$$name" in \
+ .*.local) ;; \
+ .text|.text.*|.data|.data.*|.bss) \
+ test $$sz != 0 || continue; \
+ echo "Error: size of $<:$$name is 0x$$sz" >&2; \
+ exit $$(expr $$idx + 1);; \
+ esac; \
+ done; \
+ $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
+endef
+
+$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o FORCE
+ $(call if_changed,obj_init_o)
+
+quiet_cmd_cpp_i_c = CPP $@
+cmd_cpp_i_c = $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@
+
+quiet_cmd_cc_s_c = CC $@
+cmd_cc_s_c = $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
-$(filter %.init.o,$(obj-y) $(obj-bin-y) $(extra-y)): %.init.o: %.o Makefile
- $(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | while read idx name sz rest; do \
- case "$$name" in \
- .*.local) ;; \
- .text|.text.*|.data|.data.*|.bss) \
- test $$sz != 0 || continue; \
- echo "Error: size of $<:$$name is 0x$$sz" >&2; \
- exit $$(expr $$idx + 1);; \
- esac; \
- done
- $(OBJCOPY) $(foreach s,$(SPECIAL_DATA_SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
+quiet_cmd_s_S = CPP $@
+cmd_s_S = $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@
-%.i: %.c Makefile
- $(CPP) $(filter-out -Wa$(comma)%,$(c_flags)) $< -o $@
+%.i: %.c FORCE
+ $(call if_changed,cpp_i_c)
-%.s: %.c Makefile
- $(CC) $(filter-out -Wa$(comma)%,$(c_flags)) -S $< -o $@
+%.s: %.c FORCE
+ $(call if_changed,cc_s_c)
-%.s: %.S Makefile
- $(CPP) $(filter-out -Wa$(comma)%,$(a_flags)) $< -o $@
+%.s: %.S FORCE
+ $(call if_changed,cpp_s_S)
# Add intermediate targets:
# When building objects with specific suffix patterns, add intermediate
@@ -97,8 +97,8 @@ prelink_lto.o: $(ALL_OBJS)
prelink.o: $(patsubst %/built_in.o,%/built_in_bin.o,$(ALL_OBJS)) prelink_lto.o
$(LD) $(XEN_LDFLAGS) -r -o $@ $^
else
-prelink.o: $(ALL_OBJS)
- $(LD) $(XEN_LDFLAGS) -r -o $@ $^
+prelink.o: $(ALL_OBJS) FORCE
+ $(call if_changed,ld)
endif
$(TARGET)-syms: prelink.o xen.lds
@@ -71,6 +71,7 @@ obj-$(CONFIG_TBOOT) += tboot.o
obj-y += hpet.o
obj-y += vm_event.o
obj-y += xstate.o
+extra-y += asm-macros.i
x86_emulate.o: x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
@@ -1,7 +1,10 @@
CFLAGS-y += -fshort-wchar
-%.o: %.ihex
- $(OBJCOPY) -I ihex -O binary $< $@
+quiet_cmd_objcopy_o_ihex = OBJCOPY $@
+cmd_objcopy_o_ihex = $(OBJCOPY) -I ihex -O binary $< $@
+
+%.o: %.ihex FORCE
+ $(call if_changed,objcopy_o_ihex)
boot.init.o: buildid.o
@@ -1,12 +1,16 @@
obj-bin-y := libelf.o
nocov-y += libelf.o
+libelf-objs := libelf-tools.o libelf-loader.o libelf-dominfo.o
SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
+OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
CFLAGS-y += -Wno-pointer-sign
-libelf.o: libelf-temp.o Makefile
- $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
+libelf.o: libelf-temp.o FORCE
+ $(call if_changed,objcopy)
-libelf-temp.o: libelf-tools.o libelf-loader.o libelf-dominfo.o #libelf-relocate.o
- $(LD) $(XEN_LDFLAGS) -r -o $@ $^
+libelf-temp.o: $(libelf-objs) FORCE
+ $(call if_changed,ld)
+
+extra-y += libelf-temp.o $(libelf-objs)
@@ -1,14 +1,17 @@
include Makefile.libfdt
SECTIONS := text data $(SPECIAL_DATA_SECTIONS)
+OBJCOPYFLAGS := $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s))
obj-y += libfdt.o
nocov-y += libfdt.o
CFLAGS-y += -I$(BASEDIR)/include/xen/libfdt/
-libfdt.o: libfdt-temp.o Makefile
- $(OBJCOPY) $(foreach s,$(SECTIONS),--rename-section .$(s)=.init.$(s)) $< $@
+libfdt.o: libfdt-temp.o FORCE
+ $(call if_changed,objcopy)
-libfdt-temp.o: $(LIBFDT_OBJS)
- $(LD) $(XEN_LDFLAGS) -r -o $@ $^
+libfdt-temp.o: $(LIBFDT_OBJS) FORCE
+ $(call if_changed,ld)
+
+extra-y += libfdt-temp.o $(LIBFDT_OBJS)
@@ -20,12 +20,21 @@ AV_H_FILES = include/av_perm_to_string.h include/av_permissions.h
ALL_H_FILES = $(FLASK_H_FILES) $(AV_H_FILES)
$(obj-y) ss/built_in.o: $(ALL_H_FILES)
+extra-y += $(ALL_H_FILES)
-$(FLASK_H_FILES): $(FLASK_H_DEPEND)
- $(CONFIG_SHELL) policy/mkflask.sh $(AWK) include $(FLASK_H_DEPEND)
+mkflask := policy/mkflask.sh
+quiet_cmd_mkflask = MKFLASK $@
+cmd_mkflask = $(CONFIG_SHELL) $(mkflask) $(AWK) include $(FLASK_H_DEPEND)
-$(AV_H_FILES): $(AV_H_DEPEND)
- $(CONFIG_SHELL) policy/mkaccess_vector.sh $(AWK) $(AV_H_DEPEND)
+$(FLASK_H_FILES): $(FLASK_H_DEPEND) $(mkflask) FORCE
+ $(call if_changed,mkflask)
+
+mkaccess := policy/mkaccess_vector.sh
+quiet_cmd_mkaccess = MKACCESS VECTOR $@
+cmd_mkaccess = $(CONFIG_SHELL) $(mkaccess) $(AWK) $(AV_H_DEPEND)
+
+$(AV_H_FILES): $(AV_H_DEPEND) $(mkaccess) FORCE
+ $(call if_changed,mkaccess)
obj-bin-$(CONFIG_XSM_FLASK_POLICY) += flask-policy.o
flask-policy.o: policy.bin