makeflist revision 1.57 1 1.2 gwr #!/bin/sh
2 1.2 gwr #
3 1.57 fvdl # $NetBSD: makeflist,v 1.57 2002/12/10 22:00:56 fvdl Exp $
4 1.2 gwr #
5 1.8 lukem # Print out the files in some or all lists.
6 1.8 lukem # Usage: makeflist [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
7 1.2 gwr #
8 1.2 gwr
9 1.2 gwr # set defaults
10 1.56 lukem make="${MAKE:-make} -j 1 -f `dirname $0`/Makefile"
11 1.56 lukem machine=`${make} print_machine`
12 1.56 lukem machine_arch=`${make} print_machine_arch`
13 1.56 lukem machine_cpu=`${make} print_machine_cpu`
14 1.56 lukem object_fmt=`${make} print_object_fmt`
15 1.56 lukem toolchain_missing=`${make} print_toolchain_missing`
16 1.56 lukem x11_version=`${make} print_x11_version`
17 1.2 gwr setd=`pwd`
18 1.8 lukem nlists="base comp etc games man misc text"
19 1.44 tron xlists="xbase xcomp xcontrib xfont xserver xmisc"
20 1.8 lukem lists=$nlists
21 1.2 gwr
22 1.2 gwr # handle args
23 1.8 lukem while : ; do
24 1.2 gwr case $1 in
25 1.8 lukem -b*)
26 1.8 lukem lists="$xlists $nlists"
27 1.8 lukem ;;
28 1.8 lukem -x*)
29 1.8 lukem lists=$xlists
30 1.8 lukem ;;
31 1.8 lukem -a*)
32 1.56 lukem machine_arch=`MACHINE_ARCH=${2} ${make} print_machine_arch`
33 1.56 lukem machine_cpu=`MACHINE_ARCH=${2} ${make} print_machine_cpu`
34 1.39 thorpej shift
35 1.8 lukem ;;
36 1.8 lukem -m*)
37 1.8 lukem machine=$2; shift
38 1.8 lukem ;;
39 1.8 lukem -s*)
40 1.8 lukem setd=$2; shift
41 1.8 lukem ;;
42 1.8 lukem -*)
43 1.8 lukem cat 1>&2 <<USAGE
44 1.8 lukem Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
45 1.8 lukem -b make netbsd + x11 lists
46 1.8 lukem -x only make x11 lists
47 1.40 thorpej -a arch set arch (e.g, m68k, mipseb, mipsel, powerpc) [$machine_arch]
48 1.39 thorpej -m machine set machine (e.g, amiga, i386, macppc) [$machine]
49 1.39 thorpej -s setsdir directory to find sets [$setd]
50 1.39 thorpej [setname ...] sets to build [$lists]
51 1.8 lukem USAGE
52 1.8 lukem exit 1
53 1.8 lukem ;;
54 1.8 lukem *)
55 1.8 lukem break
56 1.8 lukem ;;
57 1.2 gwr esac
58 1.2 gwr shift
59 1.2 gwr done
60 1.8 lukem if [ -n "$1" ]; then
61 1.8 lukem lists="$@"
62 1.8 lukem fi
63 1.15 simonb
64 1.43 fredette # Determine lib type.
65 1.39 thorpej if [ "$object_fmt" = "ELF" ]; then
66 1.28 itojun shlib=elf
67 1.9 jonathan else
68 1.39 thorpej shlib=aout
69 1.9 jonathan fi
70 1.43 fredette stlib=$shlib
71 1.43 fredette
72 1.43 fredette # Turn off shlibs for some ports.
73 1.43 fredette if [ "$machine_cpu" = "sh3" -o "$machine_arch" = "m68000" ]; then
74 1.43 fredette shlib=no
75 1.43 fredette fi
76 1.1 cgd
77 1.33 mrg # Turn off lintlibs for some ports.
78 1.57 fvdl # Not needed anymore, leave the hook here for future use.
79 1.33 mrg lintlibs=
80 1.44 tron
81 1.44 tron # Automatically add XFree86 version specific sets
82 1.44 tron for list in $lists
83 1.44 tron do
84 1.44 tron if [ -z "$_lists" ]
85 1.44 tron then
86 1.44 tron _lists=$list
87 1.44 tron else
88 1.44 tron _lists="$_lists $list"
89 1.44 tron fi
90 1.44 tron if [ -d "$setd/lists/$list${x11_version}" ]
91 1.44 tron then
92 1.44 tron _lists="$_lists $list${x11_version}"
93 1.44 tron fi
94 1.44 tron done
95 1.44 tron lists=$_lists
96 1.44 tron unset _lists
97 1.33 mrg
98 1.8 lukem for setname in $lists; do
99 1.29 jwise cat $setd/lists/$setname/mi
100 1.48 fredette if [ "$machine" != "$machine_arch" ]; then
101 1.50 thorpej # Prefer an ad.${machine_arch} over an ad.${machine_cpu},
102 1.50 thorpej # since the arch-specific one will be more specific than
103 1.50 thorpej # the cpu-specific one.
104 1.50 thorpej if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
105 1.50 thorpej cat $setd/lists/$setname/ad.${machine_arch}
106 1.50 thorpej elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
107 1.48 fredette cat $setd/lists/$setname/ad.${machine_cpu}
108 1.48 fredette fi
109 1.48 fredette if [ "$shlib" != "no" -a \
110 1.48 fredette -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
111 1.48 fredette cat $setd/lists/$setname/ad.${machine_cpu}.shl
112 1.48 fredette fi
113 1.8 lukem fi
114 1.8 lukem if [ -f $setd/lists/$setname/md.${machine} ]; then
115 1.29 jwise cat $setd/lists/$setname/md.${machine}
116 1.9 jonathan fi
117 1.43 fredette if [ -f $setd/lists/$setname/stl.mi ]; then
118 1.43 fredette cat $setd/lists/$setname/stl.mi
119 1.43 fredette fi
120 1.43 fredette if [ -f $setd/lists/$setname/stl.${stlib} ]; then
121 1.43 fredette cat $setd/lists/$setname/stl.${stlib}
122 1.43 fredette fi
123 1.43 fredette if [ "$shlib" != "no" ]; then
124 1.9 jonathan if [ -f $setd/lists/$setname/shl.mi ]; then
125 1.29 jwise cat $setd/lists/$setname/shl.mi
126 1.9 jonathan fi
127 1.9 jonathan if [ -f $setd/lists/$setname/shl.${shlib} ]; then
128 1.29 jwise cat $setd/lists/$setname/shl.${shlib}
129 1.33 mrg fi
130 1.33 mrg fi
131 1.33 mrg if [ "$lintlibs" != no ]; then
132 1.33 mrg if [ -f $setd/lists/$setname/lint.mi ]; then
133 1.33 mrg cat $setd/lists/$setname/lint.mi
134 1.36 jmc fi
135 1.36 jmc fi
136 1.51 lukem if [ "$toolchain_missing" != "yes" ]; then
137 1.36 jmc if [ -f $setd/lists/$setname/tc.mi ]; then
138 1.36 jmc cat $setd/lists/$setname/tc.mi
139 1.46 thorpej fi
140 1.46 thorpej if [ "$shlib" != "no" ]; then
141 1.46 thorpej if [ -f $setd/lists/$setname/tc.shl ]; then
142 1.47 nathanw cat $setd/lists/$setname/tc.shl
143 1.46 thorpej fi
144 1.53 thorpej fi
145 1.53 thorpej fi
146 1.53 thorpej
147 1.53 thorpej # XXX MIPS does not support rescue right now.
148 1.53 thorpej if [ ${machine_cpu} = "mips" ]; then
149 1.53 thorpej continue
150 1.53 thorpej fi
151 1.53 thorpej
152 1.53 thorpej if [ -f $setd/lists/$setname/rescue.mi ]; then
153 1.53 thorpej cat $setd/lists/$setname/rescue.mi
154 1.53 thorpej fi
155 1.53 thorpej if [ -f $setd/lists/$setname/rescue.${machine} ]; then
156 1.53 thorpej cat $setd/lists/$setname/rescue.${machine}
157 1.53 thorpej fi
158 1.53 thorpej if [ "$machine" != "$machine_arch" ]; then
159 1.53 thorpej # Prefer a rescue.ad.${machine_arch} over a
160 1.53 thorpej # rescue.ad.${machine_cpu}, since the arch-
161 1.53 thorpej # specific one will be more specific than the
162 1.53 thorpej # cpu-specific one.
163 1.53 thorpej if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
164 1.53 thorpej cat $setd/lists/$setname/rescue.ad.${machine_arch}
165 1.53 thorpej elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
166 1.53 thorpej cat $setd/lists/$setname/rescue.ad.${machine_cpu}
167 1.53 thorpej fi
168 1.54 briggs if [ "$shlib" != "no" -a -f \
169 1.54 briggs $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
170 1.53 thorpej cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
171 1.9 jonathan fi
172 1.8 lukem fi
173 1.42 lukem done | awk -- '/^[^#]/ {print $1}' | sort -u
174