# Makefile for GNU F77 compiler runtime, libc interface.
# Copyright (C) 1995-1997 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 = .

#### 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 = -O2 $(GCC_FLAGS) 
CPPFLAGS = 
DEFS = -DHAVE_CONFIG_H -DNON_UNIX_STDIO
CGFLAGS = -g0
# 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) -I$(srcdir)/../libI77 -I.. $(CPPFLAGS) $(DEFS) $(CFLAGS)
AR = ar
AR_FLAGS = rc
RANLIB = ar s
RANLIB_TEST = true
CROSS = 

.SUFFIXES:
.SUFFIXES: .c .o


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

F2C_H = ../f2c.h

all: $(OBJS) $(LIB)

$(OBJDIR)/VersionU.o: Version.c
	$(CC) -c $(CGFLAGS) -o $@ Version.c

$(OBJDIR)/%.o : %.c 
	$(CC) -c -DSkip_f2c_Undefs $(ALL_CFLAGS) $(CGFLAGS) -o $@ $<

$(LIB):	$(OBJS)
	$(AR) $(AR_FLAGS) $(LIB) $(OBJS)
	$(AR) d $(LIB) __.SYMDEF
	$(RANLIB) $(LIB)

lint:
	lint $(CFLAGS) $(SRCS)

mostlyclean:
	-rm -f $(OBJS)

clean: mostlyclean
	-rm -f config.log a.out

distclean realclean maintainer-clean: clean
	-rm -f config.h Makefile config.status config.cache stage? include

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

check:
	-$(G77DIR)g77 --driver=$(G77DIR)/xgcc -B$(G77DIR) -g $(srcdir)/u77-test.f $(lib) && ./a.out
	rm -f a.out

access_.o: access_.c
ctime_.o: ctime_.c
dtime_.o: dtime_.c
etime_.o: etime_.c
fnum_.o: fnum_.c $(srcdir)/../libI77/fio.h
fstat_.o: fstat_.c
gerror_.o: gerror_.c
getcwd_.o: getcwd_.c
getgid_.o: getgid_.c
getlog_.o: getlog_.c
getpid_.o: getpid_.c
getuid_.o: getuid_.c
idate_.o: idate_.c
ierrno_.o: ierrno_.c
irand_.o: irand_.c
isatty_.o: isatty_.c $(srcdir)/../libI77/fio.h
itime_.o: itime_.c
kill_.o: kill_.c
link_.o: link_.c
loc_.o: loc_.c
lstat_.o: lstat_.c
ltime_.o: ltime_.c
perror_.o: perror_.c
qsort.o: qsort.c
qsort_.o: qsort_.c
rand_.o: rand_.c
rename_.o: rename_.c
second_.o: second_.c
sleep_.o: sleep_.c
srand_.o: srand_.c
stat_.o: stat_.c
symlnk_.o: symlnk_.c
time_.o: time_.c
ttynam_.o: ttynam_.c
unlink_.o: unlink_.c
wait_.o: wait_.c
vxttime_.o: vxttime_.c
vtxidate_.o: vxtidate_.c
fdate_.o: fdate_.c
gmtime_.o: gmtime_.c
secnds_.o: secnds_.c
bes.o: bes.c
dbes.o: dbes.c
lnblnk_.o: lnblnk_.c
chmod_.o: chmod_.c
chdir_.o: chdir_.c
hostnm_.o: hostnm_.c
rename_.o: rename_.c
fputc_.o: fputc_.c
fgetc_.o: fgetc_.c
system_clock_.o: system_clock_.c
umask_.o: umask_.c
flush1_.o: flush1_.c
mclock_.o: mclock_.c
alarm_.o: alarm_.c

.PHONY: mostlyclean clean distclean maintainer-clean lint check all
