makeplist revision 1.5
11.1Sjwise#!/bin/sh
21.1Sjwise#
31.1Sjwise# Print out the files in some or all lists.
41.4Sdyoung# Usage: makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
51.1Sjwise#
61.1Sjwise
71.1Sjwise# set defaults
81.3SlukemMAKE="${MAKE:-make} -j 1"
91.3Slukemmachine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | ${MAKE} -s -f-`}
101.3Slukemarch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | ${MAKE} -s -f-`}
111.1Sjwisesetd=`dirname $0`
121.1Sjwiseprefix=/
131.1Sjwise
141.1Sjwiseusage() {
151.1Sjwiseexec 1>&2
161.1Sjwise
171.1Sjwiseecho "Usage: $0 [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname"
181.1Sjwiseecho "	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]"
191.1Sjwiseecho "	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]"
201.1Sjwiseecho "	-s setsdir	directory to find sets			[$setd]"
211.5Sdyoungecho "	-p prefix	prefix for created plist		[$prefix]"
221.1Sjwiseecho "	setname pkgname	set and package to build plist for"
231.1Sjwise
241.1Sjwiseexit 1
251.1Sjwise}
261.1Sjwise
271.1Sjwise# handle args
281.1Sjwisewhile : ; do
291.1Sjwise	case $1 in
301.1Sjwise	-a*)
311.1Sjwise		arch=$2; shift
321.1Sjwise		;;
331.1Sjwise	-m*)
341.1Sjwise		machine=$2; shift
351.1Sjwise		;;
361.1Sjwise	-s*)
371.1Sjwise		setd=$2; shift
381.1Sjwise		;;
391.1Sjwise	-p*)
401.1Sjwise		prefix=$2; shift
411.1Sjwise		;;
421.1Sjwise	-*)
431.1Sjwise		usage
441.1Sjwise		exit 1
451.1Sjwise		;;
461.1Sjwise	*)
471.1Sjwise		break
481.1Sjwise		;;
491.1Sjwise	esac
501.1Sjwise	shift
511.1Sjwisedone
521.1Sjwiseif [ -n "$1" ]; then
531.1Sjwise	setname="$1"
541.1Sjwiseelse
551.1Sjwise	usage
561.1Sjwise	exit 1
571.1Sjwisefi
581.1Sjwiseif [ -n "$2" ]; then
591.1Sjwise	pkgname=$2
601.1Sjwiseelse
611.1Sjwise	usage
621.1Sjwise	exit 1
631.1Sjwisefi
641.1Sjwise
651.1Sjwise# Convert mipse[lb] to mips after processing command line arguments.
661.1Sjwisearch=`echo $arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3,`
671.1Sjwise
681.1Sjwise# Compute toolchain  used on target cpu.
691.2Sbjh21if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" -o "$arch" = "sparc" -o "$arch" = "sparc64" -o "$arch" = "i386" -o "$arch" = "arm" -o "$machine" = "mvme68k" -o "$machine" = "hp300" ]; then
701.1Sjwise	shlib=elf
711.1Sjwiseelse
721.1Sjwise	if [ "$arch" = "sh3" ]; then
731.1Sjwise		shlib=
741.1Sjwise	else
751.1Sjwise		shlib=aout
761.1Sjwise	fi
771.1Sjwisefi
781.1Sjwise
791.1Sjwiseecho "@cwd $prefix"
801.1Sjwise(
811.1Sjwise	cat $setd/lists/$setname/mi
821.1Sjwise	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
831.1Sjwise		cat $setd/lists/$setname/ad.${arch}
841.1Sjwise	fi
851.1Sjwise	if [ -f $setd/lists/$setname/md.${machine} ]; then
861.1Sjwise		cat $setd/lists/$setname/md.${machine}
871.1Sjwise	fi
881.1Sjwise	if [ "$shlib" != "" ]; then
891.1Sjwise		if [ -f $setd/lists/$setname/shl.mi ]; then
901.1Sjwise			cat $setd/lists/$setname/shl.mi
911.1Sjwise		fi
921.1Sjwise		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
931.1Sjwise			cat $setd/lists/$setname/shl.${shlib}
941.1Sjwise		fi
951.1Sjwise	fi
961.1Sjwise)| egrep -v '^#' | egrep $pkgname\$ | awk -- '{print $1}' | sort -u
97