# Makefile for GNU F77 compiler runtime.
#   Copyright (C) 1995 Free Software Foundation, Inc.
#   Contributed by Dave Love (d.love@dl.ac.uk).
#
#This file is part of GNU Fortran.
#
#GNU Fortran 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, or (at your option)
#any later version.
#
#GNU Fortran 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 GNU Fortran; see the file COPYING.  If not, write to
#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

#### Start of system configuration section. ####

srcdir = @srcdir@
VPATH = @srcdir@

top_srcdir = @top_srcdir@

INSTALL = @INSTALL@		# installs aren't actually done from here
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
RANLIB = @RANLIB@
RANLIB_TEST_FOR_TARGET = @RANLIB_TEST_FOR_TARGET@
RANLIB_FOR_TARGET = @RANLIB_FOR_TARGET@

CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@ @DEFS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

GCC_FOR_TARGET = @CC@
CC = $(GCC_FOR_TARGET)

CROSS = @CROSS@

transform=@program_transform_name@

prefix = @prefix@
exec_prefix = @exec_prefix@

AR_FLAGS = rc

# Directory in which to install scripts.
bindir = $(exec_prefix)/bin

# Directory in which to install library files.
libdir = $(prefix)/lib

# Directory in which to install documentation info files.
infodir = $(prefix)/info

#### End of system configuration section. ####

SHELL = /bin/sh

SUBDIRS = libI77 libF77

# flags_to_pass to recursive makes & configure (hence the quoting style)
FLAGS_TO_PASS = \
	CROSS="$(CROSS)" \
	AR_FLAGS="$(AR_FLAGS)" \
	AR_FOR_TARGET="$(AR_FOR_TARGET)" \
	GCCFLAGS="$(GCCFLAGS)" \
	GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
	CC="$(GCC_FOR_TARGET)" \
	LDFLAGS="$(LDFLAGS)" \
	RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \
	RANLIB_TEST_FOR_TARGET="$(RANLIB_TEST_FOR_TARGET)" \
	SHELL="$(SHELL)"

all: ../../include/f2c.h libi77 libf77

libi77: libI77/Makefile
	cd libI77;  $(MAKE) $(FLAGS_TO_PASS) all
libf77: libF77/Makefile
	cd libF77;  $(MAKE) $(FLAGS_TO_PASS) all

${srcdir}/configure: ${srcdir}/configure.in
	cd ${srcdir} && autoconf && rm -f config.cache
../../include/f2c.h libI77/Makefile libF77/Makefile Makefile: Makefile.in \
          config.status
	$(FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) config.status
# Extra dependencies for the targets above:
libI77/Makefile: libI77/Makefile.in
libF77/Makefile: libF77/Makefile.in
# include is linked into ..
../../include/f2c.h: f2c.h.in

config.status: configure
	$(FLAGS_TO_PASS) CONFIG_SITE=/dev/null $(SHELL) config.status --recheck

clean:
	-rm -f config.log config.cache
	for i in libI77 libF77; do cd $$i; $(MAKE) clean; cd ..;  done

distclean: clean
	-rm -f Makefile lib?77/Makefile config.status config.log ../../include/f2c.h

mostlyclean: clean

uninstall:
	rm ../../include/f2c.h

.PHONY: libf77 libi77
