makeflist revision 1.52
1#!/bin/sh
2#
3# $NetBSD: makeflist,v 1.52 2002/10/06 17:28:47 thorpej 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"
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.
78lintlibs=
79if [ "$machine" = "x86_64" ]; then
80	lintlibs=no
81fi
82
83# Automatically add XFree86 version specific sets
84for list in $lists
85do
86 if [ -z "$_lists" ]
87 then
88  _lists=$list
89 else
90  _lists="$_lists $list"
91 fi
92 if [ -d "$setd/lists/$list${x11_version}" ]
93 then
94  _lists="$_lists $list${x11_version}"
95 fi
96done
97lists=$_lists
98unset _lists
99
100for setname in $lists; do
101	cat $setd/lists/$setname/mi
102	# XXX MIPS does not support rescue right now.
103	if [ -f $setd/lists/$setname/rescue.mi -a \
104	     ${machine_cpu} != "mips" ]; then
105		cat $setd/lists/$setname/rescue.mi
106	fi
107	if [ "$machine" != "$machine_arch" ]; then
108		# Prefer an ad.${machine_arch} over an ad.${machine_cpu},
109		# since the arch-specific one will be more specific than
110		# the cpu-specific one.
111		if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
112			cat $setd/lists/$setname/ad.${machine_arch}
113		elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
114			cat $setd/lists/$setname/ad.${machine_cpu}
115		fi
116		if [ "$shlib" != "no" -a \
117		     -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
118			cat $setd/lists/$setname/ad.${machine_cpu}.shl
119		fi
120	fi
121	if [ -f $setd/lists/$setname/md.${machine} ]; then
122		cat $setd/lists/$setname/md.${machine}
123	fi
124	if [ -f $setd/lists/$setname/stl.mi ]; then
125		cat $setd/lists/$setname/stl.mi
126	fi
127	if [ -f $setd/lists/$setname/stl.${stlib} ]; then
128		cat $setd/lists/$setname/stl.${stlib}
129	fi
130	if [ "$shlib" != "no" ]; then
131		if [ -f $setd/lists/$setname/shl.mi ]; then
132			cat $setd/lists/$setname/shl.mi
133		fi
134		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
135			cat $setd/lists/$setname/shl.${shlib}
136		fi
137	fi
138	if [ "$lintlibs" != no ]; then
139		if [ -f $setd/lists/$setname/lint.mi ]; then
140			cat $setd/lists/$setname/lint.mi
141		fi
142	fi
143	if [ "$toolchain_missing" != "yes" ]; then
144		if [ -f $setd/lists/$setname/tc.mi ]; then
145			cat $setd/lists/$setname/tc.mi
146		fi
147		if [ "$shlib" != "no" ]; then
148			if [ -f $setd/lists/$setname/tc.shl ]; then
149				cat $setd/lists/$setname/tc.shl
150			fi
151		fi
152	fi
153done | awk -- '/^[^#]/ {print $1}' | sort -u
154