2 # Kernel Module Library code makefile
5 export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
6 export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
7 export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
8 export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
11 include $(MakeInc_cmd)
12 include $(MakeInc_def)
14 INSTALL_DIR = $(DSTROOT)/usr/lib
16 KMODCPP_NAME = libkmodc++
17 LIB_INSTALL_FLAGS = -c -m 444 -S "-S"
19 CFLAGS += -Wall -Wno-four-char-constants
20 CFLAGS_PPC += -mlong-branch
22 COMPOBJROOT = $(OBJROOT)/$(KERNEL_CONFIG)_$(ARCH_CONFIG)/$(COMPONENT)/kmod
23 INSTOBJROOT = $(OBJROOT)/$(INSTALL_TYPE)_$(ARCH_CONFIG)/$(COMPONENT)/kmod
25 KMOD_CFILES = c_start.c c_stop.c
26 KMODCPP_CFILES = cplus_start.c cplus_stop.c
28 KMOD_OFILES = $(KMOD_CFILES:.c=.o)
29 KMODCPP_OFILES = $(KMODCPP_CFILES:.c=.o)
31 ALL_OFILES = $(KMOD_OFILES) $(KMODCPP_OFILES)
33 $(ALL_OFILES): %.o : %.c
34 ${KCC} -c ${CFLAGS} ${${join $@,_CFLAGS}} ${INCFLAGS} ${${join $@,_INCFLAGS}} -o $(COMPOBJROOT)/$(*F).o $<
36 $(COMPOBJROOT)/$(KMOD_NAME).a: $(KMOD_OFILES)
37 libtool -static -o $@ $^
39 $(COMPOBJROOT)/$(KMODCPP_NAME).a: $(KMODCPP_OFILES)
40 libtool -static -o $@ $^
42 do_build_all: $(COMPOBJROOT)/$(KMOD_NAME).a $(COMPOBJROOT)/$(KMODCPP_NAME).a
44 $(INSTALL_DIR)/%.a: $(INSTOBJROOT)/%.a
46 for onearch in $(INSTALL_ARCHS); do \
47 archdir=$(OBJROOT)/$(KERNEL_CONFIG)_$$onearch/$(COMPONENT); \
48 if [ -e $$archdir/kmod/$(*F).a ]; then \
49 allarchs="$$allarchs $$archdir/kmod/$(*F).a"; \
53 ${MKDIR} $(INSTALL_DIR) $(SYMROOT); \
54 cmd="lipo $$allarchs -create -output $(SYMROOT)/$(*F).a"; \
55 echo $$cmd; eval $$cmd; \
56 cmd="install $(LIB_INSTALL_FLAGS) $(SYMROOT)/$(*F).a $@"; \
57 echo $$cmd; eval $$cmd
60 do_build_install: $(INSTALL_DIR)/$(KMOD_NAME).a $(INSTALL_DIR)/$(KMODCPP_NAME).a
62 # include $(MakeInc_rule)
63 include $(MakeInc_dir)