diff options
author | James Laird <jlaird@hdfgroup.org> | 2005-12-09 20:59:11 (GMT) |
---|---|---|
committer | James Laird <jlaird@hdfgroup.org> | 2005-12-09 20:59:11 (GMT) |
commit | b1fd3f565750a18246239cdac50e433d6d668524 (patch) | |
tree | f09179e1fb2a04e01983c85f9a3873c159fefda7 /examples | |
parent | 9124030f911f002bd49ec8bccd4c051df410cc72 (diff) | |
download | hdf5-b1fd3f565750a18246239cdac50e433d6d668524.zip hdf5-b1fd3f565750a18246239cdac50e433d6d668524.tar.gz hdf5-b1fd3f565750a18246239cdac50e433d6d668524.tar.bz2 |
[svn-r11780] Purpose:
Added high-level example directories
Description:
Refactored common code out of examples Makefiles.am, added high-level
example directories, added packet table examples.
Solution:
Examples now draw from a common config/examples.am file, which
contains rules for installing, uninstalling, and cleaning examples.
High-level example directories are mostly empty, except for the
C and C++ packet table tests.
Platforms tested:
mir, sleipnir, copper, shanti
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 47 | ||||
-rw-r--r-- | examples/Makefile.in | 83 |
2 files changed, 44 insertions, 86 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am index 6143c6e..e6991d9 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -27,28 +27,16 @@ endif # Example programs. # Don't tell automake about them, because if it knew they were programs, # it would try to compile them instead of using the h5cc script. -# This creates some extra work for us. -# -# It might be possible to use automake's COMPILE variable to have it -# use h5cc properly (and h5fc and h5c++). +# Use the boilerplate in config/examples.am instead. TEST_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers -# Tell conclude.in boilerplate when to build the examples -EXAMPLE_PROG = $(TEST_PROG_PARA) $(TEST_PROG) -EXTRA_PROG = $(EXAMPLE_PROG) - # Install files # List all file that should be installed in examples directory INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ h5_compound.c h5_group.c h5_select.c h5_attribute.c h5_mount.c \ h5_reference.c h5_drivers.c ph5example.c -# We need to tell automake what to clean -MOSTLYCLEANFILES=*.raw *.meta *.o -CHECK_CLEANFILES+=*.h5 -CLEANFILES=$(TEST_PROG) $(TEST_PROG_PARA) - # Additional dependencies for each program are listed below. $(EXTRA_PROG): $(LIBHDF5) if BUILD_PARALLEL_CONDITIONAL @@ -61,39 +49,9 @@ endif h5_read.chkexe_: h5_write.chkexe_ h5_chunk_read.chkexe_: h5_extend_write.chkexe_ -# How to install examples -# There are a lot of rules because automake does not know about -# the examples programs, and does not recognize the install-examples -# target. +# Example directory EXAMPLEDIR=$(docdir)/hdf5/examples/c -$(EXAMPLEDIR): - -$(top_srcdir)/bin/mkdirs $@ - -install-data-local: - @$(MAKE) $(AM_MAKEFLAGS) install-examples -uninstall-local: - @$(MAKE) $(AM_MAKEFLAGS) uninstall-examples - -# We want to install the source files, not the examples themselves. Add '.c' to -# each example to get its source. This is a bit kludgy. -install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) - @for f in X $(INSTALL_FILES); do \ - if test $$f != X; then \ - (set -x; $(INSTALL) $(top_srcdir)/examples/$$f $(EXAMPLEDIR)/. || exit 1);\ - fi; \ - done - -uninstall-examples: - @if test -n "$(INSTALL_FILES)" -a -d $(EXAMPLEDIR); then \ - set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_FILES); \ - fi - -check-install: - @$(MAKE) $(AM_MAKEFLAGS) installcheck -installcheck-local: - @$(MAKE) $(AM_MAKEFLAGS) check - # List dependencies for each program. Normally, automake would take # care of this for us, but if we tell automake about the programs it # will try to build them with the normal C compiler, not h5cc. This is @@ -114,4 +72,5 @@ h5_drivers: $(srcdir)/h5_drivers.c ph5example: $(srcdir)/ph5example.c h5_dtransform: $(srcdir)/h5_dtransform.c +include $(top_srcdir)/config/examples.am include $(top_srcdir)/config/conclude.am diff --git a/examples/Makefile.in b/examples/Makefile.in index 084ac5c..91b3bec 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -29,6 +29,10 @@ # # HDF5 Library Examples Makefile(.in) # + +# We can't tell automake about example programs, because they need to be +# built using h5cc (or h5fc, etc.) instead of the standard compilers. +# This creates some extra work for us. srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ @@ -53,7 +57,8 @@ build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/config/commence.am \ - $(top_srcdir)/config/conclude.am + $(top_srcdir)/config/conclude.am \ + $(top_srcdir)/config/examples.am subdir = examples ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.in @@ -307,18 +312,11 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.h5 # Example programs. # Don't tell automake about them, because if it knew they were programs, # it would try to compile them instead of using the h5cc script. -# This creates some extra work for us. -# -# It might be possible to use automake's COMPILE variable to have it -# use h5cc properly (and h5fc and h5c++). +# Use the boilerplate in config/examples.am instead. TEST_PROG = h5_write h5_read h5_extend_write h5_chunk_read h5_compound \ h5_group h5_select h5_attribute h5_mount h5_reference h5_drivers -# Tell conclude.in boilerplate when to build the examples -EXAMPLE_PROG = $(TEST_PROG_PARA) $(TEST_PROG) -EXTRA_PROG = $(EXAMPLE_PROG) - # Install files # List all file that should be installed in examples directory INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ @@ -326,16 +324,18 @@ INSTALL_FILES = h5_write.c h5_read.c h5_extend_write.c h5_chunk_read.c \ h5_reference.c h5_drivers.c ph5example.c +# Example directory +EXAMPLEDIR = $(docdir)/hdf5/examples/c + +# Assume that all tests in this directory are examples, and tell +# conclude.am when to build them. +EXAMPLE_PROG = $(TEST_PROG_PARA) $(TEST_PROG) +EXTRA_PROG = $(EXAMPLE_PROG) + # We need to tell automake what to clean MOSTLYCLEANFILES = *.raw *.meta *.o CLEANFILES = $(TEST_PROG) $(TEST_PROG_PARA) -# How to install examples -# There are a lot of rules because automake does not know about -# the examples programs, and does not recognize the install-examples -# target. -EXAMPLEDIR = $(docdir)/hdf5/examples/c - # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., # lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and @@ -355,7 +355,7 @@ TEST_SCRIPT_PARA_CHKSH = $(TEST_SCRIPT_PARA:=.chkexe_) all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/examples.am $(top_srcdir)/config/conclude.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -543,53 +543,52 @@ $(EXTRA_PROG): $(LIBHDF5) h5_read.chkexe_: h5_write.chkexe_ h5_chunk_read.chkexe_: h5_extend_write.chkexe_ +# List dependencies for each program. Normally, automake would take +# care of this for us, but if we tell automake about the programs it +# will try to build them with the normal C compiler, not h5cc. This is +# an inelegant way of solving the problem. +# All programs share the same build rule and a dependency on the main hdf5 +# library above. +h5_chunk_read: $(srcdir)/h5_chunk_read.c +h5_compound: $(srcdir)/h5_compound.c +h5_extend_write: $(srcdir)/h5_extend_write.c +h5_group: $(srcdir)/h5_group.c +h5_write: $(srcdir)/h5_write.c +h5_read: $(srcdir)/h5_read.c +h5_select: $(srcdir)/h5_select.c +h5_attribute: $(srcdir)/h5_attribute.c +h5_mount: $(srcdir)/h5_mount.c +h5_reference: $(srcdir)/h5_reference.c +h5_drivers: $(srcdir)/h5_drivers.c +ph5example: $(srcdir)/ph5example.c +h5_dtransform: $(srcdir)/h5_dtransform.c + +# How to create EXAMPLEDIR if it doesn't already exist $(EXAMPLEDIR): -$(top_srcdir)/bin/mkdirs $@ +# Install and uninstall rules. We install the source files, not the +# example programs themselves. install-data-local: @$(MAKE) $(AM_MAKEFLAGS) install-examples uninstall-local: @$(MAKE) $(AM_MAKEFLAGS) uninstall-examples -# We want to install the source files, not the examples themselves. Add '.c' to -# each example to get its source. This is a bit kludgy. install-examples: $(EXAMPLEDIR) $(INSTALL_FILES) @for f in X $(INSTALL_FILES); do \ if test $$f != X; then \ - (set -x; $(INSTALL) $(top_srcdir)/examples/$$f $(EXAMPLEDIR)/. || exit 1);\ + (set -x; $(INSTALL) $(srcdir)/$$f $(EXAMPLEDIR)/. || exit 1);\ fi; \ done uninstall-examples: @if test -n "$(INSTALL_FILES)" -a -d $(EXAMPLEDIR); then \ set -x; cd $(EXAMPLEDIR) && $(RM) $(INSTALL_FILES); \ - fi + fi -check-install: - @$(MAKE) $(AM_MAKEFLAGS) installcheck installcheck-local: @$(MAKE) $(AM_MAKEFLAGS) check -# List dependencies for each program. Normally, automake would take -# care of this for us, but if we tell automake about the programs it -# will try to build them with the normal C compiler, not h5cc. This is -# an inelegant way of solving the problem. -# All programs share the same build rule and a dependency on the main hdf5 -# library above. -h5_chunk_read: $(srcdir)/h5_chunk_read.c -h5_compound: $(srcdir)/h5_compound.c -h5_extend_write: $(srcdir)/h5_extend_write.c -h5_group: $(srcdir)/h5_group.c -h5_write: $(srcdir)/h5_write.c -h5_read: $(srcdir)/h5_read.c -h5_select: $(srcdir)/h5_select.c -h5_attribute: $(srcdir)/h5_attribute.c -h5_mount: $(srcdir)/h5_mount.c -h5_reference: $(srcdir)/h5_reference.c -h5_drivers: $(srcdir)/h5_drivers.c -ph5example: $(srcdir)/ph5example.c -h5_dtransform: $(srcdir)/h5_dtransform.c - # lib/progs/tests targets recurse into subdirectories. build-* targets # build files in this directory. build-lib: $(LIB) |