makeflist revision 1.16
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.16 1999/04/19 02:33:40 simonb 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	-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# Convert mipse[lb] to mips after processing command line arguments.
64arch=`echo $arch | sed s,^mipse.,mips,`
65
66# Compute toolchain  used on target cpu.
67if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" ]; then
68        shlib=elf
69else
70        shlib=aout
71fi
72
73for setname in $lists; do
74	cat $setd/lists/$setname/mi
75	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
76		cat $setd/lists/$setname/ad.${arch}
77	fi
78	if [ -f $setd/lists/$setname/md.${machine} ]; then
79		cat $setd/lists/$setname/md.${machine}
80	fi
81	if [ "$shlib" != "" ]; then
82		if [ -f $setd/lists/$setname/shl.mi ]; then
83			cat $setd/lists/$setname/shl.mi
84		fi
85		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
86			cat $setd/lists/$setname/shl.${shlib}
87		fi
88	fi
89
90	# Split man/md_share into: this machine, other machine
91	if [ $setname = man ]; then
92		grep ${machine} $setd/lists/man/md_share
93	fi
94	if [ $setname = misc ]; then
95		grep -v ${machine} $setd/lists/man/md_share
96	fi
97done | egrep -v '^#' | sort -u
98