sets.subr revision 1.206
1#	$NetBSD: sets.subr,v 1.206 2024/04/22 14:41:25 nia Exp $
2#
3
4#
5# The following variables contain defaults for sets.subr functions and callers:
6#	setsdir			path to src/distrib/sets
7#	nlists			list of base sets
8#	xlists			list of x11 sets
9#	obsolete		controls if obsolete files are selected instead
10#	module			if != "no", enable MODULE sets
11#	shlib			shared library format (a.out, elf, or "")
12#	stlib			static library format (a.out, elf)
13#
14# The following <bsd.own.mk> variables are exported to the environment:
15#	MACHINE
16#	MACHINE_ARCH
17#	MACHINE_CPU
18#	HAVE_ACPI
19#	HAVE_BINUTILS
20#	HAVE_GCC
21#	HAVE_GDB
22#	HAVE_NVMM
23#	HAVE_OPENSSL
24#	HAVE_SSP
25#	HAVE_UEFI
26#	TOOLCHAIN_MISSING
27#	OBJECT_FMT
28# as well as:
29#
30
31#
32# The following variables refer to tools that are used when building sets:
33#
34: ${AWK:=awk}
35: ${CKSUM:=cksum}
36: ${COMM:=comm}
37: ${DATE:=date}
38: ${DB:=db}
39: ${EGREP:=egrep}
40: ${ENV_CMD:=env}       # ${ENV} is special to sh(1), ksh(1), etc.
41: ${FGREP:=fgrep}
42: ${FIND:=find}
43: ${GREP:=grep}
44: ${GZIP_CMD:=gzip}     # ${GZIP} is special to gzip(1)
45: ${HOSTNAME_CMD:=hostname}	# ${HOSTNAME} is special to bash(1)
46: ${HOST_SH:=sh}
47: ${IDENT:=ident}
48: ${JOIN:=join}
49: ${LS:=ls}
50: ${MAKE:=make}
51: ${MKTEMP:=mktemp}
52: ${MTREE:=mtree}
53: ${PASTE:=paste}
54: ${PAX:=pax}
55: ${PRINTF:=printf}
56: ${SED:=sed}
57: ${SORT:=sort}
58: ${STAT:=stat}
59: ${TSORT:=tsort}
60: ${UNAME:=uname}
61: ${WC:=wc}
62: ${XARGS:=xargs}
63
64#
65# If printf is a shell builtin command, then we can
66# implement cheaper versions of basename and dirname
67# that do not involve any fork/exec overhead.
68# If printf is not builtin, approximate it using echo,
69# and hope there are no weird file names that cause
70# some versions of echo to do the wrong thing.
71# (Converting to this version of dirname speeded up the
72# syspkgdeps script by an order of magnitude, from 68
73# seconds to 6.3 seconds on one particular host.)
74#
75# Note that naive approximations for dirname
76# using ${foo%/*} do not do the right thing in cases
77# where the result should be "/" or ".".
78#
79case "$(type printf)" in
80*builtin*)
81	basename ()
82	{
83		local bn
84		bn="${1##*/}"
85		bn="${bn%$2}"
86		printf "%s\n" "$bn"
87	}
88	dirname ()
89	{
90		local dn
91		case "$1" in
92		?*/*)	dn="${1%/*}" ;;
93		/*)	dn=/ ;;
94		*)	dn=. ;;
95		esac
96		printf "%s\n" "$dn"
97	}
98	;;
99*)
100	basename ()
101	{
102		local bn
103		bn="${1##*/}"
104		bn="${bn%$2}"
105		echo "$bn"
106	}
107	dirname ()
108	{
109		local dn
110		case "$1" in
111		?*/*)	dn="${1%/*}" ;;
112		/*)	dn=/ ;;
113		*)	dn=. ;;
114		esac
115		echo "$dn"
116	}
117	;;
118esac
119
120#####
121
122oIFS=$IFS
123IFS="
124"
125
126for x in $( MAKEVERBOSE= ${MAKE} -B -f ${rundir}/mkvars.mk mkvars ); do
127	eval export $x
128done
129
130IFS=$oIFS
131
132MKVARS="$( MAKEVERBOSE= ${MAKE} -B -f ${rundir}/mkvars.mk mkvars | ${SED} -e 's,=.*,,' | ${XARGS} )"
133
134#####
135
136setsdir=${rundir}
137obsolete=0
138if [ "${MKKMOD}" = "no" ]; then
139	module=no			# MODULEs are off.
140	modset=""
141else
142	module=yes
143	modset="modules"
144fi
145if [ "${MKATF}" = "no" ]; then
146	testset=""
147else
148	testset="tests"
149fi
150if [ "${MKDEBUG}" = "no" -a "${MKDEBUGLIB}" = "no" ]; then
151	debugset=""
152	xdebugset=""
153else
154	debugset="debug"
155	xdebugset="xdebug"
156fi
157if [ -z "${debugset}" -o "${MKCOMPAT}" = "no" ]; then
158	debug32set=""
159else
160	debug32set="debug32"
161fi
162if [ -z "${debug32set}" ]; then
163	debug64set=""
164else
165	if [ "${MACHINE_ARCH}" = "mips64eb" -o "${MACHINE_ARCH}" = "mips64el" ]; then
166		debug64set="debug64"
167	else
168		debug64set=""
169	fi
170fi
171if [ "${MKDTB}" = "no" ]; then
172	dtbset=""
173else
174	dtbset="dtb"
175fi
176if [ "${MKHTML}" = "no" ]; then
177	manhtmlset=""
178else
179	manhtmlset="manhtml"
180fi
181if [ "${MKCOMPAT}" = "no" ]; then
182	base32set=""
183else
184	base32set="base32"
185fi
186if [ "${MKCOMPAT}" != "no" ]; then
187	if [ "${MACHINE_ARCH}" = "mips64eb" -o "${MACHINE_ARCH}" = "mips64el" ]; then
188		base64set="base64"
189	else
190		base64set=""
191	fi
192else
193	base64set=""
194fi
195
196
197# Determine lib type. Do this first so stlib also gets set.
198if [ "${OBJECT_FMT}" = "ELF" ]; then
199	shlib=elf
200else
201	shlib=aout
202fi
203stlib=$shlib
204# Now check for MKPIC or specials and turn off shlib if need be.
205if [ "${MKPIC}" = "no" ]; then
206	shlib=no
207fi
208nlists="base $base32set $base64set comp $debugset $debug32set $debug64set $dtbset etc games gpufw man $manhtmlset misc $modset rescue $testset text"
209xlists="xbase xcomp $xdebugset xetc xfont xserver"
210
211OSRELEASE=$(${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh -k)
212if [ "${KERNEL_DIR}" = "yes" ]; then
213	MODULEDIR="netbsd/modules"
214else
215	MODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules"
216fi
217SUBST="s#@MODULEDIR@#${MODULEDIR}#g"
218SUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g"
219SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g"
220
221#
222# list_set_files setfile [...]
223#
224# Produce a packing list for setfile(s).
225# In each file, a record consists of a path and a System Package name,
226# separated by whitespace. E.g.,
227#
228# 	# $NetBSD: sets.subr,v 1.206 2024/04/22 14:41:25 nia Exp $
229# 	.			base-sys-root	[keyword[,...]]
230# 	./altroot		base-sys-root
231# 	./bin			base-sys-root
232# 	./bin/[			base-util-root
233# 	./bin/cat		base-util-root
234#		[...]
235#
236# A # in the first column marks a comment.
237#
238# If ${obsolete} != 0, only entries with an "obsolete" keyword will
239# be printed.  All other keywords must be present.
240#
241# The third field is an optional comma separated list of keywords to
242# control if a record is printed; every keyword listed must be enabled
243# for the record to be printed. The list of all available make variables
244# that can be turned on or off can be found by running in this directory:
245#
246#	make -f mkvars.mk mkvarsyesno
247#
248# These MK<NAME> variables can be used as selectors in the sets as <name>.
249#
250# The following extra keywords are also available, listed by:
251#
252#	make -f mkvars.mk mkextravars
253#
254# These are:
255#    1. The HAVE_<name>:
256#	ssp			${HAVE_SSP} != no
257#	libgcc_eh		${HAVE_LIBGCC_EH} != no
258#	acpi			${HAVE_ACPI} != no
259#	binutils=<n>		<n> = value of ${HAVE_BINUTILS}
260#	gcc=<n>			<n> = value of ${HAVE_GCC}
261#	gdb=<n>			<n> = value of ${HAVE_GDB}
262#	mesa_ver=<n>		<n> = value of ${HAVE_MESA_VER}
263#	nvmm			${HAVE_NVMM} != no
264#	openssl=<n>		<n> = value of ${HAVE_OPENSSL}
265#	uefi			${HAVE_UEFI} != no
266#	xorg_server_ver=<n>	<n> = value of ${HAVE_XORG_SERVER_VER}
267#	xorg_glamor		${HAVE_XORG_GLAMOR} != no
268#
269#    2. The USE_<name>:
270#	use_inet6		${USE_INET6} != no
271#	use_kerberos		${USE_KERBEROS} != no
272#	use_ldap		${USE_LDAP} != no
273#	use_yp			${USE_YP} != no
274#
275#    3. Finally:
276#	dummy			dummy entry (ignored)
277#	obsolete		file is obsolete, and only printed if
278#				${obsolete} != 0
279#
280#	solaris			${MKDTRACE} != no or ${MKZFS} != no or ${MKCTF} != no
281#
282#
283#	endian=<n>		<n> = value of ${TARGET_ENDIANNESS}
284#
285#
286#	.cat			if ${MKMANZ} != "no" && ${MKCATPAGES} != "no"
287#				  automatically append ".gz" to the filename
288#
289#	.man			if ${MKMANZ} != "no" && ${MKMAN} != "no"
290#				  automatically append ".gz" to the filename
291#
292list_set_files()
293{
294	if [ ${MAKEVERBOSE:-2} -lt 3 ]; then
295		verbose=false
296	else
297		verbose=true
298	fi
299	local CONFIGS="$( list_kernel_configs )"
300	print_set_lists "$@" | \
301	${AWK} -v obsolete=${obsolete} '
302		function addkmod(line, fname, prefix, pat, patlen) {
303			if (substr(line, 1, patlen) != pat) {
304				return
305			}
306			for (d in kmodarchdirs) {
307				xd = prefix kmodarchdirs[d]
308				xline = xd substr(line, patlen + 1)
309				xfname = xd substr(fname, patlen + 1)
310				list[xline] = xfname
311			}
312		}
313		function adddebugkernel(line, fname, pat, patlen) {
314			if (pat == "" || substr(line, 1, patlen) != pat) {
315				return 0
316			}
317			split("'"${CONFIGS}"'", configs)
318			for (d in configs) {
319				xfname = fname
320				sub("@CONFIG@", configs[d], xfname)
321				xline = line;
322				sub("@CONFIG@", configs[d], xline)
323				list[xline] = xfname
324			}
325			return 1
326		}
327		BEGIN {
328			if (obsolete)
329				wanted["obsolete"] = 1
330
331			split("'"${MKVARS}"'", needvars)
332			doingcompat = 0
333			doingcompattests = 0
334			ignoredkeywords["compatdir"] = 1
335			ignoredkeywords["compatfile"] = 1
336			ignoredkeywords["compattestdir"] = 1
337			ignoredkeywords["compattestfile"] = 1
338			ignoredkeywords["compatx11dir"] = 1
339			ignoredkeywords["compatx11file"] = 1
340			for (vi in needvars) {
341				nv = needvars[vi]
342				kw = tolower(nv)
343				sub(/^mk/, "", kw)
344				sub(/^have_/, "", kw)
345				sub(/^target_endianness/, "endian", kw)
346				if (nv != "HAVE_GCC" && nv != "HAVE_GDB" && ENVIRON[nv] != "no" && nv != "COMPATARCHDIRS" && nv != "KMODARCHDIRS") {
347					wanted[kw] = 1
348				}
349			}
350
351			if ("compat" in wanted) {
352				doingcompat = 1;
353				split("'"${COMPATARCHDIRS}"'", compatarchdirs, ",");
354				compatdirkeywords["compatdir"] = 1
355				compatfilekeywords["compatfile"] = 1
356
357				if (wanted["compattests"]) {
358					doingcompattests = 1;
359					compatdirkeywords["compattestdir"] = 1
360					compatfilekeywords["compattestfile"] = 1
361				}
362				if (wanted["compatx11"]) {
363					doingcompatx11 = 1;
364					compatdirkeywords["compatx11dir"] = 1
365					compatfilekeywords["compatx11file"] = 1
366				}
367			}
368
369			if (("kmod" in wanted) && ("compatmodules" in wanted)) {
370				split("'"${KMODARCHDIRS}"'", kmodarchdirs, ",");
371				kmodprefix = "./stand/"
372				kmodpat = kmodprefix ENVIRON["MACHINE"]
373				l_kmodpat = length(kmodpat)
374				kmoddbprefix = "./usr/libdata/debug/stand/"
375				kmoddbpat = kmoddbprefix ENVIRON["MACHINE"]
376				l_kmoddbpat = length(kmoddbpat)
377			}
378			if ("debug" in wanted) {
379				debugkernelname = "./usr/libdata/debug/netbsd-@CONFIG@.debug"
380				l_debugkernelname = length(debugkernelname);
381			}
382
383			if ("'"${TOOLCHAIN_MISSING}"'" != "yes") {
384				if ("binutils" in wanted)
385					wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1
386				if ("gcc" in wanted)
387					wanted["gcc=" "'"${HAVE_GCC}"'"] = 1
388				if ("gdb" in wanted)
389					wanted["gdb=" "'"${HAVE_GDB}"'"] = 1
390			}
391			if ("acpi" in wanted) {
392				wanted["acpi=" "'"${HAVE_ACPI}"'"] = 1
393			}
394			if ("mesa_ver" in wanted) {
395				wanted["mesa_ver=" "'"${HAVE_MESA_VER}"'"] = 1
396			}
397			if ("nvmm" in wanted) {
398				wanted["nvmm=" "'"${HAVE_NVMM}"'"] = 1
399			}
400			if ("openssl" in wanted) {
401				wanted["openssl=" "'"${HAVE_OPENSSL}"'"] = 1
402			}
403			if ("xorg_server_ver" in wanted) {
404				wanted["xorg_server_ver=" "'"${HAVE_XORG_SERVER_VER}"'"] = 1
405			}
406			if ("uefi" in wanted) {
407				wanted["uefi=" "'"${HAVE_UEFI}"'"] = 1
408			}
409			if (("man" in wanted) && ("catpages" in wanted))
410				wanted[".cat"] = 1
411			if (("man" in wanted) && ("manpages" in wanted))
412				wanted[".man"] = 1
413			if ("endian" in wanted)
414				wanted["endian=" "'"${TARGET_ENDIANNESS}"'"] = 1
415			if ("machine" in wanted)
416				wanted["machine=" "'"${MACHINE}"'"] = 1
417			if ("machine_arch" in wanted)
418				wanted["machine_arch=" "'"${MACHINE_ARCH}"'"] = 1
419			if ("machine_cpu" in wanted)
420				wanted["machine_cpu=" "'"${MACHINE_CPU}"'"] = 1
421		}
422
423		/^#/ {
424			next;
425		}
426
427		/^-/ {
428			notwanted[substr($1, 2)] = 1;
429			delete list [substr($1, 2)];
430			next;
431		}
432
433
434		NF > 2 && $3 != "-" {
435			if (notwanted[$1] != "")
436				next;
437			split($3, keywords, ",")
438			show = 1
439			haveobs = 0
440			iscompatfile = 0
441			havekmod = 0
442			iscompatdir = 0
443			for (ki in keywords) {
444				kw = keywords[ki]
445				if (("manz" in wanted) &&
446				    (kw == ".cat" || kw == ".man"))
447					$1 = $1 ".gz"
448				if (substr(kw, 1, 1) == "!") {
449					kw = substr(kw, 2)
450					if (kw in wanted)
451						show = 0
452				} else if (kw in compatdirkeywords) {
453					iscompatdir = 1
454				} else if (kw in compatfilekeywords) {
455					iscompatfile = 1
456				} else if (kw == "nocompatmodules") {
457					havekmod = -1
458				} else if (kw in ignoredkeywords) {
459					# ignore
460				} else if (! (kw in wanted)) {
461					show = 0
462				} else if (kw == "kmod" && havekmod == 0) {
463					havekmod = 1
464				}
465				if (kw == "obsolete")
466					haveobs = 1
467			}
468			if (iscompatdir) {
469				for (d in cpaths) {
470					if (cpaths[d] == $1 "/")
471						next
472				}
473				cpaths[ncpaths++] = $1 "/"
474			}
475			if (obsolete && ! haveobs)
476				next
477			if (!show)
478				next
479			if (adddebugkernel($0, $1, debugkernelname, l_debugkernelname))
480				next
481
482			list[$1] = $0
483			if (havekmod > 0) {
484				addkmod($0, $1, kmodprefix, kmodpat, l_kmodpat)
485				addkmod($0, $1, kmoddbprefix, kmoddbpat, l_kmoddbpat)
486				next
487			}
488
489			if (!doingcompat || !(iscompatfile || iscompatdir))
490				next
491
492			if (iscompatfile) {
493				emitcompat[$1] = 1;
494				next
495			}
496			for (d in compatarchdirs) {
497				tmp = $0
498				xfile = $1 "/" compatarchdirs[d]
499				tmp = xfile substr(tmp, length($1) + 1)
500				if (xfile in notwanted)
501					continue;
502				sub("compatdir","compat",tmp);
503				sub("compattestdir","compat",tmp);
504				list[xfile] = tmp
505			}
506			next
507		}
508
509		{
510			if ($1 in notwanted)
511				next;
512			if (! obsolete)
513				list[$1] = $0
514		}
515
516		END {
517			for (i in list) {
518				print list[i]
519				if (! (i in emitcompat))
520					continue;
521				l_i = length(i)
522				l = 0
523				for (j in cpaths) {
524					lx = length(cpaths[j])
525					if (lx >= l_i || cpaths[j] != substr(i, 1, lx)) {
526						continue;
527					}
528					if (lx > l) {
529						l = lx;
530						cpath = cpaths[j];
531					}
532				}
533				for (d in compatarchdirs) {
534					tmp = list[i]
535					extrapath = compatarchdirs[d] "/"
536					xfile = cpath extrapath substr(i, l + 1)
537					if (xfile in notwanted)
538						continue;
539					sub("compatfile","compat",tmp);
540					sub("compattestfile","compat",tmp);
541					tmp = xfile substr(tmp, l_i + 1)
542					print tmp;
543				}
544			}
545		}'
546
547}
548
549#
550# list_set_lists setname
551#
552# Print to stdout a list of files, one filename per line, which
553# concatenate to create the packing list for setname. E.g.,
554#
555# 	.../lists/base/mi
556# 	.../lists/base/rescue.mi
557# 	.../lists/base/md.i386
558#		[...]
559#
560# For a given setname $set, the following files may be selected from
561# .../list/$set:
562#	mi
563#	mi.ext.*
564#	ad.${MACHINE_ARCH}
565# (or)	ad.${MACHINE_CPU}
566#	ad.${MACHINE_CPU}.shl
567#	md.${MACHINE}.${MACHINE_ARCH}
568# (or)	md.${MACHINE}
569#	stl.mi
570#	stl.${stlib}
571#	shl.mi
572#	shl.mi.ext.*
573#	shl.${shlib}
574#	shl.${shlib}.ext.*
575#	module.mi			if ${module} != no
576#	module.${MACHINE}		if ${module} != no
577#	module.ad.${MACHINE_ARCH}	if ${module} != no
578# (or)	module.ad.${MACHINE_CPU}	if ${module} != no
579#	rescue.shl
580#	rescue.${MACHINE}
581#	rescue.ad.${MACHINE_ARCH}
582# (or)	rescue.ad.${MACHINE_CPU}
583# 	rescue.ad.${MACHINE_CPU}.shl
584#
585# Environment:
586# 	shlib
587# 	stlib
588#
589list_set_lists()
590{
591	setname=$1
592
593	list_set_lists_mi $setname
594	list_set_lists_ad $setname
595	list_set_lists_md $setname
596	list_set_lists_stl $setname
597	list_set_lists_shl $setname
598	list_set_lists_module $setname
599	list_set_lists_rescue $setname
600	return 0
601}
602
603list_set_lists_mi()
604{
605	setdir=$setsdir/lists/$1
606	# always exist!
607	echo $setdir/mi
608}
609
610list_set_lists_ad()
611{
612	setdir=$setsdir/lists/$1
613	[ "${MACHINE}" != "${MACHINE_ARCH}" ] && \
614	list_set_lists_common_ad $1
615}
616
617list_set_lists_md()
618{
619	setdir=$setsdir/lists/$1
620	echo_if_exist $setdir/md.${MACHINE}.${MACHINE_ARCH} || \
621	echo_if_exist $setdir/md.${MACHINE}
622}
623
624list_set_lists_stl()
625{
626	setdir=$setsdir/lists/$1
627	echo_if_exist $setdir/stl.mi
628	echo_if_exist $setdir/stl.${stlib}
629}
630
631list_set_lists_shl()
632{
633	setdir=$setsdir/lists/$1
634	[ "$shlib" != "no" ] || return
635	echo_if_exist $setdir/shl.mi
636	echo_if_exist $setdir/shl.${shlib}
637}
638
639list_set_lists_module()
640{
641	setdir=$setsdir/lists/$1
642	[ "$module" != "no" ] || return
643	echo_if_exist $setdir/module.mi
644	echo_if_exist $setdir/module.${MACHINE}
645	echo_if_exist $setdir/module.ad.${MACHINE}
646	echo_if_exist $setdir/module.md.${MACHINE}
647	# XXX module never has .shl
648	[ "${MACHINE}" != "${MACHINE_ARCH}" ] && \
649	list_set_lists_common_ad $1 module
650}
651
652list_set_lists_rescue()
653{
654	setdir=$setsdir/lists/$1
655	echo_if_exist $setdir/rescue.mi
656	echo_if_exist $setdir/rescue.${MACHINE}
657	[ "${MACHINE}" != "${MACHINE_ARCH}" ] && \
658	list_set_lists_common_ad $1 rescue
659}
660
661list_set_lists_common_ad()
662{
663	setdir=$setsdir/lists/$1; _prefix=$2
664
665	[ -n "$_prefix" ] && prefix="$_prefix".
666
667	# Prefer a <prefix>.ad.${MACHINE_ARCH} over a
668	# <prefix>.ad.${MACHINE_CPU}, since the arch-
669	# specific one will be more specific than the
670	# cpu-specific one.
671	echo_if_exist $setdir/${prefix}ad.${MACHINE_ARCH} || \
672	echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU}
673	[ "$shlib" != "no" ] && \
674	echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU}.shl
675}
676
677echo_if_exist()
678{
679	[ -f $1 ] && echo $1
680	return $?
681}
682
683echo_if_exist_foreach()
684{
685	local _list=$1; shift
686	for _suffix in $@; do
687		echo_if_exist ${_list}.${_suffix}
688	done
689}
690
691print_set_lists()
692{
693	for setname; do
694		list=$(list_set_lists $setname)
695		for l in $list; do
696			echo $l
697			if $verbose; then
698				echo >&2 "DEBUG: list_set_files: $l"
699			fi
700		done
701	done | ${XARGS} ${SED} ${SUBST}
702}
703
704
705list_kernel_configs()
706{
707	(cd ${NETBSDSRCDIR}/etc
708	MAKEFLAGS= \
709	${MAKE} -m ${NETBSDSRCDIR}/share/mk -V '${ALL_KERNELS}')
710}
711
712# arch_to_cpu mach
713#
714# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach,
715# as determined by <bsd.own.mk>.
716#
717arch_to_cpu()
718{
719	MACHINE_ARCH=${1} MAKEFLAGS= \
720	${MAKE} -m ${NETBSDSRCDIR}/share/mk \
721		-f ${NETBSDSRCDIR}/share/mk/bsd.own.mk \
722		-V '${MACHINE_CPU}'
723}
724
725# arch_to_endian mach
726#
727# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach,
728# as determined by <bsd.endian.mk>.
729#
730arch_to_endian()
731{
732	MACHINE_ARCH=${1} MAKEFLAGS= \
733	${MAKE} -m ${NETBSDSRCDIR}/share/mk \
734		-f ${NETBSDSRCDIR}/share/mk/bsd.endian.mk \
735		-V '${TARGET_ENDIANNESS}'
736}
737
738#####
739
740# print_mkvars
741print_mkvars()
742{
743	for v in $MKVARS; do
744		eval echo $v=\$$v
745	done
746}
747
748# print_set_lists_{base,x,ext}
749# list_set_lists_{base,x,ext}
750# list_set_files_{base,x,ext}
751for func in print_set_lists list_set_lists list_set_files; do
752	for x in base x ext; do
753		if [ $x = base ]; then
754			list=nlists
755		else
756			list=${x}lists
757		fi
758		eval ${func}_${x} \(\) \{ $func \$$list \; \}
759	done
760done
761