#!/bin/sh
#
# $NetBSD: makeflist,v 1.67 2003/12/29 03:13:25 lukem Exp $
#
# Print out the files in some or all lists.
# Usage: makeflist [-b] [-x] [-a arch] [-m machine] [-s setsdir] [setname ...]
#

. ./sets.subr
lists=$nlists

usage()
{
	cat 1>&2 <<USAGE
Usage: ${0##*/} [-b] [-x] [-o] [-a arch] [-m machine] [-s setsdir]
		[setname [...]]
	-b		print netbsd + x11 lists
	-x		print make x11 lists
	-o		only match obsolete files
	-a arch		set arch (e.g, m68k, mipseb, mipsel, powerpc) [$machine_arch]
	-m machine	set machine (e.g, amiga, i386, macppc) [$machine]
	-s setsdir	directory to find sets [$setsdir]
	[setname [...]]	sets to build [$lists]
USAGE
	exit 1
}

# handle args
while getopts bxoa:m:s: ch; do
	case ${ch} in
	b)
		lists="$xlists $nlists"
		;;
	x)
		lists="$xlists"
		;;
	o)
		obsolete=1
		;;
	a)
		machine_arch=${OPTARG}
		machine_cpu=$(arch_to_cpu ${OPTARG})
		;;
	m)
		machine=${OPTARG}
		;;
	s)
		setsdir=${OPTARG}
		;;
	*)
		usage
		;;
	esac
done
shift $((${OPTIND} - 1))
if [ -n "$1" ]; then
	lists="$@"
fi

for setname in $lists; do
	list_set_files $setname
done | awk '{print $1}' | sort -u
