makeflist revision 1.57
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.57 2002/12/10 22:00:56 fvdl 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
10make="${MAKE:-make} -j 1 -f `dirname $0`/Makefile"
11machine=`${make} print_machine`
12machine_arch=`${make} print_machine_arch`
13machine_cpu=`${make} print_machine_cpu`
14object_fmt=`${make} print_object_fmt`
15toolchain_missing=`${make} print_toolchain_missing`
16x11_version=`${make} print_x11_version`
17setd=`pwd`
18nlists="base comp etc games man misc text"
19xlists="xbase xcomp xcontrib xfont xserver xmisc"
20lists=$nlists
21
22# handle args
23while : ; do
24	case $1 in
25	-b*)
26		lists="$xlists $nlists"
27		;;
28	-x*)
29		lists=$xlists
30		;;
31	-a*)
32		machine_arch=`MACHINE_ARCH=${2} ${make} print_machine_arch`
33		machine_cpu=`MACHINE_ARCH=${2} ${make} print_machine_cpu`
34		shift
35		;;
36	-m*)
37		machine=$2; shift
38		;;
39	-s*)
40		setd=$2; shift
41		;;
42	-*)
43		cat 1>&2 <<USAGE
44Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
45	-b		make netbsd + x11 lists
46	-x		only make x11 lists
47	-a arch		set arch (e.g, m68k, mipseb, mipsel, powerpc) [$machine_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# Determine lib type.
65if [ "$object_fmt" = "ELF" ]; then
66	shlib=elf
67else
68	shlib=aout
69fi
70stlib=$shlib
71
72# Turn off shlibs for some ports.
73if [ "$machine_cpu" = "sh3" -o "$machine_arch" = "m68000" ]; then
74	shlib=no
75fi
76
77# Turn off lintlibs for some ports.
78# Not needed anymore, leave the hook here for future use.
79lintlibs=
80
81# Automatically add XFree86 version specific sets
82for list in $lists
83do
84 if [ -z "$_lists" ]
85 then
86  _lists=$list
87 else
88  _lists="$_lists $list"
89 fi
90 if [ -d "$setd/lists/$list${x11_version}" ]
91 then
92  _lists="$_lists $list${x11_version}"
93 fi
94done
95lists=$_lists
96unset _lists
97
98for setname in $lists; do
99	cat $setd/lists/$setname/mi
100	if [ "$machine" != "$machine_arch" ]; then
101		# Prefer an ad.${machine_arch} over an ad.${machine_cpu},
102		# since the arch-specific one will be more specific than
103		# the cpu-specific one.
104		if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
105			cat $setd/lists/$setname/ad.${machine_arch}
106		elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
107			cat $setd/lists/$setname/ad.${machine_cpu}
108		fi
109		if [ "$shlib" != "no" -a \
110		     -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
111			cat $setd/lists/$setname/ad.${machine_cpu}.shl
112		fi
113	fi
114	if [ -f $setd/lists/$setname/md.${machine} ]; then
115		cat $setd/lists/$setname/md.${machine}
116	fi
117	if [ -f $setd/lists/$setname/stl.mi ]; then
118		cat $setd/lists/$setname/stl.mi
119	fi
120	if [ -f $setd/lists/$setname/stl.${stlib} ]; then
121		cat $setd/lists/$setname/stl.${stlib}
122	fi
123	if [ "$shlib" != "no" ]; then
124		if [ -f $setd/lists/$setname/shl.mi ]; then
125			cat $setd/lists/$setname/shl.mi
126		fi
127		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
128			cat $setd/lists/$setname/shl.${shlib}
129		fi
130	fi
131	if [ "$lintlibs" != no ]; then
132		if [ -f $setd/lists/$setname/lint.mi ]; then
133			cat $setd/lists/$setname/lint.mi
134		fi
135	fi
136	if [ "$toolchain_missing" != "yes" ]; then
137		if [ -f $setd/lists/$setname/tc.mi ]; then
138			cat $setd/lists/$setname/tc.mi
139		fi
140		if [ "$shlib" != "no" ]; then
141			if [ -f $setd/lists/$setname/tc.shl ]; then
142				cat $setd/lists/$setname/tc.shl
143			fi
144		fi
145	fi
146
147	# XXX MIPS does not support rescue right now.
148	if [ ${machine_cpu} = "mips" ]; then
149		continue
150	fi
151
152	if [ -f $setd/lists/$setname/rescue.mi ]; then
153		cat $setd/lists/$setname/rescue.mi
154	fi
155	if [ -f $setd/lists/$setname/rescue.${machine} ]; then
156		cat $setd/lists/$setname/rescue.${machine}
157	fi
158	if [ "$machine" != "$machine_arch" ]; then
159		# Prefer a rescue.ad.${machine_arch} over a
160		# rescue.ad.${machine_cpu}, since the arch-
161		# specific one will be more specific than the
162		# cpu-specific one.
163		if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
164			cat $setd/lists/$setname/rescue.ad.${machine_arch}
165		elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
166			cat $setd/lists/$setname/rescue.ad.${machine_cpu}
167		fi
168		if [ "$shlib" != "no" -a -f \
169		     $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
170			cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
171		fi
172	fi
173done | awk -- '/^[^#]/ {print $1}' | sort -u
174