Home | History | Annotate | Line # | Download | only in sets
makeflist revision 1.76.12.1
      1        1.2       gwr #!/bin/sh
      2        1.2       gwr #
      3  1.76.12.1       tls # $NetBSD: makeflist,v 1.76.12.1 2013/02/25 00:24:29 tls Exp $
      4        1.2       gwr #
      5        1.8     lukem # Print out the files in some or all lists.
      6       1.70     lukem # Usage: makeflist [-bxlo] [-a arch] [-m machine] [-s setsdir] [setname ...]
      7        1.2       gwr #
      8        1.2       gwr 
      9       1.73       apb rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
     10       1.73       apb . "${rundir}/sets.subr"
     11       1.76    cegger lists=
     12       1.65    dyoung 
     13       1.67     lukem usage()
     14       1.67     lukem {
     15       1.67     lukem 	cat 1>&2 <<USAGE
     16       1.75  uebayasi Usage: ${0##*/} [-L base,x,ext] [-bxyo] [-a arch] [-m machine] [-s setsdir] [setname [...]]
     17       1.75  uebayasi 	-L base,x,ext	print specified lists
     18       1.67     lukem 	-b		print netbsd + x11 lists
     19       1.67     lukem 	-x		print make x11 lists
     20       1.75  uebayasi 	-y		print make extsrc lists
     21       1.70     lukem 	-l		just list the selected set names, not the contents
     22       1.67     lukem 	-o		only match obsolete files
     23       1.73       apb 	-a arch		set arch (e.g, m68k, mipseb, mipsel, powerpc) [${MACHINE_ARCH}]
     24       1.73       apb 	-m machine	set machine (e.g, amiga, i386, macppc) [${MACHINE}]
     25       1.73       apb 	-s setsdir	directory to find sets [${setsdir}]
     26       1.73       apb 	[setname [...]]	sets to build [${lists}]
     27       1.67     lukem USAGE
     28       1.67     lukem 	exit 1
     29       1.67     lukem }
     30       1.61    dyoung 
     31        1.2       gwr # handle args
     32  1.76.12.1       tls while getopts L:bxloa:m:s: ch; do
     33       1.67     lukem 	case ${ch} in
     34       1.75  uebayasi 	L)
     35       1.76    cegger 		save_IFS="${IFS}"
     36       1.76    cegger 		IFS=,
     37       1.76    cegger 		for _list in ${OPTARG}; do
     38       1.76    cegger 			case $_list in
     39       1.76    cegger 			base)	lists="${lists} ${nlists}" ;;
     40       1.76    cegger 			x)	lists="${lists} ${xlists}" ;;
     41       1.76    cegger 			ext)	lists="${lists} ${extlists}" ;;
     42       1.76    cegger 			esac
     43       1.76    cegger 		done
     44       1.76    cegger 		IFS="${save_IFS}"
     45       1.75  uebayasi 		;;
     46       1.75  uebayasi 	# backward compat
     47       1.67     lukem 	b)
     48       1.73       apb 		lists="${nlists} ${xlists}"
     49        1.8     lukem 		;;
     50       1.67     lukem 	x)
     51       1.73       apb 		lists="${xlists}"
     52       1.67     lukem 		;;
     53       1.75  uebayasi 	y)
     54       1.75  uebayasi 		lists="${extlists}"
     55       1.75  uebayasi 		;;
     56       1.70     lukem 	l)
     57       1.70     lukem 		listonly=1
     58       1.70     lukem 		;;
     59       1.67     lukem 	o)
     60       1.67     lukem 		obsolete=1
     61       1.67     lukem 		;;
     62       1.67     lukem 	a)
     63       1.73       apb 		MACHINE_ARCH="${OPTARG}"
     64       1.73       apb 		MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
     65        1.8     lukem 		;;
     66       1.67     lukem 	m)
     67       1.73       apb 		MACHINE="${OPTARG}"
     68       1.67     lukem 		;;
     69       1.67     lukem 	s)
     70       1.73       apb 		setsdir="${OPTARG}"
     71        1.8     lukem 		;;
     72        1.8     lukem 	*)
     73       1.67     lukem 		usage
     74        1.8     lukem 		;;
     75        1.2       gwr 	esac
     76        1.2       gwr done
     77       1.67     lukem shift $((${OPTIND} - 1))
     78        1.8     lukem if [ -n "$1" ]; then
     79       1.74       apb 	lists="$*"
     80        1.8     lukem fi
     81       1.15    simonb 
     82       1.73       apb if [ -n "${listonly}" ]; then
     83       1.70     lukem 	echo ${lists} | tr ' ' '\n'
     84       1.70     lukem 	exit 0
     85       1.70     lukem fi
     86       1.70     lukem 
     87       1.76    cegger list_set_files ${lists:-${nlists}} | ${AWK} '{print $1}' | ${SORT} -u
     88