#  Copyright (C) 2003 Ingo K"ohne
#  
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#  
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#  
#  You should have received a copy of the GNU General Public License along
#  with this program; if not, write to the Free Software Foundation, Inc.,
#  59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

. ../include/common



cmd=make

optcomplete -V C -d  $cmd C directory
optcomplete  $cmd d e environment-overrides h help i ignore-errors k keep-going n just-print dry-run recon p print-data-base q question r no-builtin-rules R no-builtin-variables s silent quiet S no-keep-going stop t touch v version w print-directory no-print-directory warn-undefined-variables
optcomplete -O, -W 'all basic verbose implicit jobs makefile'  $cmd debug
optcomplete -m filename -V f -C '
test -z "$XPC_C" && compgen -f -- "$XPC_PATTERN"
test -d "$XPC_C" || return 
test -x "$XPC_C" || return 
compgen -f -- "$XPC_C/$XPC_PATTERN" | cut -c $(echo -n "$XPC_C/ " | wc -c)- 
#'  $cmd f makefile file
optcomplete -f  $cmd assume-old old-file o 
optcomplete -f  $cmd assume-new new-file what-if W
optcomplete -d  $cmd include-dir I
optcomplete -m arg_optional  $cmd jobs j load-average l max-load
optcomplete -C '
if test "${!XPC_f*}" != XPC_f ; then
	if test -f "${XPC_C:+$XPC_C/}GNUmakefile"; then 
		 XPC_f=GNUmakefile
	elif test -f "${XPC_C:+$XPC_C/}makefile"; then 
		 XPC_f=makefile
	elif test -f "${XPC_C:+$XPC_C/}Makefile"; then 
		 XPC_f=Makefile
	fi
fi
test -f "${XPC_C:+$XPC_C/}$XPC_f" || return 
test -r "${XPC_C:+$XPC_C/}$XPC_f" || return 
sed -n "/^[#	]/d;/:=/d;s/:.*//;tl;d;:l;/\\$/d;/^${XPC_PATTERN%%[^[:alnum:]]*}/p" "${XPC_C:+$XPC_C/}$XPC_f" | tr " " "\n";
#'  $cmd NONOPT

optcomplete -m long,getoptparse  $cmd

complete -F xpcompfunc make

unset cmd ${!xpc_*}
