makeflist revision 1.28
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.28 2001/01/04 11:15:32 itojun 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 xmisc"
16lists=$nlists
17
18# handle args
19while : ; do
20	case $1 in
21	-b*)
22		lists="$xlists $nlists"
23		;;
24	-x*)
25		lists=$xlists
26		;;
27	-a*)
28		arch=$2; shift
29		;;
30	-m*)
31		machine=$2; shift
32		;;
33	-s*)
34		setd=$2; shift
35		;;
36	-*)
37		cat 1>&2 <<USAGE
38Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
39	-b		make netbsd + x11 lists
40	-x		only make x11 lists
41	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
42	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
43	-s setsdir	directory to find sets	[$setd]
44	[setname ...]	sets to build 	[$lists]
45USAGE
46		exit 1
47		;;
48	*)
49		break
50		;;
51	esac
52	shift
53done
54if [ -n "$1" ]; then
55	lists="$@"
56fi
57
58# Convert mipse[lb] to mips after processing command line arguments.
59arch=`echo $arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3,`
60
61# Compute toolchain  used on target cpu.
62if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" -o "$arch" = "sparc" -o "$arch" = "sparc64" -o "$arch" = "i386" -o "$arch" = "arm26" -o "$machine" = "mvme68k" -o "$machine" = "hp300" ]; then
63	shlib=elf
64else
65	if [ "$arch" = "sh3" ]; then
66		shlib=
67	else
68		shlib=aout
69	fi
70fi
71
72for setname in $lists; do
73	awk -- '{print $1}' $setd/lists/$setname/mi
74	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
75		awk -- '{print $1}' $setd/lists/$setname/ad.${arch}
76	fi
77	if [ -f $setd/lists/$setname/md.${machine} ]; then
78		awk -- '{print $1}' $setd/lists/$setname/md.${machine}
79	fi
80	if [ "$shlib" != "" ]; then
81		if [ -f $setd/lists/$setname/shl.mi ]; then
82			awk -- '{print $1}' $setd/lists/$setname/shl.mi
83		fi
84		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
85			awk -- '{print $1}' $setd/lists/$setname/shl.${shlib}
86		fi
87	fi
88done | egrep -v '^#' | sort -u
89