1#!/bin/sh 2# 3# $NetBSD: makeobsolete,v 1.31 2009/12/05 15:56:25 cegger 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 10rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/" 11. "${rundir}/sets.subr" 12lists= 13target=./dist 14obsolete=1 15 16usage() 17{ 18 cat 1>&2 <<USAGE 19Usage: ${0##*/} [-a arch] [-m machine] [-s setsdir] [setname ...] 20 -L base,x,ext make specified lists 21 -b make netbsd + x11 lists 22 -x only make x11 lists 23 -y only make extsrc lists 24 -a arch set arch (e.g, m68k, mips, powerpc) [${MACHINE_ARCH}] 25 -m machine set machine (e.g, amiga, i386, macppc) [${MACHINE}] 26 -s setsdir directory to find sets [${setd}] 27 -t target target directory [${target}] 28 [setname ...] sets to build 29USAGE 30 exit 1 31} 32 33while getopts L:bxya:m:s:t: ch; do 34 case ${ch} in 35 L) 36 save_IFS="${IFS}" 37 IFS=, 38 for _list in ${OPTARG}; do 39 case $_list in 40 base) lists="${lists} ${nlists}" ;; 41 x) lists="${lists} ${xlists}" ;; 42 ext) lists="${lists} ${extlists}" ;; 43 esac 44 done 45 IFS="${save_IFS}" 46 ;; 47 # backward compat 48 b) 49 lists="${nlists} ${xlists}" 50 ;; 51 x) 52 lists="${xlists}" 53 ;; 54 y) 55 lists="${extlists}" 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 t) 68 target="${OPTARG}" 69 ;; 70 *) 71 usage 72 ;; 73 esac 74done 75shift $((${OPTIND} - 1)) 76if [ -n "$1" ]; then 77 lists="$*" 78fi 79 80if [ ! -d "${target}" ]; then 81 echo "target directory [${target}] doesn't exist" 82 exit 1 83fi 84 85for setname in ${lists:-${nlists}}; do 86 file="${target}/${setname}" 87 list_set_files "${setname}" | ${AWK} '{print $1}' | \ 88 ${SORT} -ru > "${file}" 89done 90