Home | History | Annotate | Line # | Download | only in sets
makeflist revision 1.73
      1 #!/bin/sh
      2 #
      3 # $NetBSD: makeflist,v 1.73 2006/01/03 18:31:09 apb 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="${nlists}"
     12 
     13 usage()
     14 {
     15 	cat 1>&2 <<USAGE
     16 Usage: ${0##*/} [-bxlo] [-a arch] [-m machine] [-s setsdir] [setname [...]]
     17 	-b		print netbsd + x11 lists
     18 	-x		print make x11 lists
     19 	-l		just list the selected set names, not the contents
     20 	-o		only match obsolete files
     21 	-a arch		set arch (e.g, m68k, mipseb, mipsel, powerpc) [${MACHINE_ARCH}]
     22 	-m machine	set machine (e.g, amiga, i386, macppc) [${MACHINE}]
     23 	-s setsdir	directory to find sets [${setsdir}]
     24 	[setname [...]]	sets to build [${lists}]
     25 USAGE
     26 	exit 1
     27 }
     28 
     29 # handle args
     30 while getopts bxloa:m:s: ch; do
     31 	case ${ch} in
     32 	b)
     33 		lists="${nlists} ${xlists}"
     34 		;;
     35 	x)
     36 		lists="${xlists}"
     37 		;;
     38 	l)
     39 		listonly=1
     40 		;;
     41 	o)
     42 		obsolete=1
     43 		;;
     44 	a)
     45 		MACHINE_ARCH="${OPTARG}"
     46 		MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
     47 		;;
     48 	m)
     49 		MACHINE="${OPTARG}"
     50 		;;
     51 	s)
     52 		setsdir="${OPTARG}"
     53 		;;
     54 	*)
     55 		usage
     56 		;;
     57 	esac
     58 done
     59 shift $((${OPTIND} - 1))
     60 if [ -n "$1" ]; then
     61 	lists="$@"
     62 fi
     63 
     64 if [ -n "${listonly}" ]; then
     65 	echo ${lists} | tr ' ' '\n'
     66 	exit 0
     67 fi
     68 
     69 list_set_files ${lists} | ${AWK} '{print $1}' | ${SORT} -u
     70