]> git.saurik.com Git - apple/xnu.git/blobdiff - makedefs/MakeInc.rule
xnu-6153.121.1.tar.gz
[apple/xnu.git] / makedefs / MakeInc.rule
index d2e05a89fea2cdf3c00ef2f4ed107c7629143411..3961872d55f1e88abdfcf00c2c5c6d0659fd4ccc 100644 (file)
@@ -61,29 +61,29 @@ ifeq ($(LOGCOLORS),y)
         ifeq ($(CURRENT_MACHINE_CONFIG),NONE)
             export _MACHINE := $(subst Mac,,$(PLATFORM))
         endif
-        export CMD_MC := \\033[1m$(shell __A="$(CURRENT_ARCH_CONFIG_LC)"; \
+        export CMD_MC := $(shell __A="$(CURRENT_ARCH_CONFIG_LC)"; \
                                          __As=$$((6-$${\#__A})); \
-                                         printf "%-.6s%*.*s %9.9s" \
+                                         printf "\\033[1m%-.6s%*.*s %9.9s\\033[m" \
                                                 "$${__A}" \
                                                 $${__As} $${__As} " " \
-                                                "$(_MACHINE)")\\033[m
+                                                "$(_MACHINE)")
     endif
     # Turn off colored output
-    Color0=\\033[m
+    Color0:=$(shell printf "\\033[m")
     # Start a host command: bold, underlined pink text
-    ColorH=\\033[1;4;35m
+    ColorH:=$(shell printf "\\033[1;4;35m")
     # Start a compilation-related command: bold, underlined blue text
-    ColorC=[$(CMD_MC)] \\033[1;4;34m
+    ColorC:=$(shell printf "[$(CMD_MC)] \\033[1;4;34m")
     # Start a MIG command: bold, green text on light grey background
-    ColorM=[$(CMD_MC)] \\033[1;32;40m
+    ColorM:=$(shell printf "[$(CMD_MC)] \\033[1;32;40m")
     # Start a linking command: bold, white text on blue background
-    ColorL=[$(CMD_MC)] \\033[1;37;44m
+    ColorL:=$(shell printf "[$(CMD_MC)] \\033[1;37;44m")
     # Start a filename: bold, white text
-    ColorF=\\033[1;37m
+    ColorF:=$(shell printf "\\033[1;37m")
     # Start a linked file name: yellow text on light grey background
-    ColorLF=\\033[1;33;40m
+    ColorLF:=$(shell printf "\\033[1;33;40m")
     # Error strings: underlined bold white text on red background
-    ColorErr=\033[1;4;37;41m
+    ColorErr:=$(shell printf "\033[1;4;37;41m")
 endif
 
 .PHONY: ALWAYS
@@ -112,10 +112,10 @@ $(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR
        $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) $(4)
 
 $(1): $(dir $(firstword $(1)))% : $(if $(2),%,$$(SOURCE)/%) | $(3)_MKDIR
-       @echo "$$(ColorH)INSTALLHDR$$(Color0)    $$(ColorF)$$*$$(Color0)"
+       $$(call makelog,$$(ColorH)INSTALLHDR$$(Color0)    $$(ColorF)$$*$$(Color0))
        $$(_v)$$(UNIFDEF) $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$;       \
        if [ $$$$? -eq 2 ]; then                                                \
-               echo Parse failure for $$<;                             \
+               $(ERR) Parse failure for $$<;                           \
                exit 1;                                                 \
        fi;                                                             \
        $$(DECOMMENT) ./$(3)/$$*.unifdef.$$$$$$$$ r >                   \
@@ -148,11 +148,11 @@ $(3)/.UNIFDEF_FLAGS: ALWAYS | $(3)_MKDIR
        $$(_v)$$(REPLACECONTENTS) $$@ $$(UNIFDEF) -t $(4)
 
 $(1): $(5)% : $(2) | $(3)_MKDIR
-       @echo "$$(ColorH)INSTALLPY$$(Color0)    $$(ColorF)$$*$$(Color0)"
+       $$(call makelog,$$(ColorH)INSTALLPY$$(Color0)     $$(ColorF)$$*$$(Color0))
        $$(_v)$$(MKDIR) $$(dir $$@) $$(dir ./$(3)/$$*)
        $$(_v)$$(UNIFDEF) -t $(4) $$< > ./$(3)/$$*.unifdef.$$$$$$$$$$(suffix $$*); \
        if [ $$$$? -eq 2 ]; then                                                \
-               echo Parse failure for $$<;                             \
+               $(ERR) Parse failure for $$<;                           \
                exit 1;                                                 \
        fi;                                                             \
        $$(INSTALL) $$(DATA_INSTALL_FLAGS) \
@@ -163,6 +163,37 @@ $(1): $(5)% : $(2) | $(3)_MKDIR
        $$(_v)if [ -n "$(5)" ]; then $$(TOUCH) "$(5)"; fi
 endef
 
+#
+# Empty the install lists of non-host headers if building the host headers alias
+#
+
+ifeq ($(INSTALLHDRS_SKIP_HOST),YES)
+INSTALL_MI_LIST =
+INSTALL_MI_GEN_LIST =
+INSTALL_DRIVERKIT_MI_LIST =
+INSTALL_DRIVERKIT_MI_GEN_LIST =
+INSTALL_KF_MI_LIST =
+INSTALL_KF_MI_GEN_LIST =
+INSTALL_MI_LCL_LIST =
+INSTALL_MI_LCL_GEN_LIST =
+INSTALL_DRIVERKIT_MI_LCL_LIST =
+INSTALL_DRIVERKIT_MI_LCL_GEN_LIST =
+INSTALL_KF_MI_LCL_LIST =
+INSTALL_KF_MI_LCL_GEN_LIST =
+INSTALL_MD_LIST =
+INSTALL_MD_GEN_LIST =
+INSTALL_DRIVERKIT_MD_LIST =
+INSTALL_DRIVERKIT_MD_GEN_LIST =
+INSTALL_KF_MD_LIST =
+INSTALL_KF_MD_GEN_LIST =
+INSTALL_MD_LCL_LIST =
+INSTALL_MD_LCL_GEN_LIST =
+INSTALL_DRIVERKIT_MD_LCL_LIST =
+INSTALL_DRIVERKIT_MD_LCL_GEN_LIST =
+INSTALL_KF_MD_LCL_LIST =
+INSTALL_KF_MD_LCL_GEN_LIST =
+endif
+
 #
 # Machine-independent (public) files
 #
@@ -173,6 +204,14 @@ INSTALL_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/,
 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_FILES),,incmidir,$(SINCFRAME_UNIFDEF)))
 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_INC_GEN_FILES),1,incmigendir,$(SINCFRAME_UNIFDEF)))
 
+ifeq ($(DRIVERKIT),1)
+INSTALL_DRIVERKIT_MI_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LIST))
+INSTALL_DRIVERKIT_MI_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_GEN_LIST))
+
+$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_FILES),,dkincmidir,$(DKINCFRAME_UNIFDEF)))
+$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_INC_GEN_FILES),1,dkincmigendir,$(DKINCFRAME_UNIFDEF)))
+endif
+
 INSTALL_KF_MI_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LIST))
 INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST))
 
@@ -189,6 +228,14 @@ INSTALL_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/,
 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_FILES),,pincmidir,$(SPINCFRAME_UNIFDEF)))
 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MI_LCL_GEN_FILES),1,pincmigendir,$(SPINCFRAME_UNIFDEF)))
 
+ifeq ($(DRIVERKIT),1)
+INSTALL_DRIVERKIT_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_LIST))
+INSTALL_DRIVERKIT_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_DRIVERKIT_MI_LCL_GEN_LIST))
+
+$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_FILES),,dkpincmidir,$(DKPINCFRAME_UNIFDEF)))
+$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES),1,dkpincmigendir,$(DKPINCFRAME_UNIFDEF)))
+endif
+
 INSTALL_KF_MI_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_LIST))
 INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST))
 
@@ -205,6 +252,14 @@ INSTALL_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/,
 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_FILES),,incdir,$(SINCFRAME_UNIFDEF)))
 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_INC_GEN_FILES),1,incgendir,$(SINCFRAME_UNIFDEF)))
 
+ifeq ($(DRIVERKIT),1)
+INSTALL_DRIVERKIT_MD_INC_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LIST))
+INSTALL_DRIVERKIT_MD_INC_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITINCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_GEN_LIST))
+
+$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_FILES),,dkincdir,$(DKINCFRAME_UNIFDEF)))
+$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_INC_GEN_FILES),1,dkincgendir,$(DKINCFRAME_UNIFDEF)))
+endif
+
 INSTALL_KF_MD_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LIST))
 INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST))
 
@@ -221,6 +276,14 @@ INSTALL_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/,
 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_FILES),,pincdir,$(SPINCFRAME_UNIFDEF)))
 $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_MD_LCL_GEN_FILES),1,pincgendir,$(SPINCFRAME_UNIFDEF)))
 
+ifeq ($(DRIVERKIT),1)
+INSTALL_DRIVERKIT_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_LIST))
+INSTALL_DRIVERKIT_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(DRIVERKITLCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_DRIVERKIT_MD_LCL_GEN_LIST))
+
+$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_LCL_FILES),,dkpincdir,$(DKPINCFRAME_UNIFDEF)))
+$(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_DRIVERKIT_MD_LCL_GEN_FILES),1,dkpincgendir,$(DKPINCFRAME_UNIFDEF)))
+endif
+
 INSTALL_KF_MD_LCL_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_LIST))
 INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST))
 
@@ -230,14 +293,22 @@ $(eval $(call INSTALLHDRS_RULE_template,$(INSTALL_KF_MD_LCL_GEN_FILES),1,kpincge
 .PHONY: do_installhdrs_mi
 
 # Double-colon rule so that MakeInc.kernel can add custom behaviors
-do_installhdrs_mi:: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_INC_GEN_FILES) $(INSTALL_KF_MI_FILES) $(INSTALL_KF_MI_GEN_FILES) \
-                   $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_LCL_GEN_FILES) $(INSTALL_KF_MI_LCL_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES)
+do_installhdrs_mi:: $(INSTALL_MI_INC_FILES) $(INSTALL_MI_INC_GEN_FILES) \
+                   $(INSTALL_DRIVERKIT_MI_INC_FILES) $(INSTALL_DRIVERKIT_MI_INC_GEN_FILES) \
+                   $(INSTALL_KF_MI_FILES) $(INSTALL_KF_MI_GEN_FILES) \
+                   $(INSTALL_MI_LCL_FILES) $(INSTALL_MI_LCL_GEN_FILES) \
+                   $(INSTALL_DRIVERKIT_MI_LCL_FILES) $(INSTALL_DRIVERKIT_MI_LCL_GEN_FILES) \
+                   $(INSTALL_KF_MI_LCL_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES)
        @:
 
 .PHONY: do_installhdrs_md
 
-do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_INC_GEN_FILES) $(INSTALL_KF_MD_FILES) $(INSTALL_KF_MD_GEN_FILES) \
-                  $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_LCL_GEN_FILES) $(INSTALL_KF_MD_LCL_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES)
+do_installhdrs_md: $(INSTALL_MD_INC_FILES) $(INSTALL_MD_INC_GEN_FILES) \
+                  $(INSTALL_DRIVERKIT_MD_INC_FILES) $(INSTALL_DRIVERKIT_MD_INC_GEN_FILES) \
+                  $(INSTALL_KF_MD_FILES) $(INSTALL_KF_MD_GEN_FILES) \
+                  $(INSTALL_MD_LCL_FILES) $(INSTALL_MD_LCL_GEN_FILES) \
+                  $(INSTALL_DRIVERKIT_MD_LCL_FILES) $(INSTALL_DRIVERKIT_MD_LCL_GEN_FILES) \
+                  $(INSTALL_KF_MD_LCL_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES)
        @:
 
 #
@@ -289,7 +360,7 @@ do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES)  $(EXPORT_MD_INC_FILES)
 # Compilation rules to generate .o from .s
 #
 
-S_RULE_0=@echo "$(ColorC)AS$(Color0)  $(ColorF)$@$(Color0)"
+S_RULE_0=$(call makelog,$(ColorC)AS$(Color0)  $(ColorF)$@$(Color0))
 S_RULE_1A=$(_v)${S_KCC} -c ${SFLAGS} -MD -MF $(@:o=d) -MP ${$@_SFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
 S_RULE_1B=$(<F)
 S_RULE_2=
@@ -297,38 +368,13 @@ S_RULE_2=
 #
 # Compilation rules to generate .o from .c for normal files
 #
-C_RULE_0=@echo "$(ColorC)CC$(Color0)  $(ColorF)$@$(Color0)"
+C_RULE_0=$(call makelog,$(ColorC)CC$(Color0)  $(ColorF)$@$(Color0))
 C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
 C_RULE_1B=$(<F)
-ifeq ($(BUILD_MACHO_OBJ),0)
-C_RULE_2=
-else ifeq ($(DO_CTFCONVERT),1)
-C_RULE_2=$(_v)if [ -z "${$@_SKIP_CTFCONVERT}" ]; then \
-                  ctferr=`${CTFCONVERT} -l xnu -v -o $@.ctf $@ 2>&1 > /dev/null || true`; \
-                  if [ ! -z "$${ctferr}" ]; then \
-                      echo "[$(CMD_MC)] $(ColorErr)$@$(Color0)  $(ColorErr)$${ctferr}$(Color0)"; \
-                  fi; \
-              fi
-else
 C_RULE_2=
-endif
-ifeq ($(DO_CTFMACHO), 1)
-C_CTFRULE_1A=$(_v)${KCC} -o $@.non_lto -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} $(CFLAGS_NOLTO_FLAG) ${$@_INCFLAGS}
-C_CTFRULE_1B=$(<F)
-C_CTFRULE_2=$(_v)if [ -z "${$@_SKIP_CTFCONVERT}" ]; then \
-                     ctferr=`${CTFCONVERT} -l xnu -v -o $@.non_lto.ctf $@.non_lto 2>&1 > /dev/null || true`; \
-                     if [ ! -z "$${ctferr}" ]; then \
-                         echo "[$(CMD_MC)] $(ColorErr)$@$(Color0)  $(ColorErr)$${ctferr}$(Color0)"; \
-                     fi; \
-                 fi
-else
-C_CTFRULE_1A=@true 
-C_CTFRULE_1B=
-C_CTFRULE_2=@true 
-endif
 
-C_RULE_3=@true 
-C_RULE_4A=@true 
+C_RULE_3=
+C_RULE_4A=
 C_RULE_4B=
 
 #
@@ -341,25 +387,18 @@ C_RULE_2_D=${C_RULE_2}
 C_RULE_3_D=${C_RULE_3}
 C_RULE_4A_D=${C_RULE_4A}
 C_RULE_4B_D=${C_RULE_4B}
-C_CTFRULE_1A_D=${C_CTFRULE_1A}
-C_CTFRULE_1B_D=${C_CTFRULE_1B}
-C_CTFRULE_2_D=${C_CTFRULE_2}
-C_CTFRULE_3_D=${C_CTFRULE_3}
 
 #
 # Compilation rules to generate .co from .cp or .cpo from .cpp
 #   The config tool slickly changes the last source filename char to 'o'
 #   for the object filename.
-P_RULE_0=@echo "$(ColorC)C++$(Color0) $(ColorF)$@$(Color0)"
+P_RULE_0=$(call makelog,$(ColorC)C++$(Color0) $(ColorF)$@$(Color0))
 P_RULE_1A=$(_v)${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CXXWARNFLAGS}} -MD -MF $(@:o=d) -MP ${$@_CFLAGS_ADD} ${$@_CXXWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS}
 P_RULE_1B=$(<F)
 P_RULE_2=
-P_CTFRULE_1A=@true 
-P_CTFRULE_1B=
-P_CTFRULE_2=@true 
 
-P_RULE_3=@true 
-P_RULE_4A=@true 
+P_RULE_3=
+P_RULE_4A=
 P_RULE_4B=
 
 #
@@ -401,12 +440,12 @@ INSTALL_MAN_DIR:
        $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)
 
 $(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % | INSTALL_MAN_DIR
-       @echo "$(ColorH)MAN$(Color0)        $(ColorF)$*$(Color0)"
+       $(call makelog,$(ColorH)MAN$(Color0)           $(ColorF)$*$(Color0))
        $(_v)$(INSTALL) $(INSTALL_FLAGS) $< $@
 
 define MAN_LINKS_RULE_template
 $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(2): $$(DSTROOT)/$$(MANDIR)/$$(INSTALL_MAN_DIR)/$(1)
-       @echo "$$(ColorH)MANLINK$$(Color0)    $$(ColorF)$(2)$$(Color0)"
+       $$(call makelog,$$(ColorH)MANLINK$$(Color0)       $$(ColorF)$(2)$$(Color0))
        $(_v)ln -f $$< $$@
 endef