Honor KERNSRCDIR for 'make universe'

From: John Baldwin <jhb_at_freebsd.org>
Date: Tue, 15 Feb 2011 09:25:51 -0500
This is useful when you want to run make universe against a custom kernel 
tree.  Specifically, if you keep a cross-compiled set of toolchains lying 
around in a stock HEAD checkout built using 'make toolchains' or 'make 
universe', then with this patch you can do:

	make MAKE_JUST_KERNELS universe KERNSRCDIR=/path/to/test/kernel/sources

This sort of worked before because KERNSRCDIR was passed to 'make buildkernel' 
via MAKEOPTIONS.  What didn't work was generating LINT files or if you had 
kernel config files in your new tree that aren't in the stock tree, etc.

Index: Makefile
===================================================================
--- Makefile	(revision 218554)
+++ Makefile	(working copy)
_at__at_ -336,6 +336,7 _at__at_ MAKE_JUST_WORLDS=	YES
 .else
 UNIVERSE_TARGET?=	buildworld
 .endif
+KERNSRCDIR?=		${.CURDIR}/sys
 
 targets:
 	_at_echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
_at__at_ -383,8 +384,8 _at__at_ universe_${target}_${target_arch}: universe_${targ
 .endfor
 .endif
 .if !defined(MAKE_JUST_WORLDS)
-.if exists(${.CURDIR}/sys/${target}/conf/NOTES)
-	_at_(cd ${.CURDIR}/sys/${target}/conf && env __MAKE_CONF=/dev/null \
+.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
+	_at_(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
 	    ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
 	    (echo "${target} 'make LINT' failed," \
 	    "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
_at__at_ -398,13 +399,13 _at__at_ universe_kernels: universe_kernconfs
 .if !defined(TARGET)
 TARGET!=	uname -m
 .endif
-KERNCONFS!=	cd ${.CURDIR}/sys/${TARGET}/conf && \
+KERNCONFS!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
 		find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
 		! -name DEFAULTS ! -name NOTES
 universe_kernconfs:
 .for kernel in ${KERNCONFS}
-TARGET_ARCH_${kernel}!=	cd ${.CURDIR}/sys/${TARGET}/conf && \
-	config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} 2> /dev/null | \
+TARGET_ARCH_${kernel}!=	cd ${KERNSRCDIR}/${TARGET}/conf && \
+	config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
 	grep -v WARNING: | cut -f 2
 .if empty(TARGET_ARCH_${kernel})
 .error "Target architecture for ${TARGET}/conf/${kernel} unknown.  config(8) 
likely too old."

-- 
John Baldwin
Received on Tue Feb 15 2011 - 14:34:56 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:11 UTC