#/****************************************************************************
# * Copyright by The HDF Group.                                               *
# * Copyright by the Board of Trustees of the University of Illinois.         *
# * All rights reserved.                                                      *
# *                                                                           *
# * This file is part of HDF Java Products. The full HDF Java copyright       *
# * notice, including terms governing use, modification, and redistribution,  *
# * is contained in the file, COPYING.  COPYING can be found at the root of   *
# * the source code distribution tree. You can also access it online  at      *
# * http://www.hdfgroup.org/products/licenses.html.  If you do not have       *
# * access to the file, you may request a copy from help@hdfgroup.org.        *
# ****************************************************************************/
 
TOP = ..
DIR	= examples
SUBDIRS = intro groups datasets datatypes

JAVAC           = @JAVAC@
JAVADOC         = @JAVADOC@
JAR         	= @JAR@
FIND            = @FIND@
RM              = @RM@
SLEXT=@SLEXT@
JSLEXT=@JSLEXT@

CLASSPATH=@CLASSPATH@
JH45INSTALLDIR=@JH45INST@
H45INC=@H45INC@
H4INC=@HDF4INC@
H5INC=@HDF5INC@

include $(TOP)/Config/Rules.mk

check:
	(cd groups; $(MAKE) check;)
	chmod u+x runExample.sh
	$(RM) $(TOP)/lib/$(DIR)/*.h5;
	$(RM) $(TOP)/lib/$(DIR)/h5ex_d_extern.data;
	$(RM) $(TOP)/lib/$(DIR)/*.out;
	$(MAKE) run-intro;
	$(MAKE) run-groups;
	$(MAKE) run-datasets;
	$(MAKE) run-datatypes;
	$(RM) $(TOP)/lib/$(DIR)/*.h5;
	$(RM) $(TOP)/lib/$(DIR)/h5ex_d_extern.data;
	$(RM) $(TOP)/lib/$(DIR)/*.out;

run-intro:
	@if ./runExample.sh examples.intro.H5_CreateDataset; then \
		echo "  PASSED      intro.H5_CreateDataset"; else  \
		echo "**FAILED**    intro.H5_CreateDataset"; fi;
	@if ./runExample.sh examples.intro.H5_CreateAttribute; then \
		echo "  PASSED      intro.H5_CreateAttribute"; else  \
		echo "**FAILED**    intro.H5_CreateAttribute"; fi;
	@if ./runExample.sh examples.intro.H5_CreateFile; then \
		echo "  PASSED      intro.H5_CreateFile"; else  \
		echo "**FAILED**    intro.H5_CreateFile"; fi;
	@if ./runExample.sh examples.intro.H5_CreateGroup; then \
		echo "  PASSED      intro.H5_CreateGroup"; else  \
		echo "**FAILED**    intro.H5_CreateGroup"; fi;
	@if ./runExample.sh examples.intro.H5_CreateGroupAbsoluteRelative; then \
		echo "  PASSED      intro.H5_CreateGroupAbsoluteRelative"; else  \
		echo "**FAILED**    intro.H5_CreateGroupAbsoluteRelative"; fi;
	@if ./runExample.sh examples.intro.H5_CreateGroupDataset; then \
		echo "  PASSED      intro.H5_CreateGroupDataset"; else  \
		echo "**FAILED**    intro.H5_CreateGroupDataset"; fi;
	@if ./runExample.sh examples.intro.H5_ReadWrite; then \
		echo "  PASSED      intro.H5_ReadWrite"; else  \
		echo "**FAILED**    intro.H5_ReadWrite"; fi;

run-groups:
	@if ./runExample.sh examples.groups.H5Ex_G_Create; then \
		echo "  PASSED      groups.H5Ex_G_Create"; else  \
		echo "**FAILED**    groups.H5Ex_G_Create"; fi;
	cp groups/h5ex_g_iterate.h5 h5ex_g_iterate.h5; 
	@if ./runExample.sh examples.groups.H5Ex_G_Iterate; then \
		echo "  PASSED      groups.H5Ex_G_Iterate"; else  \
		echo "**FAILED**    groups.H5Ex_G_Iterate"; fi;
	@if ./runExample.sh examples.groups.H5Ex_G_Compact; then \
		echo "  PASSED      groups.H5Ex_G_Compact"; else  \
		echo "**FAILED**    groups.H5Ex_G_Compact"; fi;	
	@if ./runExample.sh examples.groups.H5Ex_G_Corder; then \
		echo "  PASSED      groups.H5Ex_G_Corder"; else  \
		echo "**FAILED**    groups.H5Ex_G_Corder"; fi;
	@if ./runExample.sh examples.groups.H5Ex_G_Intermediate; then \
		echo "  PASSED      groups.H5Ex_G_Intermediate"; else  \
		echo "**FAILED**    groups.H5Ex_G_Intermediate"; fi;	
	@if ./runExample.sh examples.groups.H5Ex_G_Phase; then \
		echo "  PASSED      groups.H5Ex_G_Phase"; else  \
		echo "**FAILED**    groups.H5Ex_G_Phase"; fi;	
	@if ./runExample.sh examples.groups.H5Ex_G_Visit; then \
		echo "  PASSED      groups.H5Ex_G_Visit"; else  \
		echo "**FAILED**    groups.H5Ex_G_Visit"; fi;	

			

run-datasets:
	@if ./runExample.sh examples.datasets.H5Ex_D_Alloc; then \
		echo "  PASSED      datasets.H5Ex_D_Alloc"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Alloc"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Checksum; then \
		echo "  PASSED      datasets.H5Ex_D_Checksum"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Checksum"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Chunk; then \
		echo "  PASSED      datasets.H5Ex_D_Chunk"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Chunk"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Compact; then \
		echo "  PASSED      datasets.H5Ex_D_Compact"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Compact"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_External; then \
		echo "  PASSED      datasets.H5Ex_D_External"; else  \
		echo "**FAILED**    datasets.H5Ex_D_External"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_FillValue; then \
		echo "  PASSED      datasets.H5Ex_D_FillValue"; else  \
		echo "**FAILED**    datasets.H5Ex_D_FillValue"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Gzip; then \
		echo "  PASSED      datasets.H5Ex_D_Gzip"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Gzip"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Hyperslab; then \
		echo "  PASSED      datasets.H5Ex_D_Hyperslab"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Hyperslab"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_ReadWrite; then \
		echo "  PASSED      datasets.H5Ex_D_ReadWrite"; else  \
		echo "**FAILED**    datasets.H5Ex_D_ReadWrite"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Shuffle; then \
		echo "  PASSED      datasets.H5Ex_D_Shuffle"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Shuffle"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Szip; then \
		echo "  PASSED      datasets.H5Ex_D_Szip"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Szip"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_UnlimitedAdd; then \
		echo "  PASSED      datasets.H5Ex_D_UnlimitedAdd"; else  \
		echo "**FAILED**    datasets.H5Ex_D_UnlimitedAdd"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_UnlimitedGzip; then \
		echo "  PASSED      datasets.H5Ex_D_UnlimitedGzip"; else  \
		echo "**FAILED**    datasets.H5Ex_D_UnlimitedGzip"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_UnlimitedMod; then \
		echo "  PASSED      datasets.H5Ex_D_UnlimitedMod"; else  \
		echo "**FAILED**    datasets.H5Ex_D_UnlimitedMod"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Nbit; then \
		echo "  PASSED      datasets.H5Ex_D_Nbit"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Nbit"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Transform; then \
		echo "  PASSED      datasets.H5Ex_D_Transform"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Transform"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Sofloat; then \
		echo "  PASSED      datasets.H5Ex_D_Sofloat"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Sofloat"; fi;
	@if ./runExample.sh examples.datasets.H5Ex_D_Soint; then \
		echo "  PASSED      datasets.H5Ex_D_Soint"; else  \
		echo "**FAILED**    datasets.H5Ex_D_Soint"; fi;


run-datatypes:
	@if ./runExample.sh examples.datatypes.H5Ex_T_Array; then \
		echo "  PASSED      datatypes.H5Ex_T_Array"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_Array"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_ArrayAttribute; then \
		echo "  PASSED      datatypes.H5Ex_T_ArrayAttribute"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_ArrayAttribute"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_Bit; then \
		echo "  PASSED      datatypes.H5Ex_T_Bit"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_Bit"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_BitAttribute; then \
		echo "  PASSED      datatypes.H5Ex_T_BitAttribute"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_BitAttribute"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_Commit; then \
		echo "  PASSED      datatypes.H5Ex_T_Commit"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_Commit"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_Compound; then \
		echo "  PASSED      datatypes.H5Ex_T_Compound"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_Compound"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_CompoundAttribute; then \
		echo "  PASSED      datatypes.H5Ex_T_CompoundAttribute"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_CompoundAttribute"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_Float; then \
		echo "  PASSED      datatypes.H5Ex_T_Float"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_Float"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_FloatAttribute; then \
		echo "  PASSED      datatypes.H5Ex_T_FloatAttribute"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_FloatAttribute"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_Integer; then \
		echo "  PASSED      datatypes.H5Ex_T_Integer"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_Integer"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_IntegerAttribute; then \
		echo "  PASSED      datatypes.H5Ex_T_IntegerAttribute"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_IntegerAttribute"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_ObjectReference; then \
		echo "  PASSED      datatypes.H5Ex_T_ObjectReference"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_ObjectReference"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_ObjectReferenceAttribute; then \
		echo "  PASSED      datatypes.H5Ex_T_ObjectReferenceAttribute"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_ObjectReferenceAttribute"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_Opaque; then \
		echo "  PASSED      datatypes.H5Ex_T_Opaque"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_Opaque"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_OpaqueAttribute; then \
		echo "  PASSED      datatypes.H5Ex_T_OpaqueAttribute"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_OpaqueAttribute"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_String; then \
		echo "  PASSED      datatypes.H5Ex_T_String"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_String"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_StringAttribute; then \
		echo "  PASSED      datatypes.H5Ex_T_StringAttribute"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_StringAttribute"; fi;
	@if ./runExample.sh examples.datatypes.H5Ex_T_VLString; then \
		echo "  PASSED      datatypes.H5Ex_T_VLString"; else  \
		echo "**FAILED**    datatypes.H5Ex_T_VLString"; fi;
