NetBSD/distrib/sets/makeflist

111 lines
2.4 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: makeflist,v 1.40 2001/11/24 03:06:17 thorpej 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=`${MAKE} print_machine`
machine_arch=`${MAKE} print_machine_arch`
machine_cpu=`${MAKE} print_machine_cpu`
object_fmt=`${MAKE} print_object_fmt`
tc=`${MAKE} print_use_new_toolchain`
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*)
machine_arch=`MACHINE_ARCH=${2} ${MAKE} print_machine_arch`
machine_cpu=`MACHINE_ARCH=${2} ${MAKE} print_machine_cpu`
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, mipseb, mipsel, powerpc) [$machine_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
# Determine shlib type.
if [ "$object_fmt" = "ELF" ]; then
shlib=elf
elif [ "$machine_cpu" = "sh3" ]; then
shlib=
else
shlib=aout
fi
# Turn off lintlibs for some ports.
lintlibs=
if [ "$machine" = "sparc64" -o "$machine_cpu" = "sh3" -o \
"$machine_arch" = "m68000" ]; then
lintlibs=no
fi
for setname in $lists; do
cat $setd/lists/$setname/mi
if [ "$machine" != "$machine_arch" -a \
-f $setd/lists/$setname/ad.${machine_cpu} ]; then
cat $setd/lists/$setname/ad.${machine_cpu}
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