makeflist revision 1.59
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.59 2003/03/15 22:32:09 he 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
76lkm=yes
77# Turn off LKMs for some ports.
78if [ "$machine" = "evbppc" ]; then
79	lkm=no
80fi
81
82# Turn off lintlibs for some ports.
83# Not needed anymore, leave the hook here for future use.
84lintlibs=
85
86# Automatically add XFree86 version specific sets
87for list in $lists
88do
89 if [ -z "$_lists" ]
90 then
91  _lists=$list
92 else
93  _lists="$_lists $list"
94 fi
95 if [ -d "$setd/lists/$list${x11_version}" ]
96 then
97  _lists="$_lists $list${x11_version}"
98 fi
99done
100lists=$_lists
101unset _lists
102
103for setname in $lists; do
104	cat $setd/lists/$setname/mi
105	if [ "$machine" != "$machine_arch" ]; then
106		# Prefer an ad.${machine_arch} over an ad.${machine_cpu},
107		# since the arch-specific one will be more specific than
108		# the cpu-specific one.
109		if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
110			cat $setd/lists/$setname/ad.${machine_arch}
111		elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
112			cat $setd/lists/$setname/ad.${machine_cpu}
113		fi
114		if [ "$shlib" != "no" -a \
115		     -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
116			cat $setd/lists/$setname/ad.${machine_cpu}.shl
117		fi
118	fi
119	if [ -f $setd/lists/$setname/md.${machine} ]; then
120		cat $setd/lists/$setname/md.${machine}
121	fi
122	if [ -f $setd/lists/$setname/stl.mi ]; then
123		cat $setd/lists/$setname/stl.mi
124	fi
125	if [ -f $setd/lists/$setname/stl.${stlib} ]; then
126		cat $setd/lists/$setname/stl.${stlib}
127	fi
128	if [ "$shlib" != "no" ]; then
129		if [ -f $setd/lists/$setname/shl.mi ]; then
130			cat $setd/lists/$setname/shl.mi
131		fi
132		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
133			cat $setd/lists/$setname/shl.${shlib}
134		fi
135	fi
136	if [ "$lkm" != "no" ]; then
137		if [ -f $setd/lists/$setname/lkm.mi ]; then
138			cat $setd/lists/$setname/lkm.mi
139		fi
140	fi
141	if [ "$lintlibs" != no ]; then
142		if [ -f $setd/lists/$setname/lint.mi ]; then
143			cat $setd/lists/$setname/lint.mi
144		fi
145	fi
146	if [ "$toolchain_missing" != "yes" ]; then
147		if [ -f $setd/lists/$setname/tc.mi ]; then
148			cat $setd/lists/$setname/tc.mi
149		fi
150		if [ "$shlib" != "no" ]; then
151			if [ -f $setd/lists/$setname/tc.shl ]; then
152				cat $setd/lists/$setname/tc.shl
153			fi
154		fi
155	fi
156
157	if [ -f $setd/lists/$setname/rescue.mi ]; then
158		cat $setd/lists/$setname/rescue.mi
159	fi
160	if [ -f $setd/lists/$setname/rescue.${machine} ]; then
161		cat $setd/lists/$setname/rescue.${machine}
162	fi
163	if [ "$machine" != "$machine_arch" ]; then
164		# Prefer a rescue.ad.${machine_arch} over a
165		# rescue.ad.${machine_cpu}, since the arch-
166		# specific one will be more specific than the
167		# cpu-specific one.
168		if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
169			cat $setd/lists/$setname/rescue.ad.${machine_arch}
170		elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
171			cat $setd/lists/$setname/rescue.ad.${machine_cpu}
172		fi
173		if [ "$shlib" != "no" -a -f \
174		     $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
175			cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
176		fi
177	fi
178done | awk -- '/^[^#]/ {print $1}' | sort -u
179