makeflist revision 1.60 1 #!/bin/sh
2 #
3 # $NetBSD: makeflist,v 1.60 2003/05/26 15:42:34 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:-make} -j 1 -f `dirname $0`/Makefile"
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 lkm=yes
77 # Turn off LKMs for some ports.
78 if [ "$machine" = "evbppc" ]; then
79 lkm=no
80 fi
81
82 # Turn off lintlibs for some ports.
83 # Not needed anymore, leave the hook here for future use.
84 lintlibs=
85
86 # Automatically add XFree86 version specific sets
87 for list in $lists
88 do
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
99 done
100 lists=$_lists
101 unset _lists
102
103 for 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}.${machine_arch} ]; then
120 cat $setd/lists/$setname/md.${machine}.${machine_arch}
121 elif [ -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 [ "$lkm" != "no" ]; then
139 if [ -f $setd/lists/$setname/lkm.mi ]; then
140 cat $setd/lists/$setname/lkm.mi
141 fi
142 fi
143 if [ "$lintlibs" != no ]; then
144 if [ -f $setd/lists/$setname/lint.mi ]; then
145 cat $setd/lists/$setname/lint.mi
146 fi
147 fi
148 if [ "$toolchain_missing" != "yes" ]; then
149 if [ -f $setd/lists/$setname/tc.mi ]; then
150 cat $setd/lists/$setname/tc.mi
151 fi
152 if [ "$shlib" != "no" ]; then
153 if [ -f $setd/lists/$setname/tc.shl ]; then
154 cat $setd/lists/$setname/tc.shl
155 fi
156 fi
157 fi
158
159 if [ -f $setd/lists/$setname/rescue.mi ]; then
160 cat $setd/lists/$setname/rescue.mi
161 fi
162 if [ -f $setd/lists/$setname/rescue.${machine} ]; then
163 cat $setd/lists/$setname/rescue.${machine}
164 fi
165 if [ "$machine" != "$machine_arch" ]; then
166 # Prefer a rescue.ad.${machine_arch} over a
167 # rescue.ad.${machine_cpu}, since the arch-
168 # specific one will be more specific than the
169 # cpu-specific one.
170 if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
171 cat $setd/lists/$setname/rescue.ad.${machine_arch}
172 elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
173 cat $setd/lists/$setname/rescue.ad.${machine_cpu}
174 fi
175 if [ "$shlib" != "no" -a -f \
176 $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
177 cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
178 fi
179 fi
180 done | awk -- '/^[^#]/ {print $1}' | sort -u
181