# # Kernel Module Library code makefile # export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd 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) INSTALL_DIR = $(DSTROOT)/usr/lib KMOD_NAME = libkmod KMODCPP_NAME = libkmodc++ LIB_INSTALL_FLAGS = -p -m 444 CFLAGS += -Wall -Wno-four-char-constants CFLAGS_PPC += -mlong-branch CFLAGS_ARM += -mlong-calls ifneq ($(MACHINE_CONFIG), DEFAULT) COMPOBJROOT = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)/kmod INSTOBJROOT = $(OBJROOT)/$(INSTALL_TYPE)_$(ARCH_CONFIG)_$(MACHINE_CONFIG)/$(COMPONENT)/kmod else 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 KMOD_OFILES = $(KMOD_CFILES:.c=.o) KMODCPP_OFILES = $(KMODCPP_CFILES:.c=.o) ALL_OFILES = $(KMOD_OFILES) $(KMODCPP_OFILES) $(ALL_OFILES): %.o : %.c @echo CC $@ $(_v)${KCC} -c ${CFLAGS} ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}} -o $(COMPOBJROOT)/$(*F).o $< $(COMPOBJROOT)/$(KMOD_NAME).a: $(KMOD_OFILES) @echo LIBTOOL $@ $(_v)libtool -static -o $@ $^ $(COMPOBJROOT)/$(KMODCPP_NAME).a: $(KMODCPP_OFILES) @echo LIBTOOL $@ $(_v)libtool -static -o $@ $^ do_build_all: $(COMPOBJROOT)/$(KMOD_NAME).a $(COMPOBJROOT)/$(KMODCPP_NAME).a $(INSTALL_DIR)/%.a: $(INSTOBJROOT)/%.a @echo Installing $< in $@; $(RM) $@ || true; \ ${MKDIR} $(INSTALL_DIR) $(SYMROOT); \ $(_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) include $(MakeInc_dir)