makeflist revision 1.59 1 1.2 gwr #!/bin/sh
2 1.2 gwr #
3 1.58 simonb # $NetBSD: makeflist,v 1.59 2003/03/15 22:32:09 he 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.59 he lkm=yes
77 1.59 he # Turn off LKMs for some ports.
78 1.59 he if [ "$machine" = "evbppc" ]; then
79 1.59 he lkm=no
80 1.59 he fi
81 1.1 cgd
82 1.33 mrg # Turn off lintlibs for some ports.
83 1.57 fvdl # Not needed anymore, leave the hook here for future use.
84 1.33 mrg lintlibs=
85 1.44 tron
86 1.44 tron # Automatically add XFree86 version specific sets
87 1.44 tron for list in $lists
88 1.44 tron do
89 1.44 tron if [ -z "$_lists" ]
90 1.44 tron then
91 1.44 tron _lists=$list
92 1.44 tron else
93 1.44 tron _lists="$_lists $list"
94 1.44 tron fi
95 1.44 tron if [ -d "$setd/lists/$list${x11_version}" ]
96 1.44 tron then
97 1.44 tron _lists="$_lists $list${x11_version}"
98 1.44 tron fi
99 1.44 tron done
100 1.44 tron lists=$_lists
101 1.44 tron unset _lists
102 1.33 mrg
103 1.8 lukem for setname in $lists; do
104 1.29 jwise cat $setd/lists/$setname/mi
105 1.48 fredette if [ "$machine" != "$machine_arch" ]; then
106 1.50 thorpej # Prefer an ad.${machine_arch} over an ad.${machine_cpu},
107 1.50 thorpej # since the arch-specific one will be more specific than
108 1.50 thorpej # the cpu-specific one.
109 1.50 thorpej if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
110 1.50 thorpej cat $setd/lists/$setname/ad.${machine_arch}
111 1.50 thorpej elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
112 1.48 fredette cat $setd/lists/$setname/ad.${machine_cpu}
113 1.48 fredette fi
114 1.48 fredette if [ "$shlib" != "no" -a \
115 1.48 fredette -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
116 1.48 fredette cat $setd/lists/$setname/ad.${machine_cpu}.shl
117 1.48 fredette fi
118 1.8 lukem fi
119 1.8 lukem if [ -f $setd/lists/$setname/md.${machine} ]; then
120 1.29 jwise cat $setd/lists/$setname/md.${machine}
121 1.9 jonathan fi
122 1.43 fredette if [ -f $setd/lists/$setname/stl.mi ]; then
123 1.43 fredette cat $setd/lists/$setname/stl.mi
124 1.43 fredette fi
125 1.43 fredette if [ -f $setd/lists/$setname/stl.${stlib} ]; then
126 1.43 fredette cat $setd/lists/$setname/stl.${stlib}
127 1.43 fredette fi
128 1.43 fredette if [ "$shlib" != "no" ]; then
129 1.9 jonathan if [ -f $setd/lists/$setname/shl.mi ]; then
130 1.29 jwise cat $setd/lists/$setname/shl.mi
131 1.9 jonathan fi
132 1.9 jonathan if [ -f $setd/lists/$setname/shl.${shlib} ]; then
133 1.29 jwise cat $setd/lists/$setname/shl.${shlib}
134 1.59 he fi
135 1.59 he fi
136 1.59 he if [ "$lkm" != "no" ]; then
137 1.59 he if [ -f $setd/lists/$setname/lkm.mi ]; then
138 1.59 he cat $setd/lists/$setname/lkm.mi
139 1.33 mrg fi
140 1.33 mrg fi
141 1.33 mrg if [ "$lintlibs" != no ]; then
142 1.33 mrg if [ -f $setd/lists/$setname/lint.mi ]; then
143 1.33 mrg cat $setd/lists/$setname/lint.mi
144 1.36 jmc fi
145 1.36 jmc fi
146 1.51 lukem if [ "$toolchain_missing" != "yes" ]; then
147 1.36 jmc if [ -f $setd/lists/$setname/tc.mi ]; then
148 1.36 jmc cat $setd/lists/$setname/tc.mi
149 1.46 thorpej fi
150 1.46 thorpej if [ "$shlib" != "no" ]; then
151 1.46 thorpej if [ -f $setd/lists/$setname/tc.shl ]; then
152 1.47 nathanw cat $setd/lists/$setname/tc.shl
153 1.46 thorpej fi
154 1.53 thorpej fi
155 1.53 thorpej fi
156 1.53 thorpej
157 1.53 thorpej if [ -f $setd/lists/$setname/rescue.mi ]; then
158 1.53 thorpej cat $setd/lists/$setname/rescue.mi
159 1.53 thorpej fi
160 1.53 thorpej if [ -f $setd/lists/$setname/rescue.${machine} ]; then
161 1.53 thorpej cat $setd/lists/$setname/rescue.${machine}
162 1.53 thorpej fi
163 1.53 thorpej if [ "$machine" != "$machine_arch" ]; then
164 1.53 thorpej # Prefer a rescue.ad.${machine_arch} over a
165 1.53 thorpej # rescue.ad.${machine_cpu}, since the arch-
166 1.53 thorpej # specific one will be more specific than the
167 1.53 thorpej # cpu-specific one.
168 1.53 thorpej if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
169 1.53 thorpej cat $setd/lists/$setname/rescue.ad.${machine_arch}
170 1.53 thorpej elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
171 1.53 thorpej cat $setd/lists/$setname/rescue.ad.${machine_cpu}
172 1.53 thorpej fi
173 1.54 briggs if [ "$shlib" != "no" -a -f \
174 1.54 briggs $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
175 1.53 thorpej cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
176 1.9 jonathan fi
177 1.8 lukem fi
178 1.42 lukem done | awk -- '/^[^#]/ {print $1}' | sort -u
179