makeflist revision 1.53
11.2Sgwr#!/bin/sh
21.2Sgwr#
31.53Sthorpej# $NetBSD: makeflist,v 1.53 2002/10/09 01:22:37 thorpej Exp $
41.2Sgwr#
51.8Slukem# Print out the files in some or all lists.
61.8Slukem# Usage: makeflist [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
71.2Sgwr#
81.2Sgwr
91.2Sgwr# set defaults
101.49SlukemMAKE="${MAKE:-make} -j 1"
111.39Sthorpejmachine=`${MAKE} print_machine`
121.39Sthorpejmachine_arch=`${MAKE} print_machine_arch`
131.39Sthorpejmachine_cpu=`${MAKE} print_machine_cpu`
141.39Sthorpejobject_fmt=`${MAKE} print_object_fmt`
151.51Slukemtoolchain_missing=`${MAKE} print_toolchain_missing`
161.41Stronx11_version=`${MAKE} print_x11_version`
171.2Sgwrsetd=`pwd`
181.8Slukemnlists="base comp etc games man misc text"
191.44Stronxlists="xbase xcomp xcontrib xfont xserver xmisc"
201.8Slukemlists=$nlists
211.2Sgwr
221.2Sgwr# handle args
231.8Slukemwhile : ; do
241.2Sgwr	case $1 in
251.8Slukem	-b*)
261.8Slukem		lists="$xlists $nlists"
271.8Slukem		;;
281.8Slukem	-x*)
291.8Slukem		lists=$xlists
301.8Slukem		;;
311.8Slukem	-a*)
321.39Sthorpej		machine_arch=`MACHINE_ARCH=${2} ${MAKE} print_machine_arch`
331.39Sthorpej		machine_cpu=`MACHINE_ARCH=${2} ${MAKE} print_machine_cpu`
341.39Sthorpej		shift
351.8Slukem		;;
361.8Slukem	-m*)
371.8Slukem		machine=$2; shift
381.8Slukem		;;
391.8Slukem	-s*)
401.8Slukem		setd=$2; shift
411.8Slukem		;;
421.8Slukem	-*)
431.8Slukem		cat 1>&2 <<USAGE
441.8SlukemUsage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
451.8Slukem	-b		make netbsd + x11 lists
461.8Slukem	-x		only make x11 lists
471.40Sthorpej	-a arch		set arch (e.g, m68k, mipseb, mipsel, powerpc) [$machine_arch]
481.39Sthorpej	-m machine	set machine (e.g, amiga, i386, macppc) [$machine]
491.39Sthorpej	-s setsdir	directory to find sets [$setd]
501.39Sthorpej	[setname ...]	sets to build [$lists]
511.8SlukemUSAGE
521.8Slukem		exit 1
531.8Slukem		;;
541.8Slukem	*)
551.8Slukem		break
561.8Slukem		;;
571.2Sgwr	esac
581.2Sgwr	shift
591.2Sgwrdone
601.8Slukemif [ -n "$1" ]; then
611.8Slukem	lists="$@"
621.8Slukemfi
631.15Ssimonb
641.43Sfredette# Determine lib type.
651.39Sthorpejif [ "$object_fmt" = "ELF" ]; then
661.28Sitojun	shlib=elf
671.9Sjonathanelse
681.39Sthorpej	shlib=aout
691.9Sjonathanfi
701.43Sfredettestlib=$shlib
711.43Sfredette
721.43Sfredette# Turn off shlibs for some ports.
731.43Sfredetteif [ "$machine_cpu" = "sh3" -o "$machine_arch" = "m68000" ]; then
741.43Sfredette	shlib=no
751.43Sfredettefi
761.1Scgd
771.33Smrg# Turn off lintlibs for some ports.
781.33Smrglintlibs=
791.45Swizif [ "$machine" = "x86_64" ]; then
801.33Smrg	lintlibs=no
811.33Smrgfi
821.44Stron
831.44Stron# Automatically add XFree86 version specific sets
841.44Stronfor list in $lists
851.44Strondo
861.44Stron if [ -z "$_lists" ]
871.44Stron then
881.44Stron  _lists=$list
891.44Stron else
901.44Stron  _lists="$_lists $list"
911.44Stron fi
921.44Stron if [ -d "$setd/lists/$list${x11_version}" ]
931.44Stron then
941.44Stron  _lists="$_lists $list${x11_version}"
951.44Stron fi
961.44Strondone
971.44Stronlists=$_lists
981.44Stronunset _lists
991.33Smrg
1001.8Slukemfor setname in $lists; do
1011.29Sjwise	cat $setd/lists/$setname/mi
1021.48Sfredette	if [ "$machine" != "$machine_arch" ]; then
1031.50Sthorpej		# Prefer an ad.${machine_arch} over an ad.${machine_cpu},
1041.50Sthorpej		# since the arch-specific one will be more specific than
1051.50Sthorpej		# the cpu-specific one.
1061.50Sthorpej		if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
1071.50Sthorpej			cat $setd/lists/$setname/ad.${machine_arch}
1081.50Sthorpej		elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
1091.48Sfredette			cat $setd/lists/$setname/ad.${machine_cpu}
1101.48Sfredette		fi
1111.48Sfredette		if [ "$shlib" != "no" -a \
1121.48Sfredette		     -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
1131.48Sfredette			cat $setd/lists/$setname/ad.${machine_cpu}.shl
1141.48Sfredette		fi
1151.8Slukem	fi
1161.8Slukem	if [ -f $setd/lists/$setname/md.${machine} ]; then
1171.29Sjwise		cat $setd/lists/$setname/md.${machine}
1181.9Sjonathan	fi
1191.43Sfredette	if [ -f $setd/lists/$setname/stl.mi ]; then
1201.43Sfredette		cat $setd/lists/$setname/stl.mi
1211.43Sfredette	fi
1221.43Sfredette	if [ -f $setd/lists/$setname/stl.${stlib} ]; then
1231.43Sfredette		cat $setd/lists/$setname/stl.${stlib}
1241.43Sfredette	fi
1251.43Sfredette	if [ "$shlib" != "no" ]; then
1261.9Sjonathan		if [ -f $setd/lists/$setname/shl.mi ]; then
1271.29Sjwise			cat $setd/lists/$setname/shl.mi
1281.9Sjonathan		fi
1291.9Sjonathan		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
1301.29Sjwise			cat $setd/lists/$setname/shl.${shlib}
1311.33Smrg		fi
1321.33Smrg	fi
1331.33Smrg	if [ "$lintlibs" != no ]; then
1341.33Smrg		if [ -f $setd/lists/$setname/lint.mi ]; then
1351.33Smrg			cat $setd/lists/$setname/lint.mi
1361.36Sjmc		fi
1371.36Sjmc	fi
1381.51Slukem	if [ "$toolchain_missing" != "yes" ]; then
1391.36Sjmc		if [ -f $setd/lists/$setname/tc.mi ]; then
1401.36Sjmc			cat $setd/lists/$setname/tc.mi
1411.46Sthorpej		fi
1421.46Sthorpej		if [ "$shlib" != "no" ]; then
1431.46Sthorpej			if [ -f $setd/lists/$setname/tc.shl ]; then
1441.47Snathanw				cat $setd/lists/$setname/tc.shl
1451.46Sthorpej			fi
1461.53Sthorpej		fi
1471.53Sthorpej	fi
1481.53Sthorpej
1491.53Sthorpej	# XXX MIPS does not support rescue right now.
1501.53Sthorpej	if [ ${machine_cpu} = "mips" ]; then
1511.53Sthorpej		continue
1521.53Sthorpej	fi
1531.53Sthorpej
1541.53Sthorpej	if [ -f $setd/lists/$setname/rescue.mi ]; then
1551.53Sthorpej		cat $setd/lists/$setname/rescue.mi
1561.53Sthorpej	fi
1571.53Sthorpej	if [ -f $setd/lists/$setname/rescue.${machine} ]; then
1581.53Sthorpej		cat $setd/lists/$setname/rescue.${machine}
1591.53Sthorpej	fi
1601.53Sthorpej	if [ "$machine" != "$machine_arch" ]; then
1611.53Sthorpej		# Prefer a rescue.ad.${machine_arch} over a
1621.53Sthorpej		# rescue.ad.${machine_cpu}, since the arch-
1631.53Sthorpej		# specific one will be more specific than the
1641.53Sthorpej		# cpu-specific one.
1651.53Sthorpej		if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
1661.53Sthorpej			cat $setd/lists/$setname/rescue.ad.${machine_arch}
1671.53Sthorpej		elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
1681.53Sthorpej			cat $setd/lists/$setname/rescue.ad.${machine_cpu}
1691.53Sthorpej		fi
1701.53Sthorpej		if [ "$shlib" != "no" -a \
1711.53Sthorpej		     -f $setd/lists/$setname/rescue.ad.${machine_cpu}.shl]; then
1721.53Sthorpej			cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
1731.9Sjonathan		fi
1741.8Slukem	fi
1751.42Slukemdone | awk -- '/^[^#]/ {print $1}' | sort -u
176