X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8ad349bb6ed4a0be06e34c92be0d98b92e078db4..b0d623f7f2ae71ed96e60569f61f9a9a27016e80:/makedefs/MakeInc.rule diff --git a/makedefs/MakeInc.rule b/makedefs/MakeInc.rule index bfd896d29..618a7849f 100644 --- a/makedefs/MakeInc.rule +++ b/makedefs/MakeInc.rule @@ -50,11 +50,17 @@ ifndef INSTALL_KF_MD_GEN_LIST INSTALL_KF_MD_GEN_LIST = $(EXPORT_MD_GEN_LIST) endif +ifneq ($(MACHINE_CONFIG), DEFAULT) + OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG) +else + OBJPATH = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG) +endif + INSTALL_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_GEN_LIST)) $(INSTALL_MI_GEN_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/% : % - @true echo Installing $< in $(dir $@); \ - [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \ + @true echo Installing $< in $(dir $@) + $(_v)[ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \ filename=`$(BASENAME) $<`; \ filename_strip=$(addsuffix .strip,$${filename}); \ $(RM) $(RMFLAGS) $@; \ @@ -66,7 +72,7 @@ $(INSTALL_MI_GEN_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/% : % ./incmidir/$${filename_strip}; \ if [ -s ./incmidir/$${filename_strip} ]; \ then ( \ - install $(INSTALL_FLAGS) ./incmidir/$${filename} $(dir $@);\ + $(INSTALL) $(INSTALL_FLAGS) ./incmidir/$${filename} $(dir $@);\ ); \ else \ echo Header file $< not exported; \ @@ -75,8 +81,8 @@ $(INSTALL_MI_GEN_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR)/% : % INSTALL_KF_MI_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_GEN_LIST)) $(INSTALL_KF_MI_GEN_FILES): $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/% : % - @true echo Installing $< in $(midir $@); \ - [ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \ + @true echo Installing $< in $(midir $@) + $(_v)[ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \ filename=`$(BASENAME) $<`; \ filename_strip=$(addsuffix .strip,$${filename}); \ $(RM) $(RMFLAGS) $@; \ @@ -88,7 +94,7 @@ $(INSTALL_KF_MI_GEN_FILES): $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/% : % ./kincmidir/$${filename_strip}; \ if [ -s ./kincmidir/$${filename_strip} ]; \ then ( \ - install $(INSTALL_FLAGS) ./kincmidir/$${filename} $(dir $@);\ + $(INSTALL) $(INSTALL_FLAGS) ./kincmidir/$${filename} $(dir $@);\ ); \ else \ echo Header file $< not exported; \ @@ -97,8 +103,8 @@ $(INSTALL_KF_MI_GEN_FILES): $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR)/% : % INSTALL_MI_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/, $(INSTALL_MI_LCL_GEN_LIST)) $(INSTALL_MI_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/% : % - @true echo Installing $< in $(dir $@); \ - [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \ + @true echo Installing $< in $(dir $@) + $(_v)[ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \ filename=`$(BASENAME) $<`; \ filename_strip=$(addsuffix .strip,$${filename}); \ $(RM) $(RMFLAGS) $@; \ @@ -110,7 +116,7 @@ $(INSTALL_MI_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/% : % ./pincmidir/$${filename_strip}; \ if [ -s ./pincmidir/$${filename_strip} ]; \ then ( \ - install $(INSTALL_FLAGS) ./pincmidir/$${filename} $(dir $@);\ + $(INSTALL) $(INSTALL_FLAGS) ./pincmidir/$${filename} $(dir $@);\ ); \ else \ echo Header file $< not exported; \ @@ -119,8 +125,8 @@ $(INSTALL_MI_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR)/% : % INSTALL_KF_MI_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/, $(INSTALL_KF_MI_LCL_GEN_LIST)) $(INSTALL_KF_MI_LCL_GEN_FILES): $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/% : % - @true echo Installing $< in $(dir $@); \ - [ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \ + @true echo Installing $< in $(dir $@) + $(_v)[ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \ filename=`$(BASENAME) $<`; \ filename_strip=$(addsuffix .strip,$${filename}); \ $(RM) $(RMFLAGS) $@; \ @@ -132,7 +138,7 @@ $(INSTALL_KF_MI_LCL_GEN_FILES): $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/% : % ./kpincmidir/$${filename_strip}; \ if [ -s ./kpincmidir/$${filename_strip} ]; \ then ( \ - install $(INSTALL_FLAGS) ./kpincmidir/$${filename} $(dir $@);\ + $(INSTALL) $(INSTALL_FLAGS) ./kpincmidir/$${filename} $(dir $@);\ ); \ else \ echo Header file $< not exported; \ @@ -141,8 +147,8 @@ $(INSTALL_KF_MI_LCL_GEN_FILES): $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR)/% : % INSTALL_MD_GEN_INC_FILES = $(addprefix $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_GEN_LIST)) $(INSTALL_MD_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/% : % - @true echo Installing $< in $(dir $@); \ - [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \ + @true echo Installing $< in $(dir $@) + $(_v)[ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \ filename=`$(BASENAME) $<`; \ filename_strip=$(addsuffix .strip,$${filename}); \ $(RM) $(RMFLAGS) $@; \ @@ -154,7 +160,7 @@ $(INSTALL_MD_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/% : % ./incdir/$${filename_strip}; \ if [ -s ./incdir/$${filename_strip} ]; \ then ( \ - install $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\ + $(INSTALL) $(INSTALL_FLAGS) ./incdir/$${filename} $(dir $@);\ ); \ else \ echo Header file $< not exported; \ @@ -163,8 +169,8 @@ $(INSTALL_MD_GEN_INC_FILES): $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR)/% : % INSTALL_KF_MD_GEN_FILES = $(addprefix $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_GEN_LIST)) $(INSTALL_KF_MD_GEN_FILES): $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/% : % - @true echo Installing $< in $(dir $@); \ - [ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \ + @true echo Installing $< in $(dir $@) + $(_v)[ -d $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \ filename=`$(BASENAME) $<`; \ filename_strip=$(addsuffix .strip,$${filename}); \ $(RM) $(RMFLAGS) $@; \ @@ -176,7 +182,7 @@ $(INSTALL_KF_MD_GEN_FILES): $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR)/% : % ./kincdir/$${filename_strip}; \ if [ -s ./kincdir/$${filename_strip} ]; \ then ( \ - install $(INSTALL_FLAGS) ./kincdir/$${filename} $(dir $@);\ + $(INSTALL) $(INSTALL_FLAGS) ./kincdir/$${filename} $(dir $@);\ ); \ else \ echo Header file $< not exported; \ @@ -186,8 +192,8 @@ INSTALL_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_MD_LCL_LIST)) INSTALL_MD_GEN_LCL_FILES = $(addprefix $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/, $(INSTALL_MD_LCL_GEN_LIST)) $(INSTALL_MD_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/% : % - @true echo Installing $< in $(dir $@); \ - [ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \ + @true echo Installing $< in $(dir $@) + $(_v)[ -d $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \ filename=`$(BASENAME) $<`; \ filename_strip=$(addsuffix .strip,$${filename}); \ $(RM) $(RMFLAGS) $@; \ @@ -199,7 +205,7 @@ $(INSTALL_MD_GEN_LCL_FILES): $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR)/% : % ./pincdir/$${filename_strip}; \ if [ -s ./pincdir/$${filename_strip} ]; \ then ( \ - install $(INSTALL_FLAGS) ./pincdir/$${filename} $(dir $@);\ + $(INSTALL) $(INSTALL_FLAGS) ./pincdir/$${filename} $(dir $@);\ ); \ else \ echo Header file $< not exported; \ @@ -209,8 +215,8 @@ INSTALL_KF_MD_LCL_FILES = $(addprefix $(SOURCE), $(INSTALL_KF_MD_LCL_LIST)) INSTALL_KF_MD_LCL_GEN_FILES = $(addprefix $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/, $(INSTALL_KF_MD_LCL_GEN_LIST)) $(INSTALL_KF_MD_LCL_GEN_FILES): $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/% : % - @true echo Installing $< in $(dir $@); \ - [ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \ + @true echo Installing $< in $(dir $@) + $(_v)[ -d $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \ filename=`$(BASENAME) $<`; \ filename_strip=$(addsuffix .strip,$${filename}); \ $(RM) $(RMFLAGS) $@; \ @@ -222,18 +228,17 @@ $(INSTALL_KF_MD_LCL_GEN_FILES): $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR)/% : % ./kpincdir/$${filename_strip}; \ if [ -s ./kpincdir/$${filename_strip} ]; \ then ( \ - install $(INSTALL_FLAGS) ./kpincdir/$${filename} $(dir $@);\ + $(INSTALL) $(INSTALL_FLAGS) ./kpincdir/$${filename} $(dir $@);\ ); \ else \ echo Header file $< not exported; \ fi; setup_installhdrs_mi: - @echo "[ $(SOURCE) ] make setup_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" do_installhdrs_mi: $(INSTALL_MI_GEN_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL_KF_MI_GEN_FILES) $(INSTALL_KF_MI_LCL_GEN_FILES) - @true echo "[ $(SOURCE) ] make do_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \ - $(MKDIR) ./incmidir ./pincmidir ./kincmidir ./kpincmidir; \ + @true echo "[ $(SOURCE) ] make do_installhdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" + $(_v)$(MKDIR) ./incmidir ./pincmidir ./kincmidir ./kpincmidir; \ if [ -n "$(strip $(INSTALL_MI_LIST))" ]; then \ if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR) ]; then \ (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR);$(RM) $(RMFLAGS) $(INSTALL_MI_LIST) ); \ @@ -249,7 +254,7 @@ do_installhdrs_mi: $(INSTALL_MI_GEN_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL ./incmidir/$$j.strip; \ if [ -s ./incmidir/$$j.strip ]; \ then ( \ - install $(INSTALL_FLAGS) ./incmidir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \ + $(INSTALL) $(INSTALL_FLAGS) ./incmidir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MI_DIR); \ ); \ else \ echo Header file $$j not exported; \ @@ -271,7 +276,7 @@ do_installhdrs_mi: $(INSTALL_MI_GEN_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL ./pincmidir/$$j.strip; \ if [ -s ./pincmidir/$$j.strip ]; \ then ( \ - install $(INSTALL_FLAGS) ./pincmidir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \ + $(INSTALL) $(INSTALL_FLAGS) ./pincmidir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MI_DIR); \ ); \ else \ echo Header file $$j not exported; \ @@ -293,7 +298,7 @@ do_installhdrs_mi: $(INSTALL_MI_GEN_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL ./kincmidir/$$j.strip; \ if [ -s ./kincmidir/$$j.strip ]; \ then ( \ - install $(INSTALL_FLAGS) ./kincmidir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \ + $(INSTALL) $(INSTALL_FLAGS) ./kincmidir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MI_DIR); \ ); \ else \ echo Header file $$j not exported; \ @@ -315,7 +320,7 @@ do_installhdrs_mi: $(INSTALL_MI_GEN_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL ./kpincmidir/$$j.strip; \ if [ -s ./kpincmidir/$$j.strip ]; \ then ( \ - install $(INSTALL_FLAGS) ./kpincmidir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \ + $(INSTALL) $(INSTALL_FLAGS) ./kpincmidir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MI_DIR); \ ); \ else \ echo Header file $$j not exported; \ @@ -325,11 +330,10 @@ do_installhdrs_mi: $(INSTALL_MI_GEN_FILES) $(INSTALL_MI_GEN_LCL_FILES) $(INSTALL $(RM) -rf ./incmidir ./pincmidir ./kincmidir ./kpincmidir; setup_installhdrs_md: - @echo "[ $(SOURCE) ] make setup_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" do_installhdrs_md: $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_GEN_LCL_FILES) $(INSTALL_KF_MD_GEN_FILES) $(INSTALL_KF_MD_LCL_GEN_FILES) - @true echo "[ $(SOURCE) ] make do_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)"; \ - $(MKDIR) ./incdir ./pincdir ./kincdir ./kpincdir; \ + @true echo "[ $(SOURCE) ] make do_installhdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" + $(_v)$(MKDIR) ./incdir ./pincdir ./kincdir ./kpincdir; \ if [ -n "$(strip $(INSTALL_MD_LIST))" ]; then \ if [ -d $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR) ]; then \ (cd $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR);$(RM) $(RMFLAGS) $(INSTALL_MD_LIST) ); \ @@ -345,7 +349,7 @@ do_installhdrs_md: $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_GEN_LCL_FILES) $(INS ./incdir/$$j.strip; \ if [ -s ./incdir/$$j.strip ]; \ then ( \ - install $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \ + $(INSTALL) $(INSTALL_FLAGS) ./incdir/$$j $(DSTROOT)/$(INCDIR)/$(INSTALL_MD_DIR); \ ); \ else \ echo Header file $$j not exported; \ @@ -367,7 +371,7 @@ do_installhdrs_md: $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_GEN_LCL_FILES) $(INS ./pincdir/$$j.strip; \ if [ -s ./pincdir/$$j.strip ]; \ then ( \ - install $(INSTALL_FLAGS) ./pincdir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \ + $(INSTALL) $(INSTALL_FLAGS) ./pincdir/$$j $(DSTROOT)/$(LCLDIR)/$(INSTALL_MD_DIR); \ ); \ else \ echo Header file $$j not exported; \ @@ -389,7 +393,7 @@ do_installhdrs_md: $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_GEN_LCL_FILES) $(INS ./kincdir/$$j.strip; \ if [ -s ./kincdir/$$j.strip ]; \ then ( \ - install $(INSTALL_FLAGS) ./kincdir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \ + $(INSTALL) $(INSTALL_FLAGS) ./kincdir/$$j $(DSTROOT)/$(KINCDIR)/$(EXPORT_MD_DIR); \ ); \ else \ echo Header file $$j not exported; \ @@ -411,7 +415,7 @@ do_installhdrs_md: $(INSTALL_MD_GEN_INC_FILES) $(INSTALL_MD_GEN_LCL_FILES) $(INS ./kpincdir/$$j.strip; \ if [ -s ./kpincdir/$$j.strip ]; \ then ( \ - install $(INSTALL_FLAGS) ./kpincdir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \ + $(INSTALL) $(INSTALL_FLAGS) ./kpincdir/$$j $(DSTROOT)/$(KPINCDIR)/$(EXPORT_MD_DIR); \ ); \ else \ echo Header file $$j not exported; \ @@ -430,8 +434,8 @@ EXPORT_MI_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPO EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST)) $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % - @true echo Exporting $< in $(dir $@); \ - [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \ + @true echo Exporting $< in $(dir $@) + $(_v)[ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \ ${CP} -p $< $(dir $@); \ @@ -439,18 +443,16 @@ EXPORT_MD_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPO EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST)) $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % - @true echo Exporting $< in $(dir $@); \ - [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \ + @true echo Exporting $< in $(dir $@) + $(_v)[ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \ ${CP} -p $< $(dir $@); \ setup_exporthdrs_mi: - @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" do_exporthdrs_mi: $(EXPORT_MI_INC_FILES) $(EXPORT_MI_GEN_INC_FILES) @true echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" setup_exporthdrs_md: - @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" do_exporthdrs_md: $(EXPORT_MD_INC_FILES) $(EXPORT_MD_GEN_INC_FILES) @true echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" @@ -461,8 +463,8 @@ EXPORT_MI_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MI_LIST)) EXPORT_MI_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/, $(EXPORT_MI_GEN_LIST)) $(EXPORT_MI_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR)/% : % - @true echo Exporting $< in $(dir $@); \ - [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \ + @true echo Exporting $< in $(dir $@) + $(_v)[ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR); \ ${CP} -p $< $(dir $@); \ @@ -470,16 +472,15 @@ EXPORT_MD_INC_FILES = $(addprefix $(SOURCE), $(EXPORT_MD_LIST)) EXPORT_MD_GEN_INC_FILES = $(addprefix $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/, $(EXPORT_MD_GEN_LIST)) $(EXPORT_MD_GEN_INC_FILES): $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR)/% : % - @true echo Exporting $< in $(dir $@); \ - [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \ + @true echo Exporting $< in $(dir $@) + $(_v)[ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ] ||$(MKDIR) $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR); \ ${CP} -p $< $(dir $@); \ setup_exporthdrs_mi: - @echo "[ $(SOURCE) ] make setup_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) @true echo "[ $(SOURCE) ] make do_exporthdrs_mi $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" - @if [ -n "$(strip $(EXPORT_MI_LIST))" ]; then \ + $(_v)if [ -n "$(strip $(EXPORT_MI_LIST))" ]; then \ if [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR) ]; then \ (cd $(OBJROOT)/$(EXPDIR)/$(EXPORT_MI_DIR);$(RM) $(RMFLAGS) $(EXPORT_MI_LIST) ); \ else \ @@ -489,11 +490,10 @@ do_exporthdrs_mi: $(EXPORT_MI_GEN_INC_FILES) fi setup_exporthdrs_md: - @echo "[ $(SOURCE) ] make setup_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" do_exporthdrs_md: $(EXPORT_MD_GEN_INC_FILES) @true echo "[ $(SOURCE) ] make do_exporthdrs_md $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" - @if [ -n "$(strip $(EXPORT_MD_LIST))" ]; then \ + $(_v)if [ -n "$(strip $(EXPORT_MD_LIST))" ]; then \ if [ -d $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR) ]; then \ (cd $(OBJROOT)/$(EXPDIR)/$(EXPORT_MD_DIR);$(RM) $(RMFLAGS) $(EXPORT_MD_LIST) ); \ else \ @@ -512,37 +512,22 @@ endif # # Compilation rules to generate .o from .s # -COMP_SOBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_SOBJ_LIST)) - -$(COMP_SOBJ_FILES): $(TARGET)$(COMP_OBJ_DIR)%.o : %.s - ${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< > $(patsubst %.o, %.pp, ${@}); - sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@}); - ${S_KCC} ${SFLAGS} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@}); - ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@}); - -S_RULE_1A=@ls / -S_RULE_1B= ${patsubst %.o,%.s,${@}} > /dev/null -S_RULE_2= ${S_KCC} -E -MD ${SFLAGS} -DASSEMBLER $(INCFLAGS) $< \ - > $(patsubst %.o, %.pp, ${@}); \ - sed '/^\#/d' $(patsubst %.o, %.pp, ${@}) > $(patsubst %.o, %.s, ${@}); -S_RULE_3= ${S_KCC} ${SFLAGS} ${_HOST_AS_FLAGS} -c $(patsubst %.o, %.s, ${@});\ - ${RM} ${_RMFLAGS_} $(patsubst %.o, %.pp, ${@}) $(patsubst %.o,%.s,${@}) -# -# Compilation rules to generate .o from .c -# -COMP_COBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(COMP_COBJ_LIST)) - -$(COMP_COBJ_FILES): $(TARGET)$(COMP_OBJ_DIR)%.o : %.c - ${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}} $< +S_RULE_1A=$(_v)${S_KCC} -c -MD ${SFLAGS} -DASSEMBLER ${INCFLAGS} ${$@_INCFLAGS} +S_RULE_1B=$*.s +S_RULE_2=@echo AS $@ +S_RULE_3= # # Compilation rules to generate .o from .c for normal files -# -C_RULE_1A=${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${CWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}} +C_RULE_1A=$(_v)${KCC} -c ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CWARNFLAGS}} -MD ${$@_CFLAGS_ADD} ${$@_CWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} C_RULE_1B=$*.c -C_RULE_2= +C_RULE_2=@echo CC $@ +ifeq ($(BUILD_STABS),1) C_RULE_3= +else +C_RULE_3=$(_v)${CTFCONVERT} -l xnu -v -o $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf $@ > /dev/null && $(CTFSCRUB) `cat $(SRCROOT)/config/DtraceIgnored.symbols` $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf || true; +endif C_RULE_4= # @@ -554,117 +539,206 @@ C_RULE_2_D=${C_RULE_2} C_RULE_3_D=${C_RULE_3} C_RULE_4_D=${C_RULE_4} -# -# Compilation rules to generate .o from .m -# -M_RULE_1A=${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${MWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}} -M_RULE_1B=$*.m -M_RULE_2= -M_RULE_3= -M_RULE_4= - # # 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_1A=${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS} ${CXXWARNFLAGS}} -MD ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}} +P_RULE_1A=$(_v)${KC++} -o $@ -c ${CXXFLAGS} ${filter-out ${$@_CFLAGS_RM}, ${CFLAGS} ${CXXWARNFLAGS}} -MD ${$@_CFLAGS_ADD} ${$@_CXXWARNFLAGS_ADD} ${INCFLAGS} ${$@_INCFLAGS} P_RULE_1B=$( $(@:.cpo=.d~) && mv $(@:.cpo=.d~) $(@:.cpo=.d) -P_RULE_3= +P_RULE_2=$(_v)sed 's/.c.o: /.cpo: /' $(@:.cpo=.d) > $(@:.cpo=.d~) && mv $(@:.cpo=.d~) $(@:.cpo=.d) +P_RULE_3=@echo C++ $@ +ifeq ($(BUILD_STABS),1) P_RULE_4= +else +P_RULE_4=$(_v)${CTFCONVERT} -l xnu -v -o $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf $@ > /dev/null && $(CTFSCRUB) `cat $(SRCROOT)/config/DtraceIgnored.symbols` $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$@.ctf || true; +endif -# -# Linker rule to generate a component -# -LD_COMPONENT_OBJ_FILES = $(addprefix $(TARGET)$(COMP_OBJ_DIR), $(LD_COMPONENT_OBJ_LIST)) - -COMPONENT_IMAGE_FILE = $(addprefix $(TARGET), $(COMPONENT_IMAGE)) - -$(COMPONENT_IMAGE_FILE): $(LD_COMPONENT_OBJ_FILES) - @echo "[ creating $(COMPONENT_IMAGE) ]" - $(LD) $(LDFLAGS_COMPONENT) -o $(COMPONENT_IMAGE_FILE) ${LD_COMPONENT_OBJ_FILES}; - (cd $(TARGET)$(COMP_OBJ_DIR); ${MD} -u Makedep -f -d `ls *.d`); setup_build_all: - @echo "[ $(SOURCE) ] make setup_build_all $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" do_build_all: $(COMP_FILES) $(COMP_COBJ_FILES) $(COMP_SOBJ_FILES) $(COMPONENT_IMAGE_FILE) - @true echo "[ $(SOURCE) ] make do_build_all $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" - -ifeq ($(COMPONENT), .) -do_build_all: do_build_mach_kernel -endif # # mach_kernel building rules # -do_build_mach_kernel: $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/kgmacros - @echo "[ building mach_kernel ]"; - @install $(DATA_INSTALL_FLAGS) $(SRCROOT)/config/version.c $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.c; - @$(SRCROOT)/config/newvers.pl $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.c; - ${KCC} -c ${filter-out ${${join $@,_CFLAGS_RM}}, ${CFLAGS}} ${${join $@,_CFLAGS_ADD}} ${INCFLAGS} ${${join $@,_INCFLAGS}} $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.c -o $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.o - $(LD) $(LDFLAGS_KERNEL) $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST), $(addprefix $(component)/$(firstword $($(addsuffix _KERNEL_CONFIG, $(shell echo -n $(component) | tr a-z A-Z))) $(KERNEL_CONFIG))/, $(addsuffix .o, $(component))))) $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/version.o -o $(TARGET)/mach_kernel.sys $(LD_KERNEL_LIBS); \ - $(STRIP) $(STRIP_FLAGS) $(TARGET)/mach_kernel.sys -o $(TARGET)/mach_kernel; +ifeq ($(COMPONENT), .) +do_build_all: do_build_mach_kernel -$(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/kgmacros: $(SRCROOT)/kgmacros - cp $? $@ +STATIC_KMODS = $(SRCROOT)/kmods.a -# -# Generic Install rules -# -INSTALL_FILE_FILES = $(addprefix $(DSTROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST)) +do_build_mach_kernel: $(TARGET)/kgmacros $(TARGET)/mach_kernel -force_file_install: +$(TARGET)/mach_kernel: $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST), $(addprefix $(component)/$(firstword $($(addsuffix _KERNEL_CONFIG, $(shell printf $(component) | tr a-z A-Z))) $(KERNEL_CONFIG))/, $(addsuffix .o, $(component))))) lastkernelconstructor.o + $(_v)${MAKE} version.o + @echo LD mach_kernel.sys + $(_v)$(CAT) $(addprefix $(TARGET)/,$(foreach component,$(COMPONENT_LIST), $(addprefix $(component)/$(firstword $($(addsuffix _KERNEL_CONFIG, $(shell printf $(component) | tr a-z A-Z))) $(KERNEL_CONFIG))/, $(addsuffix .o, $(component))))) > mach_kernel.filelist + $(_v)$(LD) $(LDFLAGS_KERNEL) -filelist mach_kernel.filelist version.o lastkernelconstructor.o `if [ -e $(STATIC_KMODS) ]; then echo $(STATIC_KMODS); fi` \ + -o $(TARGET)/mach_kernel.sys $(LD_KERNEL_LIBS) + @echo DSYMUTIL mach_kernel.sys + $(_v)if [ $(BUILD_DWARF) -eq 1 ]; then \ + $(DSYMUTIL) $(DSYMUTIL_FLAGS) $(TARGET)/mach_kernel.sys -o $(TARGET)/mach_kernel.sys.dSYM > /dev/null; \ + fi; + @echo STRIP mach_kernel + $(_v)$(STRIP) $(STRIP_FLAGS) $(TARGET)/mach_kernel.sys -o $(TARGET)/mach_kernel + @echo CTFMERGE mach_kernel + $(_v)if [ $(BUILD_DWARF) -eq 1 ]; then \ + $(FIND) $(OBJPATH)/ -name \*.ctf -size 0 \ + -exec $(RM) -rf {} \; ; \ + $(CTFMERGE) -l xnu -o $(TARGET)/mach_kernel \ + $(OBJPATH)/*/$(KERNEL_CONFIG)/*.*o.ctf || true; \ + fi; \ + +version.o: $(OBJPATH)/version.c + ${C_RULE_1A}$< + ${C_RULE_2} + ${C_RULE_4} -$(INSTALL_FILE_FILES): $(DSTROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/% force_file_install +.PHONY: $(OBJPATH)/version.c +$(OBJPATH)/version.c: $(SRCROOT)/config/version.c $(NEWVERS) $(SRCROOT)/config/MasterVersion + $(_v)$(CP) $< $@ + $(_v)$(NEWVERS) $(OBJPATH)/version.c > /dev/null; + +lastkernelconstructor.o: $(SRCROOT)/libsa/lastkernelconstructor.c + ${C_RULE_1A}$< + ${C_RULE_2} + ${C_RULE_4} + +$(TARGET)/kgmacros: $(SRCROOT)/kgmacros + $(_v)$(INSTALL) $(INSTALL_FLAGS) $? $@ + +# Special rules to install machine configuration variants + +$(DSTROOT)$(INSTALL_FILE_DIR)mach.$(KERNEL_CONFIG_LC).$(MACHINE_CONFIG_LC): $(TARGET)/mach_kernel force_file_install @echo Installing $< in $@; - @if [ ! -e $(DSTROOT)$(INSTALL_FILE_DIR) ]; then \ + $(_v)if [ ! -e $(DSTROOT)$(INSTALL_FILE_DIR) ]; then \ $(MKDIR) $(DSTROOT)$(INSTALL_FILE_DIR); \ fi; \ if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \ $(RM) $(RMFLAGS) $@; \ - install $(FILE_INSTALL_FLAGS) $< $(dir $@); \ + $(INSTALL) $(FILE_INSTALL_FLAGS) $< $@; \ + else \ + if [ ! -e $@ ]; then \ + print "" >empty_file_$(notdir $@); \ + lipo_arg="$(foreach lipo_arch,$(INSTALL_ARCHS),$(ARCH_FLAGS_$(lipo_arch)) empty_file_$(notdir $@))"; \ + $(LIPO) $${lipo_arg} -create -output $@; \ + $(RM) $(RMFLAGS) empty_file_$(notdir $@); \ + fi; \ + $(LIPO) $@ -replace $(subst -arch,,$(ARCH_FLAGS_$(ARCH_CONFIG))) $< -o $@; \ + fi + +$(SYMROOT)$(INSTALL_FILE_DIR)mach.$(KERNEL_CONFIG_LC).$(MACHINE_CONFIG_LC): $(TARGET)/mach_kernel.sys force_file_install + @echo Installing $< in $@; + $(_v)if [ ! -e $(SYMROOT)$(INSTALL_FILE_DIR) ]; then \ + $(MKDIR) $(SYMROOT)$(INSTALL_FILE_DIR); \ + fi; \ + if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \ + $(RM) $(RMFLAGS) $@; \ + $(INSTALL) $(FILE_INSTALL_FLAGS) $< $@; \ + if [ $(BUILD_DWARF) -eq 1 ]; then \ + $(RM) -rf $@.dSYM; \ + $(MKDIR) -p -m 0755 $@.dSYM/$(DSYMBUILDDIR); \ + $(INSTALL) $(INSTALL_FLAGS) \ + $<.dSYM/$(DSYMBUILDDIR)/$(notdir $<) \ + $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \ + fi; \ else \ if [ ! -e $@ ]; then \ - echo >empty_file_$(notdir $@); \ - lipo_arg="$(subst _empty_file, empty_file_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \ + printf "" >empty_file_$(notdir $@); \ + lipo_arg="$(foreach lipo_arch,$(INSTALL_ARCHS),$(ARCH_FLAGS_$(lipo_arch)) empty_file_$(notdir $@))"; \ $(LIPO) $${lipo_arg} -create -output $@; \ $(RM) $(RMFLAGS) empty_file_$(notdir $@); \ fi; \ - $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \ + $(LIPO) $@ -replace $(subst -arch,,$(ARCH_FLAGS_$(ARCH_CONFIG))) $< -o $@; \ + fi + +endif # mach_kernel-specific build rules + +# +# Generic Install rules +# +INSTALL_FILE_FILES = $(addprefix $(DSTROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST)) +INSTALL_FILE_FILES_GENERIC = $(filter-out $(DSTROOT)$(INSTALL_FILE_DIR)mach.$(KERNEL_CONFIG_LC).$(MACHINE_CONFIG_LC), $(INSTALL_FILE_FILES)) + +force_file_install: + +$(INSTALL_FILE_FILES_GENERIC): $(DSTROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/% force_file_install + @echo Installing $< in $@; + $(_v)if [ ! -e $(DSTROOT)$(INSTALL_FILE_DIR) ]; then \ + $(MKDIR) $(DSTROOT)$(INSTALL_FILE_DIR); \ + fi; \ + if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \ + $(RM) $(RMFLAGS) $@; \ + $(INSTALL) $(FILE_INSTALL_FLAGS) $< $@; \ + else \ + if [ ! -e $@ ]; then \ + printf "" >empty_file_$(notdir $@); \ + lipo_arg="$(foreach lipo_arch,$(INSTALL_ARCHS),$(ARCH_FLAGS_$(lipo_arch)) empty_file_$(notdir $@))"; \ + $(LIPO) $${lipo_arg} -create -output $@; \ + $(RM) $(RMFLAGS) empty_file_$(notdir $@); \ + fi; \ + $(LIPO) $@ -replace $(subst -arch,,$(ARCH_FLAGS_$(ARCH_CONFIG))) $< -o $@; \ fi INSTALL_FILESYS_FILES = $(addprefix $(SYMROOT)$(INSTALL_FILE_DIR), $(INSTALL_FILE_LIST)) +INSTALL_FILESYS_FILES_GENERIC = $(filter-out $(SYMROOT)$(INSTALL_FILE_DIR)mach.$(KERNEL_CONFIG_LC).$(MACHINE_CONFIG_LC), $(INSTALL_FILESYS_FILES)) force_filesys_install: -$(INSTALL_FILESYS_FILES): $(SYMROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/%.sys force_filesys_install +$(INSTALL_FILESYS_FILES_GENERIC): $(SYMROOT)$(INSTALL_FILE_DIR)% : $(TARGET)/%.sys force_filesys_install @echo Installing $< in $@; - @if [ ! -e $(SYMROOT)$(INSTALL_FILE_DIR) ]; then \ + $(_v)if [ ! -e $(SYMROOT)$(INSTALL_FILE_DIR) ]; then \ $(MKDIR) $(SYMROOT)$(INSTALL_FILE_DIR); \ fi; \ if [ "`echo $(INSTALL_ARCHS_LC) | wc -w`" -eq 1 ]; then \ $(RM) $(RMFLAGS) $@; \ - install $(INSTALL_FLAGS) $< $(dir $@); \ + $(INSTALL) $(INSTALL_FLAGS) $< $@; \ + if [ $(BUILD_DWARF) -eq 1 ]; then \ + $(DSYMUTIL) $(DSYMUTIL_FLAGS) \ + $(TARGET)/mach_kernel.sys \ + -o $(TARGET)/mach_kernel.sys.dSYM; \ + $(RM) -rf $@.dSYM; \ + $(MKDIR) -p -m 0755 $@.dSYM/$(DSYMBUILDDIR); \ + $(INSTALL) $(INSTALL_FLAGS) \ + $<.dSYM/$(DSYMBUILDDIR)/$(notdir $<) \ + $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \ + fi; \ else \ if [ ! -e $@ ]; then \ - echo >empty_filesys_$(notdir $@); \ - lipo_arg="$(subst _empty_file, empty_filesys_$(notdir $@),$(foreach lipo_arch,$(INSTALL_ARCHS_LC), $(addprefix -arch , $(addsuffix _empty_file, $(lipo_arch)))))"; \ + printf "" >empty_filesys_$(notdir $@); \ + lipo_arg="$(foreach lipo_arch,$(INSTALL_ARCHS),$(ARCH_FLAGS_$(lipo_arch)) empty_filesys_$(notdir $@))"; \ $(LIPO) $${lipo_arg} -create -output $@; \ - $(RM) $(RMFLAGS) empty_filesys_$(notdir $@); \ + $(RM) $(RMFLAGS) empty_filesys_$(notdir $@); \ fi; \ - $(LIPO) $@ -replace $(ARCH_CONFIG_LC) $< -o $@; \ + $(LIPO) $@ -replace $(subst -arch,,$(ARCH_FLAGS_$(ARCH_CONFIG))) $< -o $@; \ + \ + if [ $(BUILD_DWARF) -eq 1 ]; then \ + if [ ! -e $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@) ]; then \ + printf "" >empty_filesys_$(notdir $@); \ + lipo_arg="$(foreach lipo_arch,$(INSTALL_ARCHS),$(ARCH_FLAGS_$(lipo_arch)) empty_filesys_$(notdir $@))"; \ + $(MKDIR) -p -m 0755 $@.dSYM/$(DSYMBUILDDIR); \ + $(LIPO) $${lipo_arg} -create \ + -output \ + $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \ + $(RM) $(RMFLAGS) empty_filesys_$(notdir $@); \ + fi; \ + $(DSYMUTIL) $(DSYMUTIL_FLAGS) \ + $(TARGET)/mach_kernel.sys \ + -o $(TARGET)/mach_kernel.sys.dSYM; \ + $(LIPO) $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@) \ + -replace $(subst -arch,,$(ARCH_FLAGS_$(ARCH_CONFIG))) \ + $<.dSYM/$(DSYMBUILDDIR)/$(notdir $<) \ + -o $@.dSYM/$(DSYMBUILDDIR)/$(notdir $@); \ + fi; \ fi - cp $(SOURCE)kgmacros $(SYMROOT)$(INSTALL_FILE_DIR) + $(INSTALL) $(INSTALL_FLAGS) $(SOURCE)kgmacros $(SYMROOT)$(INSTALL_FILE_DIR) INSTALL_DATA_FILES = $(addprefix $(DSTROOT)$(INSTALL_DATA_DIR), $(INSTALL_DATA_LIST)) $(INSTALL_DATA_FILES): $(DSTROOT)$(INSTALL_DATA_DIR)% : $(SOURCE)/% @echo Installing $< in $@; - @[ -d $(dir $@) ] ||$(MKDIR) $(dir $@); \ + $(_v)[ -d $(dir $@) ] ||$(MKDIR) $(dir $@); \ $(RM) $(RMFLAGS) $@; \ - install $(DATA_INSTALL_FLAGS) $< $(dir $@); + $(INSTALL) $(DATA_INSTALL_FLAGS) $< $(dir $@); setup_build_install: @echo "[ $(SOURCE) ] make setup_build_install $(KERNEL_CONFIG) $(ARCH_CONFIG) $(TARGET)" @@ -676,18 +750,16 @@ INSTALL_MAN_FILES = $(addprefix $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/, $(INST do_installman: $(INSTALL_MAN_FILES) @echo "[ $(SOURCE) ] make do_installman" - @if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \ + $(_v)if [ -n "$(strip $(INSTALL_MAN_LIST))" ]; then \ man_dir=$(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \ if [ -d $$man_dir ]; then \ - cur_dir=`pwd`; \ - cd $$man_dir; \ - $(RM) $(RMFLAGS) $(INSTALL_MAN_LIST) $(INSTALL_MAN_LINKS); \ - cd $$cur_dir; \ + ( cd $$man_dir; \ + $(RM) $(RMFLAGS) $(INSTALL_MAN_LIST) $(INSTALL_MAN_LINKS)); \ else \ $(MKDIR) $$man_dir; \ fi; \ echo Installing $(INSTALL_MAN_LIST) in $$man_dir; \ - install $(INSTALL_FLAGS) $(INSTALL_MAN_LIST) $$man_dir; \ + $(INSTALL) $(INSTALL_FLAGS) $(INSTALL_MAN_LIST) $$man_dir; \ if [ -n "$(strip $(INSTALL_MAN_LINKS))" ]; then \ set `echo ${INSTALL_MAN_LINKS}`; \ while : ; do \ @@ -703,12 +775,16 @@ do_installman: $(INSTALL_MAN_FILES) fi $(INSTALL_MAN_FILES): $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR)/% : % - @true echo Installing $< in $(dir $@); \ - $(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \ + @true echo Installing $< in $(dir $@) + $(_v)$(MKDIR) $(DSTROOT)/$(MANDIR)/$(INSTALL_MAN_DIR); \ $(RM) $(RMFLAGS) $@; \ - install $(INSTALL_FLAGS) $< $(dir $@); + $(INSTALL) $(INSTALL_FLAGS) $< $(dir $@); ifeq ($(INCL_MAKEDEP), TRUE) -include Makedep endif +help: + @cat README + +# vim: set ft=make: