makeflist revision 1.20
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.20 2000/01/23 20:31:17 jwise 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	-i*)
26		nlists="$nlists cryptint"
27		lists=$nlists
28		;;
29	-b*)
30		lists="$xlists $nlists"
31		;;
32	-x*)
33		lists=$xlists
34		;;
35	-a*)
36		arch=$2; shift
37		;;
38	-m*)
39		machine=$2; shift
40		;;
41	-s*)
42		setd=$2; shift
43		;;
44	-*)
45		cat 1>&2 <<USAGE
46Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
47	-b		make netbsd + x11 lists
48	-d		do domestic ("secr") sets
49	-i		do international crypto ("cryptint") sets
50	-x		only make x11 lists
51	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
52	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
53	-s setsdir	directory to find sets	[$setd]
54	[setname ...]	sets to build 	[$lists]
55USAGE
56		exit 1
57		;;
58	*)
59		break
60		;;
61	esac
62	shift
63done
64if [ -n "$1" ]; then
65	lists="$@"
66fi
67
68# Convert mipse[lb] to mips after processing command line arguments.
69arch=`echo $arch | sed s,^mipse.,mips,`
70
71# Compute toolchain  used on target cpu.
72if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" -o "$arch" = "sparc" -o "$arch" = "i386" ]; then
73        shlib=elf
74else
75        shlib=aout
76fi
77
78for setname in $lists; do
79	awk -- '{print $1}' $setd/lists/$setname/mi
80	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
81		awk -- '{print $1}' $setd/lists/$setname/ad.${arch}
82	fi
83	if [ -f $setd/lists/$setname/md.${machine} ]; then
84		awk -- '{print $1}' $setd/lists/$setname/md.${machine}
85	fi
86	if [ "$shlib" != "" ]; then
87		if [ -f $setd/lists/$setname/shl.mi ]; then
88			awk -- '{print $1}' $setd/lists/$setname/shl.mi
89		fi
90		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
91			awk -- '{print $1}' $setd/lists/$setname/shl.${shlib}
92		fi
93	fi
94
95	# Split man/md_share into: this machine, other machine
96	if [ $setname = man ]; then
97		grep ${machine} $setd/lists/man/md_share
98	fi
99	if [ $setname = misc ]; then
100		grep -v ${machine} $setd/lists/man/md_share
101	fi
102
103done | egrep -v '^#' | sort -u
104