makeflist revision 1.53 1 1.2 gwr #!/bin/sh
2 1.2 gwr #
3 1.53 thorpej # $NetBSD: makeflist,v 1.53 2002/10/09 01:22:37 thorpej 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.49 lukem MAKE="${MAKE:-make} -j 1"
11 1.39 thorpej machine=`${MAKE} print_machine`
12 1.39 thorpej machine_arch=`${MAKE} print_machine_arch`
13 1.39 thorpej machine_cpu=`${MAKE} print_machine_cpu`
14 1.39 thorpej object_fmt=`${MAKE} print_object_fmt`
15 1.51 lukem toolchain_missing=`${MAKE} print_toolchain_missing`
16 1.41 tron 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.39 thorpej machine_arch=`MACHINE_ARCH=${2} ${MAKE} print_machine_arch`
33 1.39 thorpej 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.33 mrg lintlibs=
79 1.45 wiz if [ "$machine" = "x86_64" ]; then
80 1.33 mrg lintlibs=no
81 1.33 mrg fi
82 1.44 tron
83 1.44 tron # Automatically add XFree86 version specific sets
84 1.44 tron for list in $lists
85 1.44 tron do
86 1.44 tron if [ -z "$_lists" ]
87 1.44 tron then
88 1.44 tron _lists=$list
89 1.44 tron else
90 1.44 tron _lists="$_lists $list"
91 1.44 tron fi
92 1.44 tron if [ -d "$setd/lists/$list${x11_version}" ]
93 1.44 tron then
94 1.44 tron _lists="$_lists $list${x11_version}"
95 1.44 tron fi
96 1.44 tron done
97 1.44 tron lists=$_lists
98 1.44 tron unset _lists
99 1.33 mrg
100 1.8 lukem for setname in $lists; do
101 1.29 jwise cat $setd/lists/$setname/mi
102 1.48 fredette if [ "$machine" != "$machine_arch" ]; then
103 1.50 thorpej # Prefer an ad.${machine_arch} over an ad.${machine_cpu},
104 1.50 thorpej # since the arch-specific one will be more specific than
105 1.50 thorpej # the cpu-specific one.
106 1.50 thorpej if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
107 1.50 thorpej cat $setd/lists/$setname/ad.${machine_arch}
108 1.50 thorpej elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
109 1.48 fredette cat $setd/lists/$setname/ad.${machine_cpu}
110 1.48 fredette fi
111 1.48 fredette if [ "$shlib" != "no" -a \
112 1.48 fredette -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
113 1.48 fredette cat $setd/lists/$setname/ad.${machine_cpu}.shl
114 1.48 fredette fi
115 1.8 lukem fi
116 1.8 lukem if [ -f $setd/lists/$setname/md.${machine} ]; then
117 1.29 jwise cat $setd/lists/$setname/md.${machine}
118 1.9 jonathan fi
119 1.43 fredette if [ -f $setd/lists/$setname/stl.mi ]; then
120 1.43 fredette cat $setd/lists/$setname/stl.mi
121 1.43 fredette fi
122 1.43 fredette if [ -f $setd/lists/$setname/stl.${stlib} ]; then
123 1.43 fredette cat $setd/lists/$setname/stl.${stlib}
124 1.43 fredette fi
125 1.43 fredette if [ "$shlib" != "no" ]; then
126 1.9 jonathan if [ -f $setd/lists/$setname/shl.mi ]; then
127 1.29 jwise cat $setd/lists/$setname/shl.mi
128 1.9 jonathan fi
129 1.9 jonathan if [ -f $setd/lists/$setname/shl.${shlib} ]; then
130 1.29 jwise cat $setd/lists/$setname/shl.${shlib}
131 1.33 mrg fi
132 1.33 mrg fi
133 1.33 mrg if [ "$lintlibs" != no ]; then
134 1.33 mrg if [ -f $setd/lists/$setname/lint.mi ]; then
135 1.33 mrg cat $setd/lists/$setname/lint.mi
136 1.36 jmc fi
137 1.36 jmc fi
138 1.51 lukem if [ "$toolchain_missing" != "yes" ]; then
139 1.36 jmc if [ -f $setd/lists/$setname/tc.mi ]; then
140 1.36 jmc cat $setd/lists/$setname/tc.mi
141 1.46 thorpej fi
142 1.46 thorpej if [ "$shlib" != "no" ]; then
143 1.46 thorpej if [ -f $setd/lists/$setname/tc.shl ]; then
144 1.47 nathanw cat $setd/lists/$setname/tc.shl
145 1.46 thorpej fi
146 1.53 thorpej fi
147 1.53 thorpej fi
148 1.53 thorpej
149 1.53 thorpej # XXX MIPS does not support rescue right now.
150 1.53 thorpej if [ ${machine_cpu} = "mips" ]; then
151 1.53 thorpej continue
152 1.53 thorpej fi
153 1.53 thorpej
154 1.53 thorpej if [ -f $setd/lists/$setname/rescue.mi ]; then
155 1.53 thorpej cat $setd/lists/$setname/rescue.mi
156 1.53 thorpej fi
157 1.53 thorpej if [ -f $setd/lists/$setname/rescue.${machine} ]; then
158 1.53 thorpej cat $setd/lists/$setname/rescue.${machine}
159 1.53 thorpej fi
160 1.53 thorpej if [ "$machine" != "$machine_arch" ]; then
161 1.53 thorpej # Prefer a rescue.ad.${machine_arch} over a
162 1.53 thorpej # rescue.ad.${machine_cpu}, since the arch-
163 1.53 thorpej # specific one will be more specific than the
164 1.53 thorpej # cpu-specific one.
165 1.53 thorpej if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
166 1.53 thorpej cat $setd/lists/$setname/rescue.ad.${machine_arch}
167 1.53 thorpej elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
168 1.53 thorpej cat $setd/lists/$setname/rescue.ad.${machine_cpu}
169 1.53 thorpej fi
170 1.53 thorpej if [ "$shlib" != "no" -a \
171 1.53 thorpej -f $setd/lists/$setname/rescue.ad.${machine_cpu}.shl]; then
172 1.53 thorpej cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
173 1.9 jonathan fi
174 1.8 lukem fi
175 1.42 lukem done | awk -- '/^[^#]/ {print $1}' | sort -u
176