X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/2d21ac55c334faf3a56e5634905ed6987fc787d4..cb3231590a3c94ab4375e2228bd5e86b0cf1ad7e:/osfmk/conf/Makefile.template diff --git a/osfmk/conf/Makefile.template b/osfmk/conf/Makefile.template index d3596adef..2db9fb566 100644 --- a/osfmk/conf/Makefile.template +++ b/osfmk/conf/Makefile.template @@ -5,16 +5,6 @@ # the terms and conditions for use and redistribution. # -# -# Export IDENT for sub-makefiles -# -export IDENT - -# -# XXX: INCFLAGS to include libsa prototypes -# -INCFLAGS_MAKEFILE= -I$(SOURCE)libsa - export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule @@ -26,23 +16,92 @@ include $(MakeInc_def) # # XXX: CFLAGS # -CFLAGS+= -imacros meta_features.h -DMACH_KERNEL_PRIVATE $(CFLAGS_INLINE_CONFIG) +CFLAGS+= -include meta_features.h -DMACH_KERNEL_PRIVATE -DMACH_KERNEL +SFLAGS+= -include meta_features.h + +# Objects that don't want -Wcast-align warning (8474835) +OBJS_NO_CAST_ALIGN = \ + atm_notification_user.o \ + model_dep.o \ + video_console.o \ + kdp_udp.o \ + kdp_machdep.o \ + host.o \ + processor.o \ + sched_prim.o \ + task.o \ + thread.o \ + threadinfo.o \ + gssd_mach.o \ + UNDRequest.o \ + panic_dialog.o \ + bsd_i386.o \ + commpage.o \ + cpu_threads.o \ + cpuid.o \ + locks_i386.o \ + locks_i386_opt.o \ + machine_task.o \ + mp_desc.o \ + pcb.o \ + pcb_native.o \ + kdp_x86_common.o \ + startup64.o \ + affinity.o \ + sched_grrr.o \ + sched_proto.o \ + stack.o \ + task_policy.o \ + wait_queue.o \ + bsd_kern.o \ + pmc.o \ + status.o \ + machine_routines.o \ + loose_ends.o \ + sleh.o \ + ccdigest_final_64be.o \ + ccdigest_init.o \ + ccdigest_update.o \ + cchmac_final.o \ + cchmac_init.o \ + ccsha1.o \ + ipc_object.o \ + ipc_kmsg.o \ + ipc_right.o + +# Objects that don't want -Wsign-compare warning (15294427) +OBJS_NO_SIGN_COMPARE = \ + atm_notification_user.o + +$(foreach file,$(OBJS_NO_CAST_ALIGN),$(eval $(call add_perfile_cflags,$(file),-Wno-cast-align))) +$(foreach file,$(OBJS_NO_SIGN_COMPARE),$(eval $(call add_perfile_cflags,$(file),-Wno-sign-compare))) + +ifeq ($(KSANCOV),1) +# Don't instrument functions called by the ksancov runtime. SanitizeCoverage does +# not support blacklists, so exclude the whole file. +machine_routines.o_CFLAGS_RM = $(KSANCOV_CFLAGS) +machine_routines_common.o_CFLAGS_RM = $(KSANCOV_CFLAGS) +pcb_native.o_CFLAGS_RM = $(KSANCOV_CFLAGS) +endif + +# +# XXX: INCFLAGS to include libsa prototypes +# +INCFLAGS_MAKEFILE= -I$(SOURCE)libsa # # Directories for mig generated files # COMP_SUBDIRS = \ + atm \ default_pager \ device \ - mach_debug \ mach \ UserNotification \ gssd \ + kextd \ lockd -COMP_SUBDIRS_I386 = \ - mach - # # Make sure we don't remove this by accident if interrupted at the wrong # time. @@ -61,56 +120,64 @@ COMP_SUBDIRS_I386 = \ %CFILES -%MFILES +%CXXFILES %SFILES -%BFILES - -%ORDERED %MACHDEP -# -# OBJSDEPS is the set of files (defined in the machine dependent -# template if necessary) which all objects depend on (such as an -# in-line assembler expansion filter) -# -${OBJS}: ${OBJSDEPS} - - -%LOAD - -LDOBJS = $(OBJS) - -$(COMPONENT).o: $(LDOBJS) assym.s +# Rebuild if per-file overrides change +${OBJS}: $(firstword $(MAKEFILE_LIST)) + +# Rebuild if global compile flags change +$(COBJS): .CFLAGS +.CFLAGS: ALWAYS + $(_v)$(REPLACECONTENTS) $@ $(KCC) $(CFLAGS) $(INCFLAGS) +$(CXXOBJS): .CXXFLAGS +.CXXFLAGS: ALWAYS + $(_v)$(REPLACECONTENTS) $@ $(KC++) $(CXXFLAGS) $(INCFLAGS) +$(SOBJS): .SFLAGS +.SFLAGS: ALWAYS + $(_v)$(REPLACECONTENTS) $@ $(S_KCC) $(SFLAGS) $(INCFLAGS) + +$(COMPONENT).filelist: $(OBJS) $(_v)for hib_file in ${HIB_FILES}; \ do \ - $(SEG_HACK) __HIB $${hib_file} -o $${hib_file}__; \ - mv $${hib_file}__ $${hib_file} ; \ - done; - @echo LD $(COMPONENT) - $(_v)$(LD) $(LDFLAGS_COMPONENT) -o $(COMPONENT).o ${LDOBJS} + $(SEG_HACK) -n __HIB -o $${hib_file}__ $${hib_file} || exit 1; \ + mv $${hib_file}__ $${hib_file} || exit 1; \ + done + $(call makelog,$(ColorL)LDFILELIST$(Color0) $(ColorLF)$(COMPONENT)$(Color0)) + $(_v)for obj in ${OBJS}; do \ + $(ECHO) $(TARGET)/$(CURRENT_KERNEL_CONFIG)/$${obj}; \ + done > $(COMPONENT).filelist -do_all: $(COMPONENT).o +do_all: $(COMPONENT).filelist -do_depend: do_all - $(_v)${MD} -u Makedep -f -d `ls *.d`; - -do_build_all: do_depend +do_build_all:: do_all # genassym.o actually is an assembly file, # we name it genassym.o to help with the automatic # dependency generation -genassym.o: $(SOURCE_DIR)/$(COMPONENT)/$(ARCH_CONFIG_LC)/genassym.c - $(_v)${KCC} ${CFLAGS} -MD ${_HOST_EXTRA_CFLAGS} -S -o ${@} -c ${INCFLAGS} $< +GENASSYM_LOCATION = $(CURRENT_ARCH_CONFIG_LC) + +ifeq ($(CURRENT_ARCH_CONFIG_LC),x86_64) +GENASSYM_LOCATION = i386 +else ifeq ($(CURRENT_ARCH_CONFIG_LC),x86_64h) +GENASSYM_LOCATION = i386 +endif + +-include genassym.d +genassym.o: .CFLAGS $(firstword $(MAKEFILE_LIST)) +genassym.o: $(SOURCE_DIR)/$(COMPONENT)/$(GENASSYM_LOCATION)/genassym.c + $(call makelog,[$(CMD_MC)] $(ColorH)GENASSYM$(Color0) $(ColorLF)$<$(Color0)) + $(_v)${GENASSYM_KCC} ${CFLAGS} ${CFLAGS_NOLTO_FLAG} -MD -S -o ${@} ${INCFLAGS} $< assym.s: genassym.o - $(_v)sed -e '/#DEFINITION#/!d' -e 's/^.*#DEFINITION#//' -e 's/\$$//' -e 'p' -e 's/#//2' -e 's/[^A-Za-z0-9_]*\([A-Za-z0-9_]*\)/ \1_NUM/2' genassym.o > ${@} + $(_v)sed -e '/^[[:space:]]*DEFINITION__define__/!d;{N;s/\n//;}' -e 's/^[[:space:]]*DEFINITION__define__\([^:]*\):.*ascii.*\"[\$$]*\([-0-9\#]*\)\".*$$/#define \1 \2/' -e 'p' -e 's/#//2' -e 's/^[[:space:]]*#define \([A-Za-z0-9_]*\)[[:space:]]*[\$$#]*\([-0-9]*\).*$$/#define \1_NUM \2/' genassym.o > $@ ${SOBJS}: assym.s - %RULES include $(MakeInc_rule)