makeflist revision 1.20 1 #!/bin/sh
2 #
3 # $NetBSD: makeflist,v 1.20 2000/01/23 20:31:17 jwise 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}
11 machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | $MAKE -s -f-`}
12 arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | $MAKE -s -f-`}
13 setd=`pwd`
14 nlists="base comp etc games man misc text"
15 xlists="xbase xcomp xcontrib xfont xserver"
16 lists=$nlists
17
18 # handle args
19 while : ; do
20 case $1 in
21 -d*)
22 nlists="$nlists secr"
23 lists=$nlists
24 ;;
25 -i*)
26 nlists="$nlists cryptint"
27 lists=$nlists
28 ;;
29 -b*)
30 lists="$xlists $nlists"
31 ;;
32 -x*)
33 lists=$xlists
34 ;;
35 -a*)
36 arch=$2; shift
37 ;;
38 -m*)
39 machine=$2; shift
40 ;;
41 -s*)
42 setd=$2; shift
43 ;;
44 -*)
45 cat 1>&2 <<USAGE
46 Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
47 -b make netbsd + x11 lists
48 -d do domestic ("secr") sets
49 -i do international crypto ("cryptint") sets
50 -x only make x11 lists
51 -a arch set arch (e.g, m68k, mips, powerpc) [$arch]
52 -m machine set machine (e.g, amiga, i386, macppc) [$machine]
53 -s setsdir directory to find sets [$setd]
54 [setname ...] sets to build [$lists]
55 USAGE
56 exit 1
57 ;;
58 *)
59 break
60 ;;
61 esac
62 shift
63 done
64 if [ -n "$1" ]; then
65 lists="$@"
66 fi
67
68 # Convert mipse[lb] to mips after processing command line arguments.
69 arch=`echo $arch | sed s,^mipse.,mips,`
70
71 # Compute toolchain used on target cpu.
72 if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" -o "$arch" = "sparc" -o "$arch" = "i386" ]; then
73 shlib=elf
74 else
75 shlib=aout
76 fi
77
78 for setname in $lists; do
79 awk -- '{print $1}' $setd/lists/$setname/mi
80 if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
81 awk -- '{print $1}' $setd/lists/$setname/ad.${arch}
82 fi
83 if [ -f $setd/lists/$setname/md.${machine} ]; then
84 awk -- '{print $1}' $setd/lists/$setname/md.${machine}
85 fi
86 if [ "$shlib" != "" ]; then
87 if [ -f $setd/lists/$setname/shl.mi ]; then
88 awk -- '{print $1}' $setd/lists/$setname/shl.mi
89 fi
90 if [ -f $setd/lists/$setname/shl.${shlib} ]; then
91 awk -- '{print $1}' $setd/lists/$setname/shl.${shlib}
92 fi
93 fi
94
95 # Split man/md_share into: this machine, other machine
96 if [ $setname = man ]; then
97 grep ${machine} $setd/lists/man/md_share
98 fi
99 if [ $setname = misc ]; then
100 grep -v ${machine} $setd/lists/man/md_share
101 fi
102
103 done | egrep -v '^#' | sort -u
104