makeobsolete revision 1.9
1#!/bin/sh 2# 3# $NetBSD: makeobsolete,v 1.9 2002/04/08 15:39:32 tron 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# set defaults 11: ${MAKE=make} 12machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | $MAKE -s -f-`} 13arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | $MAKE -s -f-`} 14setd=`pwd` 15nlists="base comp etc games man misc text" 16xlists= 17for xlist in xbase xcomp xcontrib xfont xserver xmisc 18do 19 if [ -z "$xlists" ] 20 then 21 xlists=$xlist 22 else 23 xlists="$xlists $xlist" 24 fi 25 if [ -d "$setd/lists/$xlist${x11_version}" ] 26 then 27 xlists="$xlists $xlist${x11_version}" 28 fi 29done 30lists=$nlists 31target=./dist 32 33# handle args 34while : ; do 35 case $1 in 36 -b*) 37 lists="$xlists $nlists" 38 ;; 39 -x*) 40 lists=$xlists;; 41 -a*) 42 arch=$2; shift 43 ;; 44 -m*) 45 machine=$2; shift 46 ;; 47 -s*) 48 setd=$2; shift 49 ;; 50 -t*) 51 target=$2;shift 52 ;; 53 -*) 54 cat 1>&2 <<USAGE 55Usage: $0 [-a arch] [-m machine] [-s setsdir] [setname ...] 56 -b make netbsd + x11 lists 57 -x only make x11 lists 58 -a arch set arch (e.g, m68k, mips, powerpc) [$arch] 59 -m machine set machine (e.g, amiga, i386, macppc) [$machine] 60 -s setsdir directory to find sets [$setd] 61 -t target target directory [$target] 62 [setname ...] sets to build 63USAGE 64 exit 1 65 ;; 66 *) 67 break 68 ;; 69 esac 70 shift 71done 72if [ -n "$1" ]; then 73 lists="$*" 74fi 75 76# Convert mipse[lb] to mips after processing command line arguments. 77arch=`echo $arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3e,` 78 79if [ ! -d $target ] ; then 80 echo "target directory [$target] doesn't exists" 81 exit 1 82fi 83 84for setname in $lists; do 85 file=$target/${setname}_obsolete 86 ( 87 if [ -f $setd/lists/$setname/obsolete.mi ]; then 88 awk -- '{print $1}' $setd/lists/$setname/obsolete.mi 89 fi 90 if [ "$machine" != "$cpu" -a \ 91 -f $setd/lists/$setname/obsolete.${arch} ]; then 92 awk -- '{print $1}' $setd/lists/$setname/obsolete.${arch} 93 fi 94 if [ -f $setd/lists/$setname/obsolete.${machine} ]; then 95 awk -- '{print $1}' $setd/lists/$setname/obsolete.${machine} 96 fi) | egrep -v '^#' | sort -ru > $file 97 if [ ! -s $file ] ; then 98 rm $file 99 fi 100 101done | egrep -v '^#' | sort -ru 102