summaryrefslogtreecommitdiffstats
path: root/fortran/src/Makefile.am
diff options
context:
space:
mode:
authorJames Laird <jlaird@hdfgroup.org>2005-04-25 19:00:06 (GMT)
committerJames Laird <jlaird@hdfgroup.org>2005-04-25 19:00:06 (GMT)
commita05061f512a52832cc69211db0e382d30eecaaa5 (patch)
tree1a4d5a3e93700a3b493171e9e32527ae151d63f6 /fortran/src/Makefile.am
parent1cc3666a270a15783574a2f2a7c6d9bc1209a76b (diff)
downloadhdf5-a05061f512a52832cc69211db0e382d30eecaaa5.zip
hdf5-a05061f512a52832cc69211db0e382d30eecaaa5.tar.gz
hdf5-a05061f512a52832cc69211db0e382d30eecaaa5.tar.bz2
[svn-r10657] Purpose:
Configuration feature Description: Fortran integer types (not reals) are now automatically detected at build-time. Solution: Two helper programs are used, one to detect what types the Fortran compiler has access to, and one to generate header files for C and Fortran matching up types. Platforms tested: mir, copper, modi4, pommier (last week) Misc. update: MANIFEST updated, H5f90fortran_types.f90 removed from configure.in, since it is not longer generated by configure.
Diffstat (limited to 'fortran/src/Makefile.am')
-rw-r--r--fortran/src/Makefile.am43
1 files changed, 42 insertions, 1 deletions
diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am
index 88340a3..efc1aa2 100644
--- a/fortran/src/Makefile.am
+++ b/fortran/src/Makefile.am
@@ -50,7 +50,12 @@ libhdf5_fortran_la_SOURCES=H5fortran_flags.f90 H5f90global.f90 \
# h5fc and libhdf5_fortran.settings are generated during configure.
# Remove them only when distclean.
-DISTCLEANFILES=h5fc H5fortran_types.f90 libhdf5_fortran.settings
+DISTCLEANFILES=h5fc libhdf5_fortran.settings
+
+# H5fortran_types.f90 and H5f90i.h are automatically generaed by
+# H5match_types, and must be cleaned explicitly. H5fort_type_defines.h
+# is generated by H5fortran_detect
+MOSTLYCLEANFILES=H5fortran_types.f90 H5f90i_gen.h H5fort_type_defines.h
# Fortran module files can have different extensions and different names
# (e.g., different capitalizations) on different platforms. Write rules
@@ -92,6 +97,42 @@ else
H5FC_NAME = h5fc
endif
+# Rules for automatically detecting which fortran types are present
+# and matching them to C types. This is accomplished using helper
+# programs.
+# It's a bit tricky to make sure that Automake builds things in the right
+# order (especially when using 'gmake -j ...'
+# H5fortran_detect.f90 needs to be compiled into H5fortran_detect.
+# This program is run, and its output is saved in H5fort_type_defines.h
+# H5match_types.c then includes this file and can be compiled into
+# H5match_types. When H5match_types is run, it creates H5f90i_gen.h
+# and H5fortran_types.f90, which are needed by the Fortran library.
+
+# These are the helper programs we need to build.
+noinst_PROGRAMS = H5match_types H5fortran_detect
+
+# Tell Automake to create H5f90i_gen.h before it does anything else.
+# When it creates H5f90i_gen.h, it will create H5fortran_types.f90 as
+# a side effect.
+BUILT_SOURCES = H5f90i_gen.h
+
+# Specify what Automake needs to create: first the H5fort_type_defines.h
+# header, then H5match_types which includes that header, then
+# it needs to run H5match_types.
+H5fortran_types.f90 H5f90i_gen.h: H5match_types.c
+ $(MAKE) $(AM_MAKEFLAGS) H5fort_type_defines.h
+ $(MAKE) $(AM_MAKEFLAGS) H5match_types
+ $(RUNSERIAL) ./H5match_types
+
+# H5fort_type_defines.h is created by running H5fortran_detect.
+# Obviously, H5fortran_detect needs to be built first.
+H5fort_type_defines.h: H5fortran_detect
+ $(RUNSERIAL) ./H5fortran_detect > H5fort_type_defines.h
+
+# Automake knows how to build fortran programs if we tell it the source
+# files.
+H5fortran_detect_SOURCES = H5fortran_detect.f90
+
# Mark this directory as part of the Fortran API
HDF_FORTRAN=yes