makeflist revision 1.75 1 1.2 gwr #!/bin/sh
2 1.2 gwr #
3 1.75 uebayasi # $NetBSD: makeflist,v 1.75 2009/11/30 16:13:23 uebayasi Exp $
4 1.2 gwr #
5 1.8 lukem # Print out the files in some or all lists.
6 1.70 lukem # Usage: makeflist [-bxlo] [-a arch] [-m machine] [-s setsdir] [setname ...]
7 1.2 gwr #
8 1.2 gwr
9 1.73 apb rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
10 1.73 apb . "${rundir}/sets.subr"
11 1.73 apb lists="${nlists}"
12 1.65 dyoung
13 1.67 lukem usage()
14 1.67 lukem {
15 1.67 lukem cat 1>&2 <<USAGE
16 1.75 uebayasi Usage: ${0##*/} [-L base,x,ext] [-bxyo] [-a arch] [-m machine] [-s setsdir] [setname [...]]
17 1.75 uebayasi -L base,x,ext print specified lists
18 1.67 lukem -b print netbsd + x11 lists
19 1.67 lukem -x print make x11 lists
20 1.75 uebayasi -y print make extsrc lists
21 1.70 lukem -l just list the selected set names, not the contents
22 1.67 lukem -o only match obsolete files
23 1.73 apb -a arch set arch (e.g, m68k, mipseb, mipsel, powerpc) [${MACHINE_ARCH}]
24 1.73 apb -m machine set machine (e.g, amiga, i386, macppc) [${MACHINE}]
25 1.73 apb -s setsdir directory to find sets [${setsdir}]
26 1.73 apb [setname [...]] sets to build [${lists}]
27 1.67 lukem USAGE
28 1.67 lukem exit 1
29 1.67 lukem }
30 1.61 dyoung
31 1.2 gwr # handle args
32 1.75 uebayasi while getopts L:bxXloa:m:s: ch; do
33 1.67 lukem case ${ch} in
34 1.75 uebayasi L)
35 1.75 uebayasi lists=$(
36 1.75 uebayasi for _list in $( echo ${OPTARG} | tr , ' ' ); do
37 1.75 uebayasi case $_list in
38 1.75 uebayasi base) echo "${nlists}" ;;
39 1.75 uebayasi x) echo "${xlists}" ;;
40 1.75 uebayasi ext) echo "${extlists}" ;;
41 1.75 uebayasi esac
42 1.75 uebayasi done
43 1.75 uebayasi )
44 1.75 uebayasi ;;
45 1.75 uebayasi # backward compat
46 1.67 lukem b)
47 1.73 apb lists="${nlists} ${xlists}"
48 1.8 lukem ;;
49 1.67 lukem x)
50 1.73 apb lists="${xlists}"
51 1.67 lukem ;;
52 1.75 uebayasi y)
53 1.75 uebayasi lists="${extlists}"
54 1.75 uebayasi ;;
55 1.70 lukem l)
56 1.70 lukem listonly=1
57 1.70 lukem ;;
58 1.67 lukem o)
59 1.67 lukem obsolete=1
60 1.67 lukem ;;
61 1.67 lukem a)
62 1.73 apb MACHINE_ARCH="${OPTARG}"
63 1.73 apb MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
64 1.8 lukem ;;
65 1.67 lukem m)
66 1.73 apb MACHINE="${OPTARG}"
67 1.67 lukem ;;
68 1.67 lukem s)
69 1.73 apb setsdir="${OPTARG}"
70 1.8 lukem ;;
71 1.8 lukem *)
72 1.67 lukem usage
73 1.8 lukem ;;
74 1.2 gwr esac
75 1.2 gwr done
76 1.67 lukem shift $((${OPTIND} - 1))
77 1.8 lukem if [ -n "$1" ]; then
78 1.74 apb lists="$*"
79 1.8 lukem fi
80 1.15 simonb
81 1.73 apb if [ -n "${listonly}" ]; then
82 1.70 lukem echo ${lists} | tr ' ' '\n'
83 1.70 lukem exit 0
84 1.70 lukem fi
85 1.70 lukem
86 1.73 apb list_set_files ${lists} | ${AWK} '{print $1}' | ${SORT} -u
87