makeflist revision 1.54 1 #!/bin/sh
2 #
3 # $NetBSD: makeflist,v 1.54 2002/10/10 20:46:39 briggs 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:-make} -j 1"
11 machine=`${MAKE} print_machine`
12 machine_arch=`${MAKE} print_machine_arch`
13 machine_cpu=`${MAKE} print_machine_cpu`
14 object_fmt=`${MAKE} print_object_fmt`
15 toolchain_missing=`${MAKE} print_toolchain_missing`
16 x11_version=`${MAKE} print_x11_version`
17 setd=`pwd`
18 nlists="base comp etc games man misc text"
19 xlists="xbase xcomp xcontrib xfont xserver xmisc"
20 lists=$nlists
21
22 # handle args
23 while : ; 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
44 Usage: $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]
51 USAGE
52 exit 1
53 ;;
54 *)
55 break
56 ;;
57 esac
58 shift
59 done
60 if [ -n "$1" ]; then
61 lists="$@"
62 fi
63
64 # Determine lib type.
65 if [ "$object_fmt" = "ELF" ]; then
66 shlib=elf
67 else
68 shlib=aout
69 fi
70 stlib=$shlib
71
72 # Turn off shlibs for some ports.
73 if [ "$machine_cpu" = "sh3" -o "$machine_arch" = "m68000" ]; then
74 shlib=no
75 fi
76
77 # Turn off lintlibs for some ports.
78 lintlibs=
79 if [ "$machine" = "x86_64" ]; then
80 lintlibs=no
81 fi
82
83 # Automatically add XFree86 version specific sets
84 for list in $lists
85 do
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
96 done
97 lists=$_lists
98 unset _lists
99
100 for setname in $lists; do
101 cat $setd/lists/$setname/mi
102 if [ "$machine" != "$machine_arch" ]; then
103 # Prefer an ad.${machine_arch} over an ad.${machine_cpu},
104 # since the arch-specific one will be more specific than
105 # the cpu-specific one.
106 if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
107 cat $setd/lists/$setname/ad.${machine_arch}
108 elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
109 cat $setd/lists/$setname/ad.${machine_cpu}
110 fi
111 if [ "$shlib" != "no" -a \
112 -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
113 cat $setd/lists/$setname/ad.${machine_cpu}.shl
114 fi
115 fi
116 if [ -f $setd/lists/$setname/md.${machine} ]; then
117 cat $setd/lists/$setname/md.${machine}
118 fi
119 if [ -f $setd/lists/$setname/stl.mi ]; then
120 cat $setd/lists/$setname/stl.mi
121 fi
122 if [ -f $setd/lists/$setname/stl.${stlib} ]; then
123 cat $setd/lists/$setname/stl.${stlib}
124 fi
125 if [ "$shlib" != "no" ]; then
126 if [ -f $setd/lists/$setname/shl.mi ]; then
127 cat $setd/lists/$setname/shl.mi
128 fi
129 if [ -f $setd/lists/$setname/shl.${shlib} ]; then
130 cat $setd/lists/$setname/shl.${shlib}
131 fi
132 fi
133 if [ "$lintlibs" != no ]; then
134 if [ -f $setd/lists/$setname/lint.mi ]; then
135 cat $setd/lists/$setname/lint.mi
136 fi
137 fi
138 if [ "$toolchain_missing" != "yes" ]; then
139 if [ -f $setd/lists/$setname/tc.mi ]; then
140 cat $setd/lists/$setname/tc.mi
141 fi
142 if [ "$shlib" != "no" ]; then
143 if [ -f $setd/lists/$setname/tc.shl ]; then
144 cat $setd/lists/$setname/tc.shl
145 fi
146 fi
147 fi
148
149 # XXX MIPS does not support rescue right now.
150 if [ ${machine_cpu} = "mips" ]; then
151 continue
152 fi
153
154 if [ -f $setd/lists/$setname/rescue.mi ]; then
155 cat $setd/lists/$setname/rescue.mi
156 fi
157 if [ -f $setd/lists/$setname/rescue.${machine} ]; then
158 cat $setd/lists/$setname/rescue.${machine}
159 fi
160 if [ "$machine" != "$machine_arch" ]; then
161 # Prefer a rescue.ad.${machine_arch} over a
162 # rescue.ad.${machine_cpu}, since the arch-
163 # specific one will be more specific than the
164 # cpu-specific one.
165 if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
166 cat $setd/lists/$setname/rescue.ad.${machine_arch}
167 elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
168 cat $setd/lists/$setname/rescue.ad.${machine_cpu}
169 fi
170 if [ "$shlib" != "no" -a -f \
171 $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
172 cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
173 fi
174 fi
175 done | awk -- '/^[^#]/ {print $1}' | sort -u
176