makeflist revision 1.57
11.2Sgwr#!/bin/sh
21.2Sgwr#
31.57Sfvdl# $NetBSD: makeflist,v 1.57 2002/12/10 22:00:56 fvdl 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.56Slukemmake="${MAKE:-make} -j 1 -f `dirname $0`/Makefile"
111.56Slukemmachine=`${make} print_machine`
121.56Slukemmachine_arch=`${make} print_machine_arch`
131.56Slukemmachine_cpu=`${make} print_machine_cpu`
141.56Slukemobject_fmt=`${make} print_object_fmt`
151.56Slukemtoolchain_missing=`${make} print_toolchain_missing`
161.56Slukemx11_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.56Slukem		machine_arch=`MACHINE_ARCH=${2} ${make} print_machine_arch`
331.56Slukem		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.57Sfvdl# Not needed anymore, leave the hook here for future use.
791.33Smrglintlibs=
801.44Stron
811.44Stron# Automatically add XFree86 version specific sets
821.44Stronfor list in $lists
831.44Strondo
841.44Stron if [ -z "$_lists" ]
851.44Stron then
861.44Stron  _lists=$list
871.44Stron else
881.44Stron  _lists="$_lists $list"
891.44Stron fi
901.44Stron if [ -d "$setd/lists/$list${x11_version}" ]
911.44Stron then
921.44Stron  _lists="$_lists $list${x11_version}"
931.44Stron fi
941.44Strondone
951.44Stronlists=$_lists
961.44Stronunset _lists
971.33Smrg
981.8Slukemfor setname in $lists; do
991.29Sjwise	cat $setd/lists/$setname/mi
1001.48Sfredette	if [ "$machine" != "$machine_arch" ]; then
1011.50Sthorpej		# Prefer an ad.${machine_arch} over an ad.${machine_cpu},
1021.50Sthorpej		# since the arch-specific one will be more specific than
1031.50Sthorpej		# the cpu-specific one.
1041.50Sthorpej		if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
1051.50Sthorpej			cat $setd/lists/$setname/ad.${machine_arch}
1061.50Sthorpej		elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
1071.48Sfredette			cat $setd/lists/$setname/ad.${machine_cpu}
1081.48Sfredette		fi
1091.48Sfredette		if [ "$shlib" != "no" -a \
1101.48Sfredette		     -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
1111.48Sfredette			cat $setd/lists/$setname/ad.${machine_cpu}.shl
1121.48Sfredette		fi
1131.8Slukem	fi
1141.8Slukem	if [ -f $setd/lists/$setname/md.${machine} ]; then
1151.29Sjwise		cat $setd/lists/$setname/md.${machine}
1161.9Sjonathan	fi
1171.43Sfredette	if [ -f $setd/lists/$setname/stl.mi ]; then
1181.43Sfredette		cat $setd/lists/$setname/stl.mi
1191.43Sfredette	fi
1201.43Sfredette	if [ -f $setd/lists/$setname/stl.${stlib} ]; then
1211.43Sfredette		cat $setd/lists/$setname/stl.${stlib}
1221.43Sfredette	fi
1231.43Sfredette	if [ "$shlib" != "no" ]; then
1241.9Sjonathan		if [ -f $setd/lists/$setname/shl.mi ]; then
1251.29Sjwise			cat $setd/lists/$setname/shl.mi
1261.9Sjonathan		fi
1271.9Sjonathan		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
1281.29Sjwise			cat $setd/lists/$setname/shl.${shlib}
1291.33Smrg		fi
1301.33Smrg	fi
1311.33Smrg	if [ "$lintlibs" != no ]; then
1321.33Smrg		if [ -f $setd/lists/$setname/lint.mi ]; then
1331.33Smrg			cat $setd/lists/$setname/lint.mi
1341.36Sjmc		fi
1351.36Sjmc	fi
1361.51Slukem	if [ "$toolchain_missing" != "yes" ]; then
1371.36Sjmc		if [ -f $setd/lists/$setname/tc.mi ]; then
1381.36Sjmc			cat $setd/lists/$setname/tc.mi
1391.46Sthorpej		fi
1401.46Sthorpej		if [ "$shlib" != "no" ]; then
1411.46Sthorpej			if [ -f $setd/lists/$setname/tc.shl ]; then
1421.47Snathanw				cat $setd/lists/$setname/tc.shl
1431.46Sthorpej			fi
1441.53Sthorpej		fi
1451.53Sthorpej	fi
1461.53Sthorpej
1471.53Sthorpej	# XXX MIPS does not support rescue right now.
1481.53Sthorpej	if [ ${machine_cpu} = "mips" ]; then
1491.53Sthorpej		continue
1501.53Sthorpej	fi
1511.53Sthorpej
1521.53Sthorpej	if [ -f $setd/lists/$setname/rescue.mi ]; then
1531.53Sthorpej		cat $setd/lists/$setname/rescue.mi
1541.53Sthorpej	fi
1551.53Sthorpej	if [ -f $setd/lists/$setname/rescue.${machine} ]; then
1561.53Sthorpej		cat $setd/lists/$setname/rescue.${machine}
1571.53Sthorpej	fi
1581.53Sthorpej	if [ "$machine" != "$machine_arch" ]; then
1591.53Sthorpej		# Prefer a rescue.ad.${machine_arch} over a
1601.53Sthorpej		# rescue.ad.${machine_cpu}, since the arch-
1611.53Sthorpej		# specific one will be more specific than the
1621.53Sthorpej		# cpu-specific one.
1631.53Sthorpej		if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
1641.53Sthorpej			cat $setd/lists/$setname/rescue.ad.${machine_arch}
1651.53Sthorpej		elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
1661.53Sthorpej			cat $setd/lists/$setname/rescue.ad.${machine_cpu}
1671.53Sthorpej		fi
1681.54Sbriggs		if [ "$shlib" != "no" -a -f \
1691.54Sbriggs		     $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
1701.53Sthorpej			cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
1711.9Sjonathan		fi
1721.8Slukem	fi
1731.42Slukemdone | awk -- '/^[^#]/ {print $1}' | sort -u
174