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