Home | History | Annotate | Line # | Download | only in sets
makeflist revision 1.75
      1 #!/bin/sh
      2 #
      3 # $NetBSD: makeflist,v 1.75 2009/11/30 16:13:23 uebayasi 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##*/} [-L base,x,ext] [-bxyo] [-a arch] [-m machine] [-s setsdir] [setname [...]]
     17 	-L base,x,ext	print specified lists
     18 	-b		print netbsd + x11 lists
     19 	-x		print make x11 lists
     20 	-y		print make extsrc lists
     21 	-l		just list the selected set names, not the contents
     22 	-o		only match obsolete files
     23 	-a arch		set arch (e.g, m68k, mipseb, mipsel, powerpc) [${MACHINE_ARCH}]
     24 	-m machine	set machine (e.g, amiga, i386, macppc) [${MACHINE}]
     25 	-s setsdir	directory to find sets [${setsdir}]
     26 	[setname [...]]	sets to build [${lists}]
     27 USAGE
     28 	exit 1
     29 }
     30 
     31 # handle args
     32 while getopts L:bxXloa:m:s: ch; do
     33 	case ${ch} in
     34 	L)
     35 		lists=$(
     36 			for _list in $( echo ${OPTARG} | tr , ' ' ); do
     37 				case $_list in
     38 				base)	echo "${nlists}" ;;
     39 				x)	echo "${xlists}" ;;
     40 				ext)	echo "${extlists}" ;;
     41 				esac
     42 			done
     43 		)
     44 		;;
     45 	# backward compat
     46 	b)
     47 		lists="${nlists} ${xlists}"
     48 		;;
     49 	x)
     50 		lists="${xlists}"
     51 		;;
     52 	y)
     53 		lists="${extlists}"
     54 		;;
     55 	l)
     56 		listonly=1
     57 		;;
     58 	o)
     59 		obsolete=1
     60 		;;
     61 	a)
     62 		MACHINE_ARCH="${OPTARG}"
     63 		MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
     64 		;;
     65 	m)
     66 		MACHINE="${OPTARG}"
     67 		;;
     68 	s)
     69 		setsdir="${OPTARG}"
     70 		;;
     71 	*)
     72 		usage
     73 		;;
     74 	esac
     75 done
     76 shift $((${OPTIND} - 1))
     77 if [ -n "$1" ]; then
     78 	lists="$*"
     79 fi
     80 
     81 if [ -n "${listonly}" ]; then
     82 	echo ${lists} | tr ' ' '\n'
     83 	exit 0
     84 fi
     85 
     86 list_set_files ${lists} | ${AWK} '{print $1}' | ${SORT} -u
     87