NetBSD/distrib/sets/makeflist

110 lines
2.8 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: makeflist,v 1.36 2001/10/20 06:11:21 jmc Exp $
#
# Print out the files in some or all lists.
# Usage: makeflist [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
#
# set defaults
: ${MAKE=make}
machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | $MAKE -s -f-`}
arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | $MAKE -s -f-`}
tc=${USE_NEW_TOOLCHAIN:-`printf '.include <bsd.own.mk>\nxxx:\n\techo ${USE_NEW_TOOLCHAIN}' | /usr/bin/make -m /usr/src/share/mk -s -f-`}
setd=`pwd`
nlists="base comp etc games man misc text"
xlists="xbase xcomp xcontrib xfont xserver xmisc"
lists=$nlists
# handle args
while : ; do
case $1 in
-b*)
lists="$xlists $nlists"
;;
-x*)
lists=$xlists
;;
-a*)
arch=$2; shift
;;
-m*)
machine=$2; shift
;;
-s*)
setd=$2; shift
;;
-*)
cat 1>&2 <<USAGE
Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
-b make netbsd + x11 lists
-x only make x11 lists
-a arch set arch (e.g, m68k, mips, powerpc) [$arch]
-m machine set machine (e.g, amiga, i386, macppc) [$machine]
-s setsdir directory to find sets [$setd]
[setname ...] sets to build [$lists]
USAGE
exit 1
;;
*)
break
;;
esac
shift
done
if [ -n "$1" ]; then
lists="$@"
fi
# Convert mipse[lb] to mips after processing command line arguments.
arch=`echo $arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3,`
# Compute toolchain used on target cpu.
if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" -o "$arch" = "sparc" -o "$arch" = "sparc64" -o "$arch" = "i386" -o "$arch" = "arm26" -o "$machine" = "hp300" -o "$machine" = "mvme68k" -o "$machine" = "news68k" -o "$machine" = "sun3" -o "$machine" = "next68k" -o "$machine" = "cesfic" -o "$machine" = "atari" ]; then
shlib=elf
else
if [ "$arch" = "sh3" ]; then
shlib=
else
shlib=aout
fi
fi
# Turn off lintlibs for some ports.
lintlibs=
if [ "$machine" = "sparc64" -o "$arch" = "sh3" -o "$arch" = "m68000" ]; then
lintlibs=no
fi
for setname in $lists; do
cat $setd/lists/$setname/mi
if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
cat $setd/lists/$setname/ad.${arch}
fi
if [ -f $setd/lists/$setname/md.${machine} ]; then
cat $setd/lists/$setname/md.${machine}
fi
if [ "$shlib" != "" ]; then
if [ -f $setd/lists/$setname/shl.mi ]; then
cat $setd/lists/$setname/shl.mi
fi
if [ -f $setd/lists/$setname/shl.${shlib} ]; then
cat $setd/lists/$setname/shl.${shlib}
fi
fi
if [ "$lintlibs" != no ]; then
if [ -f $setd/lists/$setname/lint.mi ]; then
cat $setd/lists/$setname/lint.mi
fi
fi
if [ "$tc" = "yes" ]; then
if [ -f $setd/lists/$setname/tc.mi ]; then
cat $setd/lists/$setname/tc.mi
fi
else
if [ -f $setd/lists/$setname/tc.old ]; then
cat $setd/lists/$setname/tc.old
fi
fi
done | egrep -v '^#' | awk -- '{print $1}' | sort -u