X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/2d21ac55c334faf3a56e5634905ed6987fc787d4..c910b4d9d2451126ae3917b931cd4390c11e1d52:/libkern/kmod/Makefile.kmod?ds=sidebyside diff --git a/libkern/kmod/Makefile.kmod b/libkern/kmod/Makefile.kmod index fcc97f211..bab4de575 100644 --- a/libkern/kmod/Makefile.kmod +++ b/libkern/kmod/Makefile.kmod @@ -7,7 +7,6 @@ export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir - include $(MakeInc_cmd) include $(MakeInc_def) @@ -28,7 +27,6 @@ COMPOBJROOT = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT)/kmod INSTOBJROOT = $(OBJROOT)/$(INSTALL_TYPE)_$(ARCH_CONFIG)/$(COMPONENT)/kmod endif - KMOD_CFILES = c_start.c c_stop.c KMODCPP_CFILES = cplus_start.c cplus_stop.c @@ -38,36 +36,62 @@ KMODCPP_OFILES = $(KMODCPP_CFILES:.c=.o) ALL_OFILES = $(KMOD_OFILES) $(KMODCPP_OFILES) $(ALL_OFILES): %.o : %.c - ${KCC} -c ${CFLAGS} ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}} -o $(COMPOBJROOT)/$(*F).o $< + @echo CC $@ + $(_v)${KCC} -c ${CFLAGS} ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}} -o $(COMPOBJROOT)/$(*F).o $< $(COMPOBJROOT)/$(KMOD_NAME).a: $(KMOD_OFILES) - libtool -static -o $@ $^ + @echo LIBTOOL $@ + $(_v)libtool -static -o $@ $^ $(COMPOBJROOT)/$(KMODCPP_NAME).a: $(KMODCPP_OFILES) - libtool -static -o $@ $^ + @echo LIBTOOL $@ + $(_v)libtool -static -o $@ $^ do_build_all: $(COMPOBJROOT)/$(KMOD_NAME).a $(COMPOBJROOT)/$(KMODCPP_NAME).a $(INSTALL_DIR)/%.a: $(INSTOBJROOT)/%.a - @allarchs=""; \ - for onearch in $(INSTALL_ARCHS); do \ - if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \ - archdir=$(OBJROOT)/$(KERNEL_CONFIG)_$${onearch}/$(COMPONENT); \ - else \ - archdir=$(OBJROOT)/$(KERNEL_CONFIG)_$${onearch}_$(MACHINE_CONFIG)/$(COMPONENT); \ - fi; \ - if [ -e $${archdir}/kmod/$(*F).a ]; then \ - allarchs="$${allarchs} $${archdir}/kmod/$(*F).a"; \ - fi; \ - done; \ + @echo Installing $< in $@; $(RM) $@ || true; \ ${MKDIR} $(INSTALL_DIR) $(SYMROOT); \ - cmd="lipo $${allarchs} -create -output $(SYMROOT)/$(*F).a"; \ - echo $$cmd; eval $$cmd; \ - cmd="install $(LIB_INSTALL_FLAGS) $(SYMROOT)/$(*F).a $@"; \ + $(_v)if [ $(MACHINE_CONFIG) = DEFAULT ] ; then \ + allarchs=""; \ + for onearch in $(INSTALL_ARCHS); do \ + archdir=$(OBJROOT)/$(KERNEL_CONFIG)_$${onearch}/$(COMPONENT); \ + if [ -e $${archdir}/kmod/$(*F).a ]; then \ + allarchs="$${allarchs} $${archdir}/kmod/$(*F).a"; \ + fi; \ + done; \ + cmd="$(LIPO) $${allarchs} -create -output $(SYMROOT)/$(*F).a"; \ + echo $$cmd; eval $$cmd; \ + else \ + my_counter=1; \ + my_innercounter=1; \ + outputfile=$(SYMROOT)/$(*F).a; \ + for my_config in $(TARGET_CONFIGS_UC); do \ + if [ $${my_counter} -eq 1 ]; then \ + my_counter=2; \ + my_kconfig=$${my_config}; \ + elif [ $${my_counter} -eq 2 ]; then \ + my_counter=3; \ + my_aconfig=$${my_config}; \ + else \ + my_counter=1; \ + inputfile=$(OBJROOT)/$${my_kconfig}_$${my_aconfig}_$${my_config}/$(COMPONENT)/kmod/$(*F).a; \ + if [ -e $${inputfile} ]; then \ + if [ $${my_innercounter} -eq 1 ]; then \ + my_innercounter=2; \ + cmd="$(LIPO) -create $${inputfile} -o $${outputfile}"; \ + else \ + cmd="$(LIPO) -create $${outputfile} $${inputfile} -o $${outputfile} || true"; \ + fi; \ + echo $$cmd; eval $$cmd; \ + fi; \ + fi; \ + done; \ + fi; \ + cmd="$(INSTALL) $(LIB_INSTALL_FLAGS) $(SYMROOT)/$(*F).a $@"; \ echo $$cmd; eval $$cmd - do_build_install: $(INSTALL_DIR)/$(KMOD_NAME).a $(INSTALL_DIR)/$(KMODCPP_NAME).a # include $(MakeInc_rule)