makeflist revision 1.42
11.2Sgwr#!/bin/sh
21.2Sgwr#
31.42Slukem# $NetBSD: makeflist,v 1.42 2002/02/27 10:42:55 lukem 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.14Sitohy: ${MAKE=make}
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.39Sthorpejtc=`${MAKE} print_use_new_toolchain`
161.41Stronx11_version=`${MAKE} print_x11_version`
171.2Sgwrsetd=`pwd`
181.8Slukemnlists="base comp etc games man misc text"
191.41Stronxlists=
201.41Stronfor xlist in xbase xcomp xcontrib xfont xserver xmisc
211.41Strondo
221.41Stron if [ -z "$xlists" ]
231.41Stron then
241.41Stron  xlists=$xlist
251.41Stron else
261.41Stron  xlists="$xlists $xlist"
271.41Stron fi
281.41Stron if [ -d "$setd/lists/$xlist${x11_version}" ]
291.41Stron then
301.41Stron  xlists="$xlists $xlist${x11_version}"
311.41Stron fi
321.41Strondone
331.8Slukemlists=$nlists
341.2Sgwr
351.2Sgwr# handle args
361.8Slukemwhile : ; do
371.2Sgwr	case $1 in
381.8Slukem	-b*)
391.8Slukem		lists="$xlists $nlists"
401.8Slukem		;;
411.8Slukem	-x*)
421.8Slukem		lists=$xlists
431.8Slukem		;;
441.8Slukem	-a*)
451.39Sthorpej		machine_arch=`MACHINE_ARCH=${2} ${MAKE} print_machine_arch`
461.39Sthorpej		machine_cpu=`MACHINE_ARCH=${2} ${MAKE} print_machine_cpu`
471.39Sthorpej		shift
481.8Slukem		;;
491.8Slukem	-m*)
501.8Slukem		machine=$2; shift
511.8Slukem		;;
521.8Slukem	-s*)
531.8Slukem		setd=$2; shift
541.8Slukem		;;
551.8Slukem	-*)
561.8Slukem		cat 1>&2 <<USAGE
571.8SlukemUsage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
581.8Slukem	-b		make netbsd + x11 lists
591.8Slukem	-x		only make x11 lists
601.40Sthorpej	-a arch		set arch (e.g, m68k, mipseb, mipsel, powerpc) [$machine_arch]
611.39Sthorpej	-m machine	set machine (e.g, amiga, i386, macppc) [$machine]
621.39Sthorpej	-s setsdir	directory to find sets [$setd]
631.39Sthorpej	[setname ...]	sets to build [$lists]
641.8SlukemUSAGE
651.8Slukem		exit 1
661.8Slukem		;;
671.8Slukem	*)
681.8Slukem		break
691.8Slukem		;;
701.2Sgwr	esac
711.2Sgwr	shift
721.2Sgwrdone
731.8Slukemif [ -n "$1" ]; then
741.8Slukem	lists="$@"
751.8Slukemfi
761.15Ssimonb
771.39Sthorpej# Determine shlib type.
781.39Sthorpejif [ "$object_fmt" = "ELF" ]; then
791.28Sitojun	shlib=elf
801.39Sthorpejelif [ "$machine_cpu" = "sh3" ]; then
811.39Sthorpej	shlib=
821.9Sjonathanelse
831.39Sthorpej	shlib=aout
841.9Sjonathanfi
851.1Scgd
861.33Smrg# Turn off lintlibs for some ports.
871.33Smrglintlibs=
881.39Sthorpejif [ "$machine" = "sparc64" -o "$machine_cpu" = "sh3" -o \
891.39Sthorpej     "$machine_arch" = "m68000" ]; then
901.33Smrg	lintlibs=no
911.33Smrgfi
921.33Smrg
931.8Slukemfor setname in $lists; do
941.29Sjwise	cat $setd/lists/$setname/mi
951.39Sthorpej	if [ "$machine" != "$machine_arch" -a \
961.39Sthorpej	     -f $setd/lists/$setname/ad.${machine_cpu} ]; then
971.39Sthorpej		cat $setd/lists/$setname/ad.${machine_cpu}
981.8Slukem	fi
991.8Slukem	if [ -f $setd/lists/$setname/md.${machine} ]; then
1001.29Sjwise		cat $setd/lists/$setname/md.${machine}
1011.9Sjonathan	fi
1021.9Sjonathan	if [ "$shlib" != "" ]; then
1031.9Sjonathan		if [ -f $setd/lists/$setname/shl.mi ]; then
1041.29Sjwise			cat $setd/lists/$setname/shl.mi
1051.9Sjonathan		fi
1061.9Sjonathan		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
1071.29Sjwise			cat $setd/lists/$setname/shl.${shlib}
1081.33Smrg		fi
1091.33Smrg	fi
1101.33Smrg	if [ "$lintlibs" != no ]; then
1111.33Smrg		if [ -f $setd/lists/$setname/lint.mi ]; then
1121.33Smrg			cat $setd/lists/$setname/lint.mi
1131.36Sjmc		fi
1141.36Sjmc	fi
1151.38Stv	if [ "$tc" = "yes" ]; then
1161.36Sjmc		if [ -f $setd/lists/$setname/tc.mi ]; then
1171.36Sjmc			cat $setd/lists/$setname/tc.mi
1181.36Sjmc		fi
1191.36Sjmc	else
1201.36Sjmc		if [ -f $setd/lists/$setname/tc.old ]; then
1211.36Sjmc			cat $setd/lists/$setname/tc.old
1221.9Sjonathan		fi
1231.8Slukem	fi
1241.42Slukemdone | awk -- '/^[^#]/ {print $1}' | sort -u
125