##
## HDF5-C++ Library Makefile(.in)
##
##
## Copyright by the Board of Trustees of the University of Illinois.
## All rights reserved.
##
## This file is part of HDF5.  The full HDF5 copyright notice, including
## terms governing use, modification, and redistribution, is contained in
## the files COPYING and Copyright.html.  COPYING can be found at the root
## of the source code distribution tree; Copyright.html can be found at the
## root level of an installed copy of the electronic HDF5 document set and
## is linked from the top-level documents page.  It can also be found at
## http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html.  If you do not have
## access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu.
##
##
##
top_srcdir=../..
top_builddir=../..
srcdir=.

##------------------------------------------------------------ -*- makefile -*-
## The following section of this makefile comes from the
## `./config/commence' file which was generated with config.status
## from `./config/commence.in'.
##-----------------------------------------------------------------------------

## Things that Make needs
.SUFFIXES:
.SUFFIXES: .cpp .o .lo


## Directories to search
## SEARCH DISABLED: $(srcdir) $(top_builddir)/src $(top_srcdir)/src

## Programs
SHELL=/bin/sh
CXX=g++
CXXFLAGS= -O2 
CFLAGS= -O2
CPPFLAGS=-D_BSD_SOURCE -D_POSIX_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE  
LDFLAGS=
ROOT=/raid0/cosmo/extcomponents/hdf5-1.6.2/c++
LIBS=-lz -lm 
AR=ar
RANLIB=ranlib
PERL=perl
RM=rm -f
CP=cp
INSTALL=/usr/bin/install -c
INSTALL_PROGRAM=${INSTALL}
INSTALL_DATA=${INSTALL} -m 644
TRACE=:

## Installation points
prefix=/usr/local
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib
includedir=${prefix}/include
docdir=${prefix}/doc
PUB_LIB=$(LIB)

## Obtain default library; the current version of libtool does not fully
## support C++ yet, and it does not know which default library to find.
## With libtool 1.5, this support can be removed.  - BMR - Jan, 2002 
DEFAULT_LIBS=

## Shared libraries
LT_STATIC_EXEC=
DYNAMIC_DIRS=
LT=$(top_builddir)/libtool
LT_COMPILE=$(LT) --mode=compile $(CXX)
LT_LINK_LIB=$(LT) --mode=link $(CXX) -static -rpath $(libdir) $(DYNAMIC_DIRS)
LT_LINK_EXE=$(LT) --mode=link $(CXX) -static $(LT_STATIC_EXEC) -dlopen self -rpath $(bindir) $(DYNAMIC_DIRS)
LT_RUN=$(LT) --mode=execute
LT_INSTALL_PROG=$(LT) --mode=install $(INSTALL_PROGRAM)
LT_INSTALL_LIB=$(LT) --mode=install $(INSTALL_DATA)
LT_UNINSTALL=$(LT) --mode=uninstall $(RM)

## Optional variables. We must declare them here because Irix pmake
## complains if it sees a reference to a variable which has never been
## defined. The main makefile is free to redefine these to something else.
DOCDIR=$(docdir)
EXAMPLEDIR=$(docdir)/hdf5/examples/c++
LIB=
LIB_SRC=
LIB_OBJ=
PUB_HDR=
PUB_PROGS=
PUB_DOCS=
PROGS=
TEST_PROGS=
TEST_FLAGS=
TEST_SCRIPTS=
AUX_LIB=
EXAMPLE_PROGS=
SUBDIRS=
LIBHDF5=

## The default is to build the library and/or programs.  We must build
## them sequentially.
all:
	$(MAKE) lib
	$(MAKE) progs
	$(MAKE) tests

## The following rules insure that the Makefile is up-to-date by rerunning
## various autoconf components (although not all versions of make assume
## that the makefile is implicitly a target).  We use time stamp files to
## keep track of the most recent update of H5config.h.in and H5config.h
## because autoheader and config.status don't update the modification time
## if the contents don't change.
## Invoke it by "gmake reconfigure".
##
## Graphically, the dependencies are:
##
##		         configure.in
##                           |  |
##         +-----------------+  +------------+
##         |                                 |
##      stamp1                           configure
##   (H5config.h.in)                         |
##       |  |                                |
##       |  +---------------+    +-----------+
##       |                  |    |
##       |               config.status
##       |                     |
##       |  +------------------+
##       |  |
##      stamp2
##    (H5config.h)                   Makefile.in et al
##         |                                 |
##         +------------------+  +-----------+
##                            |  |
##                          Makefile
##
## A side effect of updating stamp1 is to generate H5config.h.in and a
## side effect of updating stamp2 is to generate H5config.h.  When using
## a version of make that doesn't treat the makefile as the initial target
## the user may want to occassionally type `make Makefile' in any source
## directory.
## The `Makefile' target has been renamed to `reconfigure' so that the
## autoconf and make depend processes do not start up automatically.
## One must do `make reconfigure' explicitedly to start the process.
## (When srcdir is used and if more than one machines are running,
## this automatic Makefile/autoconf can get things unstable.)
##
STAMP1=$(top_builddir)/config/stamp1
STAMP2=$(top_builddir)/config/stamp2

MAKEFILE_PARTS=$(srcdir)/Makefile.in		\
	       $(top_srcdir)/config/commence.in	\
	       $(top_srcdir)/config/conclude.in	\
	       $(top_srcdir)/config/depend1.in	\
	       $(top_srcdir)/config/depend2.in	\
	       $(top_srcdir)/config/depend3.in	\
	       $(top_srcdir)/config/depend4.in	\
	       $(top_srcdir)/config/dependN.in

$(STAMP1): $(top_srcdir)/configure.in
	touch $(STAMP1)
	-cd $(top_srcdir); autoheader

$(STAMP2): $(STAMP1) $(top_builddir)/config.status
	touch $(STAMP2)
	-cd $(top_builddir); \
	   CONFIG_FILES= CONFIG_HEADERS=src/H5config.h ./config.status

$(top_srcdir)/configure: $(top_srcdir)/configure.in
	-cd $(top_srcdir); autoconf

$(top_builddir)/config.status: $(top_srcdir)/configure $(STAMP1)
	-cd $(top_builddir); ./config.status --recheck

# rerun the autoconf process if any configure components have changed. 
reconfigure: $(MAKEFILE_PARTS) $(STAMP2)
	-cd $(top_builddir); CONFIG_HEADERS= ./config.status

##-----------------------------------------------------------------------------
## The following section of this makefile comes from the middle of
## `Makefile.in' from this directory.  It was generated by running
## `config.status'.
##-----------------------------------------------------------------------------

hdf5_srcdir=$(top_srcdir)/src
hdf5_builddir=$(top_builddir)/src

TRACE=perl $(top_srcdir)/bin/trace

## Add `-I.' to the C preprocessor flags.
CPPFLAGS=-I. -I$(hdf5_builddir) -I$(hdf5_srcdir) -D_BSD_SOURCE -D_POSIX_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE  

## This is our main target
LIB=libhdf5_cpp.la

## Source and object files for the library
LIB_SRC=H5Exception.cpp H5RefCounter.cpp H5IdComponent.cpp H5Library.cpp        \
        H5Attribute.cpp H5Object.cpp H5PropList.cpp H5FaccProp.cpp	        \
        H5FcreatProp.cpp H5DcreatProp.cpp H5DxferProp.cpp H5DataType.cpp        \
        H5DataSpace.cpp H5AbstractDs.cpp H5AtomType.cpp H5PredType.cpp	        \
        H5EnumType.cpp H5IntType.cpp H5FloatType.cpp H5StrType.cpp	        \
        H5CompType.cpp H5DataSet.cpp H5CommonFG.cpp H5Group.cpp H5File.cpp
LIB_OBJ=$(LIB_SRC:.cpp=.lo)

PUB_HDR=H5Cpp.h H5AbstractDs.h H5AtomType.h H5Attribute.h H5Classes.h           \
        H5CommonFG.h H5CompType.h H5DataSet.h H5DataSpace.h H5DataType.h        \
        H5DcreatProp.h H5DxferProp.h H5EnumType.h H5Exception.h H5FaccProp.h    \
        H5FcreatProp.h H5File.h H5FloatType.h H5Group.h H5IdComponent.h         \
        H5Include.h H5IntType.h H5Library.h H5Object.h H5PredType.h             \
        H5PropList.h H5RefCounter.h H5StrType.h
PUB_PROGS=h5c++

ARFLAGS=rs

## h5c++ is generated during configure time.  Remove it only when distclean.
DISTCLEAN=h5c++


##------------------------------------------------------------ -*- makefile -*-
## The following section of this makefile comes from the
## `./config/conclude' file which was generated with config.status
## from `./config/conclude.in'.
##-----------------------------------------------------------------------------

## This is the target for the library described in the main body of the
## makefile.
##
lib: $(LIB)
$(LIB) __no_library__: $(LIB_OBJ)
	@$(LT_LINK_LIB) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)

progs: $(LIB) $(PROGS)

## Build a tags file in this directory.
TAGS: $(LIB_SRC)
	$(RM) $@
	-etags $(LIB_SRC)

## Runs each test in order, passing $(TEST_FLAGS) to the program.
## Since tests are done in a shell loop, "make -i" does apply inside it.
## Set HDF5_Make_Ignore to a non-blank string to ignore errors inside the loop.
tests: $(TEST_PROGS) $(LIB)
check test _test: tests
	@for test in $(TEST_PROGS) dummy; do                                  \
	   if test $$test != dummy; then				      \
	      echo "";							      \
	      echo "=====================================";		      \
	      echo "C++ API: Testing $$test $(TEST_FLAGS)";		      \
	      echo "=====================================";		      \
	      echo "";							      \
	      srcdir="$(srcdir)"					      \
		 ./$$test $(TEST_FLAGS) ||                                    \
		 (test $$HDF5_Make_Ignore && echo "*** Error ignored") ||     \
		 break;							      \
	   fi;								      \
	done;								      \
	test $$test = dummy || false
	@for test in $(TEST_SCRIPTS) dummy; do                                \
	   if test $$test != dummy; then				      \
	      echo "";							      \
	      echo "=====================================";		      \
	      echo "C++ API: Testing $$test $(TEST_FLAGS)";		      \
	      echo "=====================================";		      \
	      echo "";							      \
	      srcdir="$(srcdir)"					      \
		 /bin/sh $$test $(TEST_FLAGS) ||		              \
		 (test $$HDF5_Make_Ignore && echo "*** Error ignored") ||     \
		 break;							      \
	   fi;								      \
	done;								      \
	test $$test = dummy || false

## Make installation directories directories if they don't exist.
$(libdir):
	$(top_srcdir)/bin/mkdirs $@

$(includedir):
	$(top_srcdir)/bin/mkdirs $@

$(bindir):
	$(top_srcdir)/bin/mkdirs $@

$(EXAMPLEDIR):
	$(top_srcdir)/bin/mkdirs $@

## Install the library, the public header files, and public programs.
install: $(PUB_LIB) $(PUB_HDR) $(PUB_PROGS) $(libdir) $(includedir) $(bindir)
	@for f in X $(PUB_LIB); do					      \
	   if test $$f != X; then					      \
	      ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1);		      \
	   fi;								      \
	done
	@if test -f libhdf5.settings; then				      \
	   (set -x; $(INSTALL_DATA) libhdf5.settings $(libdir)/. || exit 1);  \
	fi
	@for f in X $(PUB_HDR); do					      \
	   if test $$f != X; then					      \
	      if test -f $$f; then					      \
		 (set -x; $(INSTALL_DATA) $$f $(includedir)/. || exit 1);     \
	      else							      \
	         (set -x; $(INSTALL_DATA) $(srcdir)/$$f $(includedir)/. ||    \
		    exit 1);						      \
	      fi;							      \
	   fi;								      \
	done
	@for f in X $(PUB_PROGS); do					      \
	   if test $$f != X; then					      \
	     ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1);		      \
	   fi;							              \
	done

install-examples: $(EXAMPLE_PROGS) $(EXAMPLEDIR)
	@for f in X $(EXAMPLE_PROGS); do				      \
	  if test $$f != X; then					      \
	    (set -x; $(INSTALL_DATA) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);\
	  fi;								      \
	done

uninstall-examples:
	@if test -n "$(EXAMPLE_PROGS)"; then 				      \
	  set -x; cd $(EXAMPLEDIR) && $(RM) $(EXAMPLE_PROGS);		      \
	fi

## Removes those things that `make install' (would have) installed.
uninstall:
	@for f in libhdf5.settings $(LIB); do				      \
            $(LT_UNINSTALL) $(libdir)/$$f;				      \
	done
	@if test -n "$(PUB_HDR)"; then   				      \
	   set -x; cd $(includedir) && $(RM) $(PUB_HDR);		      \
	fi
	@for f in X $(PUB_PROGS); do					      \
	    if test $$f != X; then					      \
	        $(LT_UNINSTALL) $(bindir)/$$f;				      \
	    fi;								      \
	done

## Removes temporary files without removing the final target files.  That is,
## remove things like object files but not libraries or executables.
##
mostlyclean:
	@if test -n "$(LIB_OBJ)"; then                                        \
	    $(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o);                               \
	fi
	@if test -n "$(TEST_OBJ)"; then                                       \
	    $(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o);                             \
	fi
	@if test -n "$(PROG_OBJ)" -o -n "$(MOSTLYCLEAN)"; then                \
	    $(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN);              \
	fi

## Like `mostlyclean' except it also removes the final targets: things like
## libraries and executables.  This target doesn't remove any file that
## is part of the HDF5 distribution.
##
clean: mostlyclean
	@if test -n "$(LIB)" -o -n "$(TEST_PROGS)" -o -n "$(PROGS)" -o -n "$(CLEAN)"; then \
	    $(RM) $(LIB) $(TEST_PROGS) $(PROGS) $(CLEAN);                     \
	fi
	-$(RM) -r .libs

## Like `clean' except it also removes files that were created by running
## configure.  If you've unpacked the source and built HDF5 without creating
## any other files, then `make distclean' will leave only the files that were
## in the distribution.
##
distclean: clean
	-$(RM) .depend TAGS *~ core *.core *.bak *.old *.new $(DISTCLEAN)
	@if test -f $(srcdir)/Makefile.in; then				      \
	   (set -x; $(RM) Makefile);					      \
	fi

## Like `distclean' except it deletes all files that can be regenerated from
## the makefile, including those generated from autoheader and autoconf.
##
maintainer-clean: distclean
	-$(RM) *~ core core.* *.core *.bak *.contrib gmon.out

## Implicit rules
.cpp.o:
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<

.cpp.lo:
	@$(LT_COMPILE) $(CXXFLAGS) $(CPPFLAGS) -c $<

##-----------------------------------------------------------------------------
## The following section of this makefile contains dependencies between the
## source files and the header files.
##-----------------------------------------------------------------------------
.PHONY: dep depend
dep depend: $(srcdir)/Dependencies


##                                                             -*- makefile -*-

## We keep a list of dependencies in `.depend' for each of the source
## files on which it depends.  When one of the source files is modified
## we remove its record from .depend and regenerate its dependencies,
## tacking them onto the end of .depend.  By including the .depend file
## into the makefile, we're telling make that the makefile depends on
## the dependency list in the .depend file.
##
## This is as fast as the `.d' method described in the GNU make manual
## for automatic dependencies, but has the added advantage that all
## dependencies are stored in one place.  The advantage over the
## `makedepend' program is that only those files that are out of date
## have dependency information rebuilt, and the Makefile is not
## modified.
##
## This is also where tracing information is updated.  The $(TRACE)
## program is run on each source file to make sure that the H5TRACE()
## macros are up to date.  If they are then the file is not modified,
## otherwise the file is changed and a backup is saved by appending a
## tilde to the file name.
##
$(srcdir)/Dependencies: .depend
	@if test "$(srcdir)" != "."; then                                     \
      echo '## This file is machine generated on GNU systems.' >$@;       \
      echo '## Only temporary changes may be made here.' >>$@;            \
      echo >>$@;                                                          \
      $(PERL) -p $(top_srcdir)/bin/distdep .depend >>$@;                  \
    else                                                                  \
      echo 'Dependencies cannot be built when $$srcdir == $$builddir';    \
    fi

.depend: $(LIB_SRC) $(TEST_SRC) $(PROG_SRC)
	@touch .depend
	@for dep in $? dummy; do                                              \
      if test $$dep != "dummy" -a -n "$(PERL)"; then                      \
        case "$$dep" in                                                   \
          *.c)                                                            \
            echo Building dependencies for $$dep;                         \
            obj=`basename $$dep .c`.lo;                                   \
            sed '\%^'"$$obj"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@;       \
            $(TRACE) $$dep;                                               \
            $(CC) -MM -MG $(CPPFLAGS) $$dep 2>/dev/null >>$@;             \
            $(PERL) -w $(top_srcdir)/bin/dependencies --srcdir=$(srcdir) --top_srcdir=$(top_srcdir) --top_builddir=$(top_builddir) $@; \
            ;;                                                            \
        esac;                                                             \
      fi;                                                                 \
    done

-include .depend

