diff -r -u -N --exclude CVS --exclude 'obj.*' sys.ORIG/arch/amd64/conf/Makefile.amd64 sys/arch/amd64/conf/Makefile.amd64 --- sys.ORIG/arch/amd64/conf/Makefile.amd64 2008-01-20 05:21:22.000000000 +0900 +++ sys/arch/amd64/conf/Makefile.amd64 2008-01-20 05:26:37.000000000 +0900 @@ -134,3 +134,12 @@ ## (10) Appending make options. ## %MAKEOPTIONSAPPEND + +## +## (11) LKMs +## +%KMOD + +.if !empty(MODULES) +.include "$S/conf/Makefile.kmod.inc" +.endif diff -r -u -N --exclude CVS --exclude 'obj.*' sys.ORIG/arch/i386/conf/Makefile.i386 sys/arch/i386/conf/Makefile.i386 --- sys.ORIG/arch/i386/conf/Makefile.i386 2008-01-20 05:21:25.000000000 +0900 +++ sys/arch/i386/conf/Makefile.i386 2008-01-20 05:23:31.000000000 +0900 @@ -121,3 +121,12 @@ ## (10) Appending make options. ## %MAKEOPTIONSAPPEND + +## +## (11) LKMs +## +%KMOD + +.if !empty(MODULES) +.include "$S/conf/Makefile.kmod.inc" +.endif diff -r -u -N --exclude CVS --exclude 'obj.*' sys.ORIG/conf/Makefile.kern.inc sys/conf/Makefile.kern.inc --- sys.ORIG/conf/Makefile.kern.inc 2008-01-20 05:21:33.000000000 +0900 +++ sys/conf/Makefile.kern.inc 2008-01-20 05:23:31.000000000 +0900 @@ -132,6 +132,8 @@ ## default is "library", as documented in $S/lib/libkern/Makefile.inc. ## +.if !defined(LKMBUILD) + ### find out what to use for libkern .include "$S/lib/libkern/Makefile.inc" .ifndef PROF @@ -174,6 +176,8 @@ ${NORMAL_C} .endfor +.endif + ## ## (5) link settings ## @@ -252,6 +256,7 @@ ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c .endif +.if !defined(LKMBUILD) .if !target(config_time.h) EXTRA_CLEAN+= config_time.h config_time.h: Makefile @@ -281,6 +286,8 @@ # depend on maxusers and CPU configuration assym.h machdep.o: Makefile +.endif # !defined(LKMBUILD) + ## ## (7) misc targets: install, clean(dir), depend(all), lint, links, tags, ## cscope, mkid @@ -317,7 +324,11 @@ MKDEP_AFLAGS?= ${AFLAGS} MKDEP_CFLAGS?= ${CFLAGS} SSRCS=${MD_SFILES} ${SFILES} +.if defined(LKMBUILD) +CSRCS=${CFILES} +.else CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES} +.endif SRCS=${SSRCS} ${CSRCS} DEPS= ${SRCS:T:O:u:R:S/$/.d/g} @@ -334,6 +345,7 @@ ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s} .endfor +.if !defined(LKMBUILD) assym.d: assym.h config_time.h ${_MKTARGET_CREATE} cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \ @@ -343,6 +355,9 @@ rm -f assym.dep .depend: ${DEPS} assym.d +.else +.depend: ${DEPS} +.endif ${_MKTARGET_CREATE} echo "${.ALLSRC}" | ${MKDEP} -D .endif diff -r -u -N --exclude CVS --exclude 'obj.*' sys.ORIG/conf/Makefile.kmod.inc sys/conf/Makefile.kmod.inc --- sys.ORIG/conf/Makefile.kmod.inc 1970-01-01 09:00:00.000000000 +0900 +++ sys/conf/Makefile.kmod.inc 2008-01-20 05:17:09.000000000 +0900 @@ -0,0 +1,45 @@ +# +# +# +KMODWRKDIR=modules +KMODWORK_SUFFIX=.work + +depend: moddepend +all: modules +dependmodules: moddepend modules +clean: modclean + +.for _M in ${MODULES} +WORKDIR.${_M}:= ${KMODWRKDIR}/${_M}${KMODWORK_SUFFIX} +.endfor + +.PHONY: modules moddepend modclean +moddepend: Makefile.inc assym.h config_time.h +.for _M in ${MODULES} + (cd ${WORKDIR.${_M}}; $(MAKE) depend) +.endfor + +modclean: Makefile.inc +.for _M in ${MODULES} + (cd ${WORKDIR.${_M}}; $(MAKE) clean) +.endfor + +modules: Makefile.inc +.for _M in ${MODULES} +modules: ${KMODWRKDIR}/${_M}.o + +${KMODWRKDIR}/${_M}.o: ${WORKDIR.${_M}}/LKM.o + cp ${WORKDIR.${_M}}/LKM.o ${.TARGET} + +${WORKDIR.${_M}}/LKM.o: .MAKE .EXEC + (cd ${WORKDIR.${_M}}; $(MAKE)) +.endfor + +# +# generate Makefile.inc for modules +Makefile.inc: Makefile ${S}/conf/Makefile.kmod.inc + echo "# definitions for LKMs" > ${.TARGET} + echo "CPPFLAGS+= -I../.. ${CPPFLAGS}" >> ${.TARGET} + echo "CPPFLAGS+=\$${EXTRA_INCLUDES}" >> ${.TARGET} + echo "AFLAGS+= ${AFLAGS}" >> ${.TARGET} + echo "UUDECODE=${UUDECODE}" >> ${.TARGET} diff -r -u -N --exclude CVS --exclude 'obj.*' sys.ORIG/conf/Makefile.lkm sys/conf/Makefile.lkm --- sys.ORIG/conf/Makefile.lkm 1970-01-01 09:00:00.000000000 +0900 +++ sys/conf/Makefile.lkm 2008-01-20 05:17:09.000000000 +0900 @@ -0,0 +1,36 @@ +# +# Makefile for LKM (generated by config) +# +%KMOD + +# the module is generated at the module work directory as LKM.o in +# order to avoid conflict in case we have ${KMOD}.c in source files. +# Because of this, unfortunately, "make load" or "make install" won't +# work at this directory. (need to modify bsd.kmod.mk?) +PROG= LKM.o +# for make load (not yet) +KMOD_ENTRY= %{KMOD}_lkmentry +# for make install (not yet) +KMOD_INSTALLED_AS= %{KMOD}.o +%SRCS +%OBJS +MKOBJ=no +MKMAN=no + +CLEANFILES+= ${KMOD} +WARNS?= 2 + +.include "$S/contrib/dev/ath/netbsd/Makefile.ath.inc" +.include "../../Makefile.inc" +.include +# +# This is required to compile some device drivers. +# Makefile.kern.inc has it, but bsd.kmod.mk doesn't. +# XXX: Move this to the appropriate place. +CFLAGS+= -Wno-format-zero-length + +# copy LKM.o with the correct name +realall: ../${KMOD}.o + +../${KMOD}.o: LKM.o + cp LKM.o ${.TARGET} diff -r -u -N --exclude CVS --exclude 'obj.*' sys.ORIG/contrib/dev/ath/netbsd/Makefile.ath.inc sys/contrib/dev/ath/netbsd/Makefile.ath.inc --- sys.ORIG/contrib/dev/ath/netbsd/Makefile.ath.inc 2008-01-20 05:21:33.000000000 +0900 +++ sys/contrib/dev/ath/netbsd/Makefile.ath.inc 2008-01-20 05:23:31.000000000 +0900 @@ -59,6 +59,7 @@ .if !empty(OBJS:M\/athhal.o) OBJS:=${OBJS:C/\/athhal.o/athhal.o/} +_HAVE_ATHHAL_O:= #defined ATH_UUDEC?= @${_MKSHMSG} "uudecode ${.CURDIR:T}/${.TARGET}"; \ ${_MKSHECHO}\ @@ -69,6 +70,13 @@ athhal.o: $S/contrib/dev/ath/public/${ATH_HAL}.hal.o.uu ${ATH_UUDEC} +.endif + +SRCS?= +.if defined(_HAVE_ATHHAL_O) || ( !empty(SRCS:U:Mif_ath_pci.c) || !empty(SRCS:U:Mif_ath_cardbus.c) ) +# +# + athhal_options.h: $S/contrib/dev/ath/public/${ATH_HAL}.opt_ah.h ${_MKSHECHO} cp $> ${.TARGET} rm -f ${.TARGET}