makeflist revision 1.78 1 #!/bin/sh
2 #
3 # $NetBSD: makeflist,v 1.78 2022/08/21 07:10:03 lukem 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] [-bxo] [-a arch] [-m machine] [-s setsdir] [setname [...]]
17 -L base,x print specified lists
18 -b print netbsd + x11 lists
19 -x print make x11 lists
20 -l just list the selected set names, not the contents
21 -o only match obsolete files
22 -a arch set arch (e.g, m68k, mipseb, mipsel, powerpc) [${MACHINE_ARCH}]
23 -m machine set machine (e.g, amiga, i386, macppc) [${MACHINE}]
24 -s setsdir directory to find sets [${setsdir}]
25 [setname [...]] sets to build [${lists}]
26 USAGE
27 exit 1
28 }
29
30 # handle args
31 while getopts L:bxloa:m:s: ch; do
32 case ${ch} in
33 L)
34 save_IFS="${IFS}"
35 IFS=,
36 for _list in ${OPTARG}; do
37 case $_list in
38 base) lists="${lists} ${nlists}" ;;
39 x) lists="${lists} ${xlists}" ;;
40 esac
41 done
42 IFS="${save_IFS}"
43 ;;
44 # backward compat
45 b)
46 lists="${nlists} ${xlists}"
47 ;;
48 x)
49 lists="${xlists}"
50 ;;
51 l)
52 listonly=1
53 ;;
54 o)
55 obsolete=1
56 ;;
57 a)
58 MACHINE_ARCH="${OPTARG}"
59 MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
60 ;;
61 m)
62 MACHINE="${OPTARG}"
63 ;;
64 s)
65 setsdir="${OPTARG}"
66 ;;
67 *)
68 usage
69 ;;
70 esac
71 done
72 shift $((${OPTIND} - 1))
73 if [ -n "$1" ]; then
74 lists="$*"
75 fi
76
77 if [ -n "${listonly}" ]; then
78 echo ${lists} | tr ' ' '\n'
79 exit 0
80 fi
81
82 list_set_files ${lists:-${nlists}} | ${AWK} '{print $1}' | ${SORT} -u
83