1 #!/bin/sh 2 # 3 # $NetBSD: makeobsolete,v 1.32 2022/08/21 07:10:03 lukem Exp $ 4 # 5 # Print out the obsolete files for a set 6 # Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \ 7 # [-t target] [setname ...] 8 # 9 10 rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/" 11 . "${rundir}/sets.subr" 12 lists= 13 target=./dist 14 obsolete=1 15 16 usage() 17 { 18 cat 1>&2 <<USAGE 19 Usage: ${0##*/} [-a arch] [-m machine] [-s setsdir] [setname ...] 20 -L base,x make specified lists 21 -b make netbsd + x11 lists 22 -x only make x11 lists 23 -a arch set arch (e.g, m68k, mips, powerpc) [${MACHINE_ARCH}] 24 -m machine set machine (e.g, amiga, i386, macppc) [${MACHINE}] 25 -s setsdir directory to find sets [${setd}] 26 -t target target directory [${target}] 27 [setname ...] sets to build 28 USAGE 29 exit 1 30 } 31 32 while getopts L:bxa:m:s:t: 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 esac 42 done 43 IFS="${save_IFS}" 44 ;; 45 # backward compat 46 b) 47 lists="${nlists} ${xlists}" 48 ;; 49 x) 50 lists="${xlists}" 51 ;; 52 a) 53 MACHINE_ARCH="${OPTARG}" 54 MACHINE_CPU="$(arch_to_cpu "${OPTARG}")" 55 ;; 56 m) 57 MACHINE="${OPTARG}" 58 ;; 59 s) 60 setsdir="${OPTARG}" 61 ;; 62 t) 63 target="${OPTARG}" 64 ;; 65 *) 66 usage 67 ;; 68 esac 69 done 70 shift $((${OPTIND} - 1)) 71 if [ -n "$1" ]; then 72 lists="$*" 73 fi 74 75 if [ ! -d "${target}" ]; then 76 echo "target directory [${target}] doesn't exist" 77 exit 1 78 fi 79 80 for setname in ${lists:-${nlists}}; do 81 file="${target}/${setname}" 82 list_set_files "${setname}" | ${AWK} '{print $1}' | \ 83 ${SORT} -ru > "${file}" 84 done 85