]> git.saurik.com Git - apple/xnu.git/blobdiff - libkern/kmod/Makefile.kmod
xnu-1228.12.14.tar.gz
[apple/xnu.git] / libkern / kmod / Makefile.kmod
index fcc97f211f2d1179e3858f84b924d2c1c7f8392a..bab4de5750d221eec22a5085ea4acc18863d77d8 100644 (file)
@@ -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
 
 export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
 export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
 
-
 include $(MakeInc_cmd)
 include $(MakeInc_def)
 
 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
 
 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
 
 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
 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)
 
 $(COMPOBJROOT)/$(KMOD_NAME).a: $(KMOD_OFILES)
-       libtool -static -o $@ $^
+       @echo LIBTOOL $@
+       $(_v)libtool -static -o $@ $^
 
 $(COMPOBJROOT)/$(KMODCPP_NAME).a: $(KMODCPP_OFILES)
 
 $(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
 
 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);                             \
        $(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
 
        echo $$cmd; eval $$cmd
 
-
 do_build_install: $(INSTALL_DIR)/$(KMOD_NAME).a $(INSTALL_DIR)/$(KMODCPP_NAME).a
 
 # include $(MakeInc_rule)
 do_build_install: $(INSTALL_DIR)/$(KMOD_NAME).a $(INSTALL_DIR)/$(KMODCPP_NAME).a
 
 # include $(MakeInc_rule)