makeflist revision 1.33
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.33 2001/08/19 13:15:18 mrg 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" = "hp300" -o "$machine" = "mvme68k" -o "$machine" = "news68k" -o "$machine" = "sun3" -o "$machine" = "next68k" ]; then
63	shlib=elf
64else
65	if [ "$arch" = "sh3" ]; then
66		shlib=
67	else
68		shlib=aout
69	fi
70fi
71
72# Turn off lintlibs for some ports.
73lintlibs=
74if [ "$machine" = "sparc64" -o "$arch" = "sh3" -o "$arch" = "m68000" ]; then
75	lintlibs=no
76fi
77
78for setname in $lists; do
79	cat $setd/lists/$setname/mi
80	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
81		cat $setd/lists/$setname/ad.${arch}
82	fi
83	if [ -f $setd/lists/$setname/md.${machine} ]; then
84		cat $setd/lists/$setname/md.${machine}
85	fi
86	if [ "$shlib" != "" ]; then
87		if [ -f $setd/lists/$setname/shl.mi ]; then
88			cat $setd/lists/$setname/shl.mi
89		fi
90		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
91			cat $setd/lists/$setname/shl.${shlib}
92		fi
93	fi
94	if [ "$lintlibs" != no ]; then
95		if [ -f $setd/lists/$setname/lint.mi ]; then
96			cat $setd/lists/$setname/lint.mi
97		fi
98	fi
99done | egrep -v '^#' | awk -- '{print $1}' | sort -u
100