#---------------------------------------------------------------------
#     Copyright (C) GFD Dennou Club, 2005. All rights reserved.
#---------------------------------------------------------------------
#= Makefile for gt4f90io/test
#
#   * Developers: Eizi TOYODA (toyoda), Yasuhiro MORIKAWA (morikawa)
#   * Version: $Id: Makefile,v 1.14 2005/06/21 17:21:54 morikawa Exp $
#   * Tag Name: $Name: gt4f90io-20050622 $
#   * Change History: 
#

include ../Config.mk

INCLUDE_GT=-I../src     # Intel Fortran, Fujitsu Fortran
#INCLUDE_GT=-M../src     # SunStudio, Fujitsu Fortran
LIBGT4=../src/lib$(LIBNAME).a

TARGETS=histtest histaxis histget histcopy

all: $(TARGETS)

histtest: work.pcl histtest.o $(LIBGT4)
	$(FC) $(SYSFFLAGS) -o histtest histtest.o $(LIBGT4) $(LIBS) \
		$(SYSLDFLAGS) $(SYSLDLIBS)

histaxis: work.pcl histaxis.o $(LIBGT4)
	$(FC) $(SYSFFLAGS) -o histaxis histaxis.o $(LIBGT4) $(LIBS) \
		$(SYSLDFLAGS) $(SYSLDLIBS)

histget: work.pcl histget.o $(LIBGT4)
	$(FC) $(SYSFFLAGS) -o histget histget.o $(LIBGT4) $(LIBS) \
		$(SYSLDFLAGS) $(SYSLDLIBS)

histcopy: work.pcl histcopy.o $(LIBGT4)
	$(FC) $(SYSFFLAGS) -o histcopy histcopy.o $(LIBGT4) $(LIBS) \
		$(SYSLDFLAGS) $(SYSLDLIBS)

histtest.o: ../src/gt4_history.o
histaxis.o: ../src/gt4_history.o
histget.o: ../src/gt4_history.o
histcopy.o: ../src/gt4_history.o

work.pcl: Makefile ../Config.mk
	sh ../chkpcl.sh $(SYSFFLAGS) $(INCLUDE_GT)

$(LIBGT4):
	cd ../src; $(MAKE)

clear:
	-rm -f *.ps *.log *.nc

clean: clear
	-rm -f *.o $(MODS) $(TARGETS) xdifs.log work.pc* \
		xhisttest/xhisttest?.nc xhisttest/xhisttest*.cdl \
		xhistaxis/xhistaxis?.nc \
		xhistget/xhistget?.nc xhistget/xhistgetdif?.cdl \
		xhistcopy/xhistcopy?.nc xhistcopy/xhistcopy*.cdl

test: all
	sh histtest.sh
	sh histaxis.sh
	sh histget.sh
	sh histcopy.sh

test-f: all
	-sh histtest.sh
	-sh histaxis.sh
	-sh histget.sh
	-sh histcopy.sh

test-SX6-patch::
	cd .. ; patch -p0 <test/$@