Commit d2479143 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding with migration

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2459
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 2d2d7814
# this is <Makefile>
# ----------------------------------------------------------------------------
# Makefile for work/src/libs/libtime
# ($Id: Makefile,v 2.29 2007-09-13 10:27:10 tforb Exp $)
# ($Id: Makefile,v 2.30 2007-12-05 15:49:26 tforb Exp $)
#
# how to build all flavours of libtime
#
......@@ -33,33 +33,41 @@
# 28/03/2006 V1.4 added target package
# 29/03/2006 V1.5 no SERVER dirs; add tfmacros.h to package
# 04/04/2006 V1.6 provide global FLAGS
# 05/12/2007 V1.7 migration to fenoglio with new environment variables
# and new Fortan compilation default: g77
#
# ============================================================================
# check for cross compiler
BINPREFIX=
FC=$(BINPREFIX)g77
CC=$(BINPREFIX)gcc
GXX=$(BINPREFIX)g++
AR=$(BINPREFIX)ar
AS=$(BINPREFIX)as
RANLIB=$(BINPREFIX)ranlib
FC=g77
CC=gcc
GXX=g++
AR=ar
AS=as
RANLIB=ranlib
FLAGS=
FLAGS=$(MYFLAGS)
LIBF2C=-lm -lf2c
F2CFLAGS=-f -u
FFLAGS=-Wall
CFLAGS=-O2 $(FLAGS)
CPPFLAGS=-I. -I${LOCINCLUDEDIR}
LIBTIME=-ltime -L$(LOCLIBDIR)
ifeq ($(TF_FALLBACK),yes)
LIBTIME77=-ltime77 -L$(LOCLIBDIR)
else
LIBF2CTIME=-lf2ctime -L$(LOCLIBDIR)
endif
LIBCTIME=-lctime -L$(LOCLIBDIR)
LIBCXXTIME=-ltime++ -L$(LOCLIBDIR)
LIBTIMETRAD=-ltime_trad -L$(LOCLIBDIR)
# external homemade library (needed by testlibtime)
LIBSFFU=-lsffu -L$(LOCLIBDIR)
ifeq ($(TF_FALLBACK),yes)
LIBSFFU77=-lsffu77 -L$(LOCLIBDIR)
else
LIBF2CSFFU=-lf2csffu -L$(LOCLIBDIR)
endif
all: install doc example exectests
install: install-headers libraries
......@@ -142,6 +150,7 @@ README=README README.changes README.files README.unsplit
# rules
# -----
ifeq ($(TF_FALLBACK),yes)
# how to create object files thorugh f2c
%.o: %.f
f2c $(F2CFLAGS) -d $(@D) $<
......@@ -150,12 +159,22 @@ README=README README.changes README.files README.unsplit
# how to create pure f77 object files
%.o77: %.f; $(FC) $(FFLAGS) $(FLAGS) -c -o $@ $^
else
# how to create object files thorugh f2c
%.f2c.o: %.f
f2c $(F2CFLAGS) -d $(@D) $<
$(CC) $(CFLAGS) $(CPPFLAGS) $(FLAGS) -o $@ $(<:.f=.c) -c
@rm $(<:.f=.c)
# how to create pure f77 object files
%.o: %.f; $(FC) $(FFLAGS) $(FLAGS) -c -o $@ $^
endif
# C++ stuff
%.o: %.cc; $(CXX) $(FLAGS) -o $@ $< -c -I$(LOCINCLUDEDIR)
# how to build a library
%.a: ; $(AR) rcv $@ $^ ; $(RANLIB) $@ ; newlib $@
%.a: ; $(AR) rcv $@ $^ ; $(RANLIB) $@ ; /bin/mv -fv $@ $(LOCLIBDIR)
#======================================================================
#
......@@ -175,12 +194,13 @@ flist: $(KERNEL) $(FCODE) $(CWRAPPER) $(CCODE) Makefile $(README) \
edit: flist; vim $<
install-headers: $(HEADERS) ; newinclude $^
install-headers: $(HEADERS) ; /bin/ln -sf $^ $(LOCINCLUDEDIR)
#======================================================================
#
# library dependency definitions
# ------------------------------
ifeq ($(TF_FALLBACK),yes)
libraries: libtime_trad.a libtime.a libtime77.a libctime.a libtime++.a
# traditional libtime
......@@ -192,6 +212,15 @@ libtime.a: $(patsubst %.f,%.o,$(KERNEL) $(FCODE) $(FHANDLER))
# pure FORTRAN libtime (f77 version)
libtime77.a: $(patsubst %.f,%.o77,$(KERNEL) $(FCODE) $(FHANDLER))
else
libraries: libtime.a libf2ctime.a libctime.a libtime++.a
# pure FORTRAN libtime (g77 version)
libtime.a: $(patsubst %.f,%.o,$(KERNEL) $(FCODE) $(FHANDLER))
# pure FORTRAN libtime (f2c version)
libf2ctime.a: $(patsubst %.f,%.f2c.o,$(KERNEL) $(FCODE) $(FHANDLER))
endif
# pure C libtime
libctime.a: $(patsubst %.f,%.o,$(KERNEL)) \
......@@ -207,11 +236,19 @@ libtime++.a: $(patsubst %.f,%.o,$(KERNEL)) \
# test code
# ---------
ifeq ($(TF_FALLBACK),yes)
$(patsubst %.f,%,$(FTESTS)): %: %.o libtime.a
$(CC) -o $@ $< $(LIBTIME) $(LIBSFFU) $(LIBF2C)
$(patsubst %.f,%77,$(FTESTS)): %77: %.o77 libtime.a
$(FC) -o $@ $< $(LIBTIME77) $(LIBSFFU77)
else
$(patsubst %.f,%f2c,$(FTESTS)): %: %.f2c.o libf2ctime.a
$(CC) -o $@ $< $(LIBTIME) $(LIBF2CSFFU) $(LIBF2C)
$(patsubst %.f,%,$(FTESTS)): %: %.o libtime.a
$(FC) -o $@ $< $(LIBTIME) $(LIBSFFU)
endif
tests/timer: %: %.o; $(CC) -o $@ $<
tests/ctlibtime: %: %.o; $(CC) -o $@ $< $(LIBCTIME)
......@@ -295,7 +332,7 @@ wwwdistrib: libtime.doc $(README)
wwwclean:
/bin/rm -rfv wwwpath/* wwwpath
WWWDOXYPATH=$(HOME)/public_html/txt/cxx/libtimexx
WWWDOXYPATH=$(WWWBASEDIR)/libtimexx
doc: ; /bin/mkdir -pv $(WWWDOXYPATH); /bin/ln -sfv $(WWWDOXYPATH) doc
doc/html/index.html: doc doxyfull.cfg $(ALLCODE); doxygen $(word 2,$^)
doxydoc doxyfull: doc/html/index.html
......@@ -326,6 +363,8 @@ package:
-d $(PACKAGE) thof/src/libs/tfmacros.h
cd $(TMPPATH)/..; cvs export -r HEAD \
-d $(PACKAGE) thof/src/README.compile
cd $(TMPPATH)/..; cvs export -r HEAD \
-d $(PACKAGE) thof/src/README.1st
/bin/bash -c 'cd $(TMPPATH); \
export LOCINCLUDEDIR=include; export LOCLIBDIR=binlib; \
export WWWBASEDIR=doxydoc; export LOCBINDIR=bin; \
......
c this is <time_util_fatal.f>
c------------------------------------------------------------------------------
c $Id: time_util_fatal.f,v 2.2 2006-03-28 16:23:08 tforb Exp $
c $Id: time_util_fatal.f,v 2.3 2007-12-05 15:49:26 tforb Exp $
c
c Copyright 2000 by Thomas Forbriger (IfG Stuttgart)
c
......@@ -25,6 +25,7 @@ c
c
c REVISIONS and CHANGES
c 05/08/2000 V1.0 Thomas Forbriger
c 05/12/2007 V1.1 migration to g77: index function works differently
c
cS
c==============================================================================
......@@ -36,11 +37,13 @@ c declare parameters
c
cE
c declare local variables
integer index
integer index, last, len
c
c------------------------------------------------------------------------------
c go
print 50,caller(1:index(caller,' ')-1),text
last=index(caller,' ')-1
if (last.lt.1) last=len(caller)
print 50,caller(1:last),text
call abort()
c
return
......
c this is <time_util_warning.f>
c------------------------------------------------------------------------------
c $Id: time_util_warning.f,v 2.2 2006-03-28 16:23:08 tforb Exp $
c $Id: time_util_warning.f,v 2.3 2007-12-05 15:49:26 tforb Exp $
c
c Copyright 2000 by Thomas Forbriger (IfG Stuttgart)
c
......@@ -25,6 +25,7 @@ c
c
c REVISIONS and CHANGES
c 05/08/2000 V1.0 Thomas Forbriger
c 05/12/2007 V1.1 migration to g77: index function works differently
c
cS
c==============================================================================
......@@ -36,11 +37,13 @@ c declare parameters
c
cE
c declare local variables
integer index
integer index, last, len
c
c------------------------------------------------------------------------------
c go
print 50,caller(1:index(caller,' ')-1),text
last=index(caller,' ')-1
if (last.lt.1) last=len(caller)
print 50,caller(1:last),text
c
return
50 format('WARNING (',a,'): ',a)
......@@ -57,11 +60,13 @@ c declare parameters
c
cE
c declare local variables
integer index
integer index, last, len
c
c------------------------------------------------------------------------------
c go
print 50,caller(1:index(caller,' ')-1),text,n
last=index(caller,' ')-1
if (last.lt.1) last=len(caller)
print 50,caller(1:last),text,n
c
return
50 format('WARNING (',a,'): ',a,I6)
......
......@@ -20,6 +20,8 @@ c along with this program; if not, write to the Free Software
c Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
c ----
c
c 05/12/2007 internal functions are tested after migration to g77 on
c fenoglio; SFF reading waits for migration of libsffu
c
program testlibtime
......@@ -29,7 +31,6 @@ c
character*40 date, time
character*200 line
character*132 wid2line
logical time_isleapyear
real sffu_seconds
real time_libversion
......@@ -45,12 +46,12 @@ c
print *,'libversion: ',time_libversion()
call head('time_isleapyear')
print *,'leap 2000 ',time_isleapyear(2000),' '
print *,'leap 1996 ',time_isleapyear(1996),' '
print *,'leap 1997 ',time_isleapyear(1997),' '
print *,'leap 92 ',time_isleapyear( 92),' '
print *,'leap 0 ',time_isleapyear( 0),' '
print *,'leap 1900 ',time_isleapyear(1900),' '
call testleap(2000)
call testleap(1996)
call testleap(1997)
call testleap(92)
call testleap(0)
call testleap(1900)
call head('time_fullyear')
year=0
......@@ -394,14 +395,26 @@ c----------------------------------------------------------------------
c----------------------------------------------------------------------
subroutine cmptest(date1, date2)
integer date1(7), date2(7)
character*40 string1, string2
integer time_compare
character*34 string1, string2
integer time_compare, val
call time_sprint(date1, string1)
call time_sprint(date2, string2)
print *,string1, ' ?? ',string2,' : ',
& time_compare(date1, date2)
print *,string2, ' ?? ',string1,' : ',
& time_compare(date2, date1)
val=time_compare(date1, date2)
if (val.gt.0) then
print *,string1, '> ',string2
else if (val.lt.0) then
print *,string1, '< ',string2
else
print *,string1, '= ',string2
endif
val=time_compare(date2, date1)
if (val.gt.0) then
print *,string2, '> ',string1
else if (val.lt.0) then
print *,string2, '< ',string1
else
print *,string2, '= ',string1
endif
return
end
c----------------------------------------------------------------------
......@@ -435,3 +448,16 @@ c----------------------------------------------------------------------
print *,'fitting: ',nfit,' to ',string3,' leads to ',stringf
return
end
c----------------------------------------------------------------------
subroutine testleap(year)
integer year
logical time_isleapyear
if (time_isleapyear(year)) then
else
print 50,year
endif
print 51,year
return
50 format('year ',i4,' is a leap year')
51 format('year ',i4,' is no leap year')
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment