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