makeflist revision 1.13
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.13 1999/02/09 19:34:18 tv 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
10machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | make -s -f-`}
11arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | make -s -f-`}
12arch=`echo $arch | sed s,^mipse.,mips,`
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	-d*)
22		nlists="$nlists secr"
23		lists=$nlists
24		;;
25	-b*)
26		lists="$xlists $nlists"
27		;;
28	-x*)
29		lists=$xlists
30		;;
31	-a*)
32		arch=$2; shift
33		;;
34	-m*)
35		machine=$2; shift
36		;;
37	-s*)
38		setd=$2; shift
39		;;
40	-*)
41		cat 1>&2 <<USAGE
42Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
43	-b		make netbsd + x11 lists
44	-d		do domestic ("secr") sets
45	-x		only make x11 lists
46	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
47	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
48	-s setsdir	directory to find sets	[$setd]
49	[setname ...]	sets to build 	[$lists]
50USAGE
51		exit 1
52		;;
53	*)
54		break
55		;;
56	esac
57	shift
58done
59if [ -n "$1" ]; then
60	lists="$@"
61fi
62
63# Compute toolchain  used on target cpu.
64if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" ]; then
65        shlib=elf
66else
67        shlib=aout
68fi
69
70for setname in $lists; do
71	cat $setd/lists/$setname/mi
72	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
73		cat $setd/lists/$setname/ad.${arch}
74	fi
75	if [ -f $setd/lists/$setname/md.${machine} ]; then
76		cat $setd/lists/$setname/md.${machine}
77	fi
78	if [ "$shlib" != "" ]; then
79		if [ -f $setd/lists/$setname/shl.mi ]; then
80			cat $setd/lists/$setname/shl.mi
81		fi
82		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
83			cat $setd/lists/$setname/shl.${shlib}
84		fi
85	fi
86
87	# Split man/md_share into: this machine, other machine
88	if [ $setname = man ]; then
89		grep ${machine} $setd/lists/man/md_share
90	fi
91	if [ $setname = misc ]; then
92		grep -v ${machine} $setd/lists/man/md_share
93	fi
94done | sort -u
95