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