makeflist revision 1.36
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.36 2001/10/20 06:11:21 jmc 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-`}
13tc=${USE_NEW_TOOLCHAIN:-`printf '.include <bsd.own.mk>\nxxx:\n\techo ${USE_NEW_TOOLCHAIN}' | /usr/bin/make -m /usr/src/share/mk -s -f-`}
14setd=`pwd`
15nlists="base comp etc games man misc text"
16xlists="xbase xcomp xcontrib xfont xserver xmisc"
17lists=$nlists
18
19# handle args
20while : ; do
21	case $1 in
22	-b*)
23		lists="$xlists $nlists"
24		;;
25	-x*)
26		lists=$xlists
27		;;
28	-a*)
29		arch=$2; shift
30		;;
31	-m*)
32		machine=$2; shift
33		;;
34	-s*)
35		setd=$2; shift
36		;;
37	-*)
38		cat 1>&2 <<USAGE
39Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
40	-b		make netbsd + x11 lists
41	-x		only make x11 lists
42	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
43	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
44	-s setsdir	directory to find sets	[$setd]
45	[setname ...]	sets to build 	[$lists]
46USAGE
47		exit 1
48		;;
49	*)
50		break
51		;;
52	esac
53	shift
54done
55if [ -n "$1" ]; then
56	lists="$@"
57fi
58
59# Convert mipse[lb] to mips after processing command line arguments.
60arch=`echo $arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3,`
61
62# Compute toolchain  used on target cpu.
63if [ "$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" -o "$machine" = "cesfic" -o "$machine" = "atari" ]; then
64	shlib=elf
65else
66	if [ "$arch" = "sh3" ]; then
67		shlib=
68	else
69		shlib=aout
70	fi
71fi
72
73# Turn off lintlibs for some ports.
74lintlibs=
75if [ "$machine" = "sparc64" -o "$arch" = "sh3" -o "$arch" = "m68000" ]; then
76	lintlibs=no
77fi
78
79for setname in $lists; do
80	cat $setd/lists/$setname/mi
81	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
82		cat $setd/lists/$setname/ad.${arch}
83	fi
84	if [ -f $setd/lists/$setname/md.${machine} ]; then
85		cat $setd/lists/$setname/md.${machine}
86	fi
87	if [ "$shlib" != "" ]; then
88		if [ -f $setd/lists/$setname/shl.mi ]; then
89			cat $setd/lists/$setname/shl.mi
90		fi
91		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
92			cat $setd/lists/$setname/shl.${shlib}
93		fi
94	fi
95	if [ "$lintlibs" != no ]; then
96		if [ -f $setd/lists/$setname/lint.mi ]; then
97			cat $setd/lists/$setname/lint.mi
98		fi
99	fi
100	if [ "$tc" = "yes" ]; then
101		if [ -f $setd/lists/$setname/tc.mi ]; then
102			cat $setd/lists/$setname/tc.mi
103		fi
104	else
105		if [ -f $setd/lists/$setname/tc.old ]; then
106			cat $setd/lists/$setname/tc.old
107		fi
108	fi
109done | egrep -v '^#' | awk -- '{print $1}' | sort -u
110