makeflist revision 1.21
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.21 2000/06/20 06:00:28 thorpej Exp $
4#
5# Print out the files in some or all lists.
6# Usage: makeflist [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
7#
8
9# set defaults
10: ${MAKE=make}
11machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | $MAKE -s -f-`}
12arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | $MAKE -s -f-`}
13setd=`pwd`
14nlists="base comp etc games man misc text"
15xlists="xbase xcomp xcontrib xfont xserver"
16lists=$nlists
17
18# handle args
19while : ; do
20	case $1 in
21	-b*)
22		lists="$xlists $nlists"
23		;;
24	-x*)
25		lists=$xlists
26		;;
27	-a*)
28		arch=$2; shift
29		;;
30	-m*)
31		machine=$2; shift
32		;;
33	-s*)
34		setd=$2; shift
35		;;
36	-*)
37		cat 1>&2 <<USAGE
38Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
39	-b		make netbsd + x11 lists
40	-x		only make x11 lists
41	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
42	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
43	-s setsdir	directory to find sets	[$setd]
44	[setname ...]	sets to build 	[$lists]
45USAGE
46		exit 1
47		;;
48	*)
49		break
50		;;
51	esac
52	shift
53done
54if [ -n "$1" ]; then
55	lists="$@"
56fi
57
58# Convert mipse[lb] to mips after processing command line arguments.
59arch=`echo $arch | sed s,^mipse.,mips,`
60
61# Compute toolchain  used on target cpu.
62if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" -o "$arch" = "sparc" -o "$arch" = "i386" ]; then
63        shlib=elf
64else
65        shlib=aout
66fi
67
68for setname in $lists; do
69	awk -- '{print $1}' $setd/lists/$setname/mi
70	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
71		awk -- '{print $1}' $setd/lists/$setname/ad.${arch}
72	fi
73	if [ -f $setd/lists/$setname/md.${machine} ]; then
74		awk -- '{print $1}' $setd/lists/$setname/md.${machine}
75	fi
76	if [ "$shlib" != "" ]; then
77		if [ -f $setd/lists/$setname/shl.mi ]; then
78			awk -- '{print $1}' $setd/lists/$setname/shl.mi
79		fi
80		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
81			awk -- '{print $1}' $setd/lists/$setname/shl.${shlib}
82		fi
83	fi
84
85	# Split man/md_share into: this machine, other machine
86	if [ $setname = man ]; then
87		grep ${machine} $setd/lists/man/md_share
88	fi
89	if [ $setname = misc ]; then
90		grep -v ${machine} $setd/lists/man/md_share
91	fi
92
93done | egrep -v '^#' | sort -u
94