makeflist revision 1.9
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.9 1998/07/02 06:36:35 jonathan 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	-b*)
21		lists="$xlists $nlists"
22		;;
23	-x*)
24		lists=$xlists
25		;;
26	-a*)
27		arch=$2; shift
28		;;
29	-m*)
30		machine=$2; shift
31		;;
32	-s*)
33		setd=$2; shift
34		;;
35	-*)
36		cat 1>&2 <<USAGE
37Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
38	-b		make netbsd + x11 lists
39	-x		only make x11 lists
40	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
41	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
42	-s setsdir	directory to find sets	[$setd]
43	[setname ...]	sets to build 	[$lists]
44USAGE
45		exit 1
46		;;
47	*)
48		break
49		;;
50	esac
51	shift
52done
53if [ -n "$1" ]; then
54	lists="$@"
55fi
56
57# Compute toolchain  used on target cpu.
58if [ "$machine" = "vax" ]; then
59	shlib=
60elif [ "$arch" = "mips" -o "$machine" = "alpha" ]; then
61        shlib=elf
62else
63        shlib=aout
64fi
65
66# EXTRA SPECIAL (not done here): secr
67
68for setname in $lists; do
69	cat $setd/lists/$setname/mi
70	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
71		cat $setd/lists/$setname/ad.${arch}
72	fi
73	if [ -f $setd/lists/$setname/md.${machine} ]; then
74		cat $setd/lists/$setname/md.${machine}
75	fi
76	if [ "$shlib" != "" ]; then
77		if [ -f $setd/lists/$setname/shl.mi ]; then
78			cat $setd/lists/$setname/shl.mi
79		fi
80		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
81			cat $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
92done | sort -u
93