#---------------------------------------------------------------------
#     Copyright (C) GFD Dennou Club, 2005. All rights reserved.
#---------------------------------------------------------------------
#= Makefile for gt4f90io/test
#
# Authors::   Eizi TOYODA (toyoda), Yasuhiro MORIKAWA (morikawa)
# Version::   $Id: Makefile,v 1.7 2006/01/17 05:52:49 morikawa Exp $
# Tag Name::  $Name: gt4f90io-20060121 $
# Copyright:: Copyright (C) GFD Dennou Club, 2004-2005. All rights reserved.
# License::   See COPYRIGHT[link:../../COPYRIGHT]
#
######################################################################
#
#== Settings

INCLUDEFILE = ../Config.mk
include $(INCLUDEFILE)

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 histauto histinquire \
	dcstr dcurl

CLEANED=*.o $(MODS) $(TARGETS) xdifs.log work.pc* *.nc \
	xhisttest/xhisttest?.nc xhisttest/xhisttest*.cdl \
	xhistaxis/xhistaxis?.nc xhistaxis/xhistaxis*.cdl \
	xhistget/xhistget?.nc xhistget/xhistgetdif?.cdl \
	xhistcopy/xhistcopy?.nc xhistcopy/xhistcopy*.cdl

# End Settings
######################################################################

######################################################################
#== Set various types of files

EXECS		= $(TARGETS:%=%.exe)
OBJS		= $(TARGETS:%=%.o)

######################################################################
#== Rules
#

%: %.sh   # clear an implicit rule

all: $(LIBGT4) $(TARGETS)

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

$(LIBGT4):
	$(MAKE) -C ../src

clean:
	@if [ ! X"$(wildcard $(CLEANED))" = X"" ]; then \
		echo $(RM) $(wildcard $(CLEANED)) ;\
		$(RM) $(wildcard $(CLEANED)) ;\
	fi

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

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

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