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