# makefile generated by hand (Michael Holzapfel Dez. 1996)
# Makefile for GNU F77 compiler runtime, libc interface.
# Copyright (C) 1995, 1996 Free Software Foundation, Inc.
#   Contributed by Dave Love (d.love@dl.ac.uk).
#
#This file is part of GNU Fortran libU77 library.
#
#This library is free software; you can redistribute it and/or modify
#it under the terms of the GNU Library 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
#Library 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
#Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#SHELL = /bin/sh

srcdir = .
.VPATH = 

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

# The _FOR_TARGET things are appropriate for a cross-make, passed by the
# superior makefile
GCC_FOR_TARGET = gcc
CC = $(GCC_FOR_TARGET)
CFLAGS = $(GCC_FLAGS)
CPPFLAGS = 
DEFS =  -DHAVE_CONFIG_H -Zmtd
CGFLAGS = -O2
# f2c.h should already be installed in xgcc's include directory but add that
# to -I anyhow in case not using xgcc.  fio.h is in libI77.  We need config.h
# from `.'.
ALL_CFLAGS = -I. -I$(srcdir)/../libI77 -I../ $(CPPFLAGS) $(DEFS) $(CFLAGS)
AR = ar
AR_FLAGS = rc
RANLIB = $(AR) s
RANLIB_TEST = 
CROSS = 

.SUFFIXES:
.SUFFIXES: .c .o

.c.o:
	$(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $(CGFLAGS) $<

OBJS = gerror_.o perror_.o ierrno_.o itime_.o time_.o unlink_.o \
	fnum_.o getpid_.o getuid_.o getgid_.o kill_.o rand_.o \
	srand_.o irand_.o sleep_.o idate_.o ctime_.o etime_.o \
	dtime_.o  isatty_.o ltime_.o fstat_.o stat_.o \
	lstat_.o access_.o link_.o getlog_.o ttynam_.o getcwd_.o \
        vxttime_.o vxtidate_.o gmtime_.o fdate_.o secnds_.o \
	bes.o dbes.o \
	chdir_.o lnblnk_.o hostnm_.o rename_.o fgetc_.o fputc_.o umask_.o \
        system_clock_.o date_.o second_.o flush1_.o 
SRCS = gerror_.c perror_.c ierrno_.c itime_.c time_.c unlink_.c \
	fnum_.c getpid_.c getuid_.c getgid_.c kill_.c rand_.c \
	srand_.c irand_.c sleep_.c idate_.c ctime_.c etime_.c \
	dtime_.c isatty_.c ltime_.c fstat_.c stat_.c \
	lstat_.c access_.c link_.c getlog_.c ttynam_.c getcwd_.c symlnk_.c \
        vxttime_.c vxtidate_.c gmtime_.c fdate_.c secnds_.c \
	bes.c dbes.c \
	chdir_.c chmod_.c lnblnk_.c hostnm_.c rename_.c fgetc_.c fputc_.c \
	umask_.c system_clock_.c date_.c second_.c flush1_.c

lib = ../f2c.a
F2C_H = ../f2c.h

all: Makefile $(F2C_H) $(lib)

$(lib): $(OBJS)
# Don't worry if ar fails, that can happen when a root-like user installs a
# system built by a user to which the installer has insufficient access
# to modify libf2c.a.  Probably a better solution to this should be
# found, but this should do for now.  -- burley 951226
	-$(AR) $(AR_FLAGS) $(lib) $(OBJS)
	 $(AR) d $(lib) __.SYMDEF
	 $(RANLIB) $(lib)

libu77: $(OBJS)
	$(AR) $(AR_FLAGS) $(lib) $?
	$(RANLIB) $(lib)

test: test.o libu77
	g77 -g -o test test.o $(lib) -Zexe
	-./test

test-native:
	f77 -o test $(srcdir)/test.f && ./test
	rm -f test

test.o: $(srcdir)/test.f
	g77 -g -c $(srcdir)/test.f

lint:
	lint $(CFLAGS) $(SRCS)

clean:
	-rm -f $(OBJS) config.log a.out *~

distclean realclean: clean
	-rm -f config.h Makefile config.status stamp-h config.cache

$(OBJS):	$(F2C_H) config.h

${srcdir}/configure: configure.in
	cd ${srcdir} && autoconf

# autoheader might not change config.h.in, so touch a stamp file.
#${srcdir}/config.h.in: stamp-h.in
#${srcdir}/stamp-h.in: configure.in
#	cd ${srcdir} && autoheader
#	echo timestamp > ${srcdir}/stamp-h.in

check:
	-g77 -g u77-test.f $(lib) && ./a.out
	rm -f a.out

