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