# This makefile is used only if you run GNU Make.
#
# This provides a convenience of automatically running autoreconf and
# configure if they have not previously been run.
#
# Copyright (C) 2001 Free Software Foundation, Inc.
#
# 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.
#
# This file was written by Bob Proulx <bob@proulx.com>.  It was
# inspired by sources found in the GNU coreutils package maintained by
# Jim Meyering <jim@meyering.net>.

have-Makefile := $(shell test -f Makefile && echo yes)
have-configure := $(shell test -f configure && echo yes)

# If the Makefile exists then include it here thereby transferring
# control to it.
#
# If the user runs GNU make but has not yet run ./configure and does
# not yet have a Makefile, then automatically run 'sh ./configure' to
# create the Makefile.  Then call 'make' again recursively.
#
# If the user runs GNU make but has not yet run autoreconf and does
# not yet have a ./configure script, then automatically run
# 'autoreconf' to build the configure script.  Then call 'make' again
# recursively.

ifeq ($(have-Makefile),yes)

include Makefile

else

ifeq ($(have-configure),yes)

all:
	@echo "There seems to be no Makefile in this directory."
	@echo "Running ./configure before running 'make'."
	sh ./configure
	@$(MAKE)

else

all:
	@echo "There seems to be no Makefile in this directory."
	@echo "There seems to be no configure script in this directory."
	@echo "Running 'autoreconf' to generate the configure script."
	autoreconf --install
	@$(MAKE)

endif

endif

# Tell version 3.79 and up of GNU make to not build goals in this
# directory in parallel.  This is necessary in case someone tries to
# build multiple targets on one command line.
.NOTPARALLEL:
