Index: head/sys/conf/kern.post.mk =================================================================== --- head/sys/conf/kern.post.mk +++ head/sys/conf/kern.post.mk @@ -35,24 +35,41 @@ .MAIN: all +.if !defined(NO_MODULES) +# Default prefix used for modules installed from ports +LOCALBASE?= /usr/local + +LOCAL_MODULES_DIR?= ${LOCALBASE}/sys/modules + +# Default to installing all modules installed by ports unless overridden +# by the user. +.if !defined(LOCAL_MODULES) +LOCAL_MODULES!= ls ${LOCAL_MODULES_DIR} +.endif +.endif + .for target in all clean cleandepend cleandir clobber depend install \ ${_obj} reinstall tags ${target}: kernel-${target} -.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) +.if !defined(NO_MODULES) ${target}: modules-${target} modules-${target}: +.if !defined(MODULES_WITH_WORLD) && exists($S/modules) cd $S/modules; ${MKMODULESENV} ${MAKE} \ ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} .endif +.for module in ${LOCAL_MODULES} + cd ${LOCAL_MODULES_DIR}/${module}; ${MKMODULESENV} ${MAKE} \ + ${target:S/^reinstall$/install/:S/^clobber$/cleandir/} .endfor +.endif +.endfor # Handle ports (as defined by the user) that build kernel modules .if !defined(NO_MODULES) && defined(PORTS_MODULES) # # The ports tree needs some environment variables defined to match the new kernel # -# Ports search for some dependencies in PATH, so add the location of the installed files -LOCALBASE?= /usr/local # SRC_BASE is how the ports tree refers to the location of the base source files .if !defined(SRC_BASE) SRC_BASE= ${SYSDIR:H:tA} @@ -64,6 +81,9 @@ ${MAKEOBJDIRPREFIX}${SRC_BASE}/include/osreldate.h .endif # Keep the related ports builds in the obj directory so that they are only rebuilt once per kernel build +# +# Ports search for some dependencies in PATH, so add the location of the +# installed files WRKDIRPREFIX?= ${.OBJDIR} PORTSMODULESENV=\ env \ @@ -110,7 +130,7 @@ kernel-obj: -.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) +.if !defined(NO_MODULES) modules: modules-all .if !defined(NO_MODULES_OBJ)