makeflist revision 1.59
11.2Sgwr#!/bin/sh
21.2Sgwr#
31.58Ssimonb# $NetBSD: makeflist,v 1.59 2003/03/15 22:32:09 he 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.59Shelkm=yes
771.59She# Turn off LKMs for some ports.
781.59Sheif [ "$machine" = "evbppc" ]; then
791.59She	lkm=no
801.59Shefi
811.1Scgd
821.33Smrg# Turn off lintlibs for some ports.
831.57Sfvdl# Not needed anymore, leave the hook here for future use.
841.33Smrglintlibs=
851.44Stron
861.44Stron# Automatically add XFree86 version specific sets
871.44Stronfor list in $lists
881.44Strondo
891.44Stron if [ -z "$_lists" ]
901.44Stron then
911.44Stron  _lists=$list
921.44Stron else
931.44Stron  _lists="$_lists $list"
941.44Stron fi
951.44Stron if [ -d "$setd/lists/$list${x11_version}" ]
961.44Stron then
971.44Stron  _lists="$_lists $list${x11_version}"
981.44Stron fi
991.44Strondone
1001.44Stronlists=$_lists
1011.44Stronunset _lists
1021.33Smrg
1031.8Slukemfor setname in $lists; do
1041.29Sjwise	cat $setd/lists/$setname/mi
1051.48Sfredette	if [ "$machine" != "$machine_arch" ]; then
1061.50Sthorpej		# Prefer an ad.${machine_arch} over an ad.${machine_cpu},
1071.50Sthorpej		# since the arch-specific one will be more specific than
1081.50Sthorpej		# the cpu-specific one.
1091.50Sthorpej		if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
1101.50Sthorpej			cat $setd/lists/$setname/ad.${machine_arch}
1111.50Sthorpej		elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
1121.48Sfredette			cat $setd/lists/$setname/ad.${machine_cpu}
1131.48Sfredette		fi
1141.48Sfredette		if [ "$shlib" != "no" -a \
1151.48Sfredette		     -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
1161.48Sfredette			cat $setd/lists/$setname/ad.${machine_cpu}.shl
1171.48Sfredette		fi
1181.8Slukem	fi
1191.8Slukem	if [ -f $setd/lists/$setname/md.${machine} ]; then
1201.29Sjwise		cat $setd/lists/$setname/md.${machine}
1211.9Sjonathan	fi
1221.43Sfredette	if [ -f $setd/lists/$setname/stl.mi ]; then
1231.43Sfredette		cat $setd/lists/$setname/stl.mi
1241.43Sfredette	fi
1251.43Sfredette	if [ -f $setd/lists/$setname/stl.${stlib} ]; then
1261.43Sfredette		cat $setd/lists/$setname/stl.${stlib}
1271.43Sfredette	fi
1281.43Sfredette	if [ "$shlib" != "no" ]; then
1291.9Sjonathan		if [ -f $setd/lists/$setname/shl.mi ]; then
1301.29Sjwise			cat $setd/lists/$setname/shl.mi
1311.9Sjonathan		fi
1321.9Sjonathan		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
1331.29Sjwise			cat $setd/lists/$setname/shl.${shlib}
1341.59She		fi
1351.59She	fi
1361.59She	if [ "$lkm" != "no" ]; then
1371.59She		if [ -f $setd/lists/$setname/lkm.mi ]; then
1381.59She			cat $setd/lists/$setname/lkm.mi
1391.33Smrg		fi
1401.33Smrg	fi
1411.33Smrg	if [ "$lintlibs" != no ]; then
1421.33Smrg		if [ -f $setd/lists/$setname/lint.mi ]; then
1431.33Smrg			cat $setd/lists/$setname/lint.mi
1441.36Sjmc		fi
1451.36Sjmc	fi
1461.51Slukem	if [ "$toolchain_missing" != "yes" ]; then
1471.36Sjmc		if [ -f $setd/lists/$setname/tc.mi ]; then
1481.36Sjmc			cat $setd/lists/$setname/tc.mi
1491.46Sthorpej		fi
1501.46Sthorpej		if [ "$shlib" != "no" ]; then
1511.46Sthorpej			if [ -f $setd/lists/$setname/tc.shl ]; then
1521.47Snathanw				cat $setd/lists/$setname/tc.shl
1531.46Sthorpej			fi
1541.53Sthorpej		fi
1551.53Sthorpej	fi
1561.53Sthorpej
1571.53Sthorpej	if [ -f $setd/lists/$setname/rescue.mi ]; then
1581.53Sthorpej		cat $setd/lists/$setname/rescue.mi
1591.53Sthorpej	fi
1601.53Sthorpej	if [ -f $setd/lists/$setname/rescue.${machine} ]; then
1611.53Sthorpej		cat $setd/lists/$setname/rescue.${machine}
1621.53Sthorpej	fi
1631.53Sthorpej	if [ "$machine" != "$machine_arch" ]; then
1641.53Sthorpej		# Prefer a rescue.ad.${machine_arch} over a
1651.53Sthorpej		# rescue.ad.${machine_cpu}, since the arch-
1661.53Sthorpej		# specific one will be more specific than the
1671.53Sthorpej		# cpu-specific one.
1681.53Sthorpej		if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
1691.53Sthorpej			cat $setd/lists/$setname/rescue.ad.${machine_arch}
1701.53Sthorpej		elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
1711.53Sthorpej			cat $setd/lists/$setname/rescue.ad.${machine_cpu}
1721.53Sthorpej		fi
1731.54Sbriggs		if [ "$shlib" != "no" -a -f \
1741.54Sbriggs		     $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
1751.53Sthorpej			cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
1761.9Sjonathan		fi
1771.8Slukem	fi
1781.42Slukemdone | awk -- '/^[^#]/ {print $1}' | sort -u
179