Commit a9d1b2d3 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl

Fix re-generation of automatic headers

Now this is done consistently both in autoconf and automake. One can now
safely call make clean and the header files are re-generated
automatically.
parent 1784add4
......@@ -9,42 +9,45 @@ AM_LDFLAGS = $(SCALAPACK_LDFLAGS)
lib_LTLIBRARIES = libelpa@SUFFIX@.la
libelpa@SUFFIX@_la_LINK = $(FCLINK) $(AM_LDFLAGS) -version-info $(ELPA_SO_VERSION) -lstdc++
libelpa@SUFFIX@_la_SOURCES = src/mod_precision.f90 \
src/mod_mpi.F90 \
src/mod_mpi_stubs.F90 \
src/elpa2_kernels/mod_fortran_interfaces.F90 \
src/elpa_utilities.F90 \
src/elpa1_compute.F90 \
src/elpa1.F90 \
src/elpa2_utilities.F90 \
src/mod_pack_unpack_real.F90 \
src/elpa2_kernels/mod_single_hh_trafo_real.F90 \
src/mod_compute_hh_trafo_real.F90 \
src/mod_compute_hh_trafo_complex.F90 \
src/mod_pack_unpack_complex.F90 \
src/aligned_mem.F90 \
src/elpa2_compute.F90 \
src/elpa2.F90 \
src/elpa_c_interface.F90 \
src/elpa_qr/qr_utils.F90 \
src/elpa_qr/elpa_qrkernels.f90 \
src/elpa_qr/elpa_pdlarfb.F90 \
src/elpa_qr/elpa_pdgeqrf.F90
EXTRA_libelpa@SUFFIX@_la_DEPENDENCIES = src/elpa_reduce_add_vectors.X90 \
src/elpa_transpose_vectors.X90 \
src/redist_band.X90
libelpa@SUFFIX@_la_SOURCES = \
src/mod_precision.f90 \
src/mod_mpi.F90 \
src/mod_mpi_stubs.F90 \
src/elpa2_kernels/mod_fortran_interfaces.F90 \
src/elpa_utilities.F90 \
src/elpa1_compute.F90 \
src/elpa1.F90 \
src/elpa2_utilities.F90 \
src/mod_pack_unpack_real.F90 \
src/elpa2_kernels/mod_single_hh_trafo_real.F90 \
src/mod_compute_hh_trafo_real.F90 \
src/mod_compute_hh_trafo_complex.F90 \
src/mod_pack_unpack_complex.F90 \
src/aligned_mem.F90 \
src/elpa2_compute.F90 \
src/elpa2.F90 \
src/elpa_c_interface.F90 \
src/elpa_qr/qr_utils.F90 \
src/elpa_qr/elpa_qrkernels.f90 \
src/elpa_qr/elpa_pdlarfb.F90 \
src/elpa_qr/elpa_pdgeqrf.F90
EXTRA_libelpa@SUFFIX@_la_DEPENDENCIES = \
src/elpa_reduce_add_vectors.X90 \
src/elpa_transpose_vectors.X90 \
src/redist_band.X90
if HAVE_DETAILED_TIMINGS
libelpa@SUFFIX@_la_SOURCES += src/timer.F90 \
src/ftimings/ftimings.F90 \
src/ftimings/ftimings_type.F90 \
src/ftimings/ftimings_value.F90 \
src/ftimings/highwater_mark.c \
src/ftimings/resident_set_size.c \
src/ftimings/time.c \
src/ftimings/virtual_memory.c \
src/ftimings/papi.c
libelpa@SUFFIX@_la_SOURCES += \
src/timer.F90 \
src/ftimings/ftimings.F90 \
src/ftimings/ftimings_type.F90 \
src/ftimings/ftimings_value.F90 \
src/ftimings/highwater_mark.c \
src/ftimings/resident_set_size.c \
src/ftimings/time.c \
src/ftimings/virtual_memory.c \
src/ftimings/papi.c
endif
if !WITH_MPI
......@@ -126,6 +129,9 @@ if WITH_COMPLEX_AVX_BLOCK2_KERNEL
libelpa@SUFFIX@_la_SOURCES += src/elpa2_kernels/elpa2_kernels_complex_avx-avx2_2hv.c
endif
include generated_headers.am
BUILT_SOURCES = $(generated_headers)
# install any .mod files in the include/ dir
elpa_includedir = $(includedir)/elpa@SUFFIX@-@PACKAGE_VERSION@
nobase_elpa_include_HEADERS = $(wildcard modules/*)
......@@ -346,13 +352,13 @@ CLEANFILES = \
clean-local:
-rm -rf modules/* .fortran_dependencies/*
-rm -rf $(generated_headers)
distclean-local:
-rm config-f90.h
-rm -rf ./src/elpa2_kernels/.deps
-rm -rf ./src/.deps
-rm -rf ./test/.deps
-rm -rf ./elpa/elpa_generated.h
-rmdir ./src/elpa2_kernels/
-rmdir ./src
-rmdir ./test
......@@ -368,13 +374,6 @@ EXTRA_DIST = \
src/elpa_transpose_vectors.X90 \
src/redist_band.X90
# Rules to re-generated the headers
elpa/elpa_generated.h: $(top_srcdir)/src/elpa_c_interface.F90
grep -h "^ *!c>" $^ | sed 's/^ *!c>//;' > $@ || { rm $@; exit 1; }
test/shared_sources/generated.h: $(wildcard $(top_srcdir)/test/shared_sources/*.F90)
grep -h "^ *!c>" $^ | sed 's/^ *!c>//;' > $@ || { rm $@; exit 1; }
LIBTOOL_DEPS = @LIBTOOL_DEPS@
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status libtool
......
......@@ -19,8 +19,6 @@ AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AM_SILENT_RULES([yes])
rm -rf config.h config-f90.h
# Set the libtool library version, see LIBRARY_INTERFACE
#
# See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
......@@ -879,26 +877,6 @@ AC_CONFIG_FILES([
AC_OUTPUT
if test -e config.h ; then
grep "^#define" config.h > config-f90.h
else
echo "Warning! No config.h was generated, check for errors and re-run configure!"
exit 1
fi
echo "Generating elpa/elpa_generated.h..."
mkdir -p elpa
grep -h "^ *!c>" $srcdir/src/elpa_c_interface.F90 | sed 's/^ *!c>//;' > elpa/elpa_generated.h || exit 1
echo "Generating Fortran interfaces for C kernels"
grep -h "^ *!f>" $srcdir/src/elpa2_kernels/*.c | sed 's/^ *!f>//;' > elpa/elpa_generated_fortran_interfaces.h || exit 1
#grep -h "^ *!f>" $srcdir/src/elpa2_kernels/*.cpp | sed 's/^ *!f>//;' >> elpa/elpa_generated_fortran_interfaces.h || exit 1
echo "Generating test/shared_sources/generated.h..."
mkdir -p test/shared_sources
grep -h "^ *!c>" $srcdir/test/shared_sources/*.F90 | sed 's/^ *!c>//;' > test/shared_sources/generated.h || exit 1
if test "${can_compile_avx}" = "no" ; then
# if test x"${want_avx}" = x"yes" ; then
AC_MSG_WARN([Could not compile AVX instructions])
......@@ -910,3 +888,4 @@ if test "${can_compile_avx2}" = "no" ; then
# fi
fi
make -f $srcdir/generated_headers.am generated-headers top_srcdir="$srcdir"
define extract_interface
@echo "Generating $@...";
@grep -h "^ *$1" $^ | sed 's/^ *$1//;' > $@ || { rm $@; exit 1; }
endef
elpa test:
mkdir $@
test/shared_sources: | test
mkdir $@
config-f90.h: config.h
@echo "Generating $@...";
@grep "^#define" $^ > $@ || { rm $@; exit 1; }
elpa/elpa_generated.h: $(top_srcdir)/src/elpa_c_interface.F90 | elpa
$(call extract_interface,!c>)
test/shared_sources/generated.h: $(wildcard $(top_srcdir)/test/shared_sources/*.F90) | test/shared_sources
$(call extract_interface,!c>)
elpa/elpa_generated_fortran_interfaces.h: $(wildcard $(top_srcdir)/src/elpa2_kernels/*.c) | elpa
$(call extract_interface,!f>)
generated_headers= config-f90.h elpa/elpa_generated.h test/shared_sources/generated.h elpa/elpa_generated_fortran_interfaces.h
generated-headers: $(generated_headers)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment