From a4e49f4939a289e51b9d4a8e6a9d1d3e447b7e61 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 11 May 2021 12:56:41 +0200 Subject: [PATCH] Added tests --- Makefile.am | 7 ++++++- configure.ac | 2 +- tools/build_makefile.sh | 31 +++++++++++++++++++------------ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Makefile.am b/Makefile.am index 01f0555..c3930d7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,6 +50,11 @@ qmckl_f = $(srcdir)/share/qmckl/fortran/qmckl_f.f90 fortrandir = $(datadir)/$(PACKAGE_NAME)/fortran/ fortran_DATA = $(qmckl_f) +lib_LTLIBRARIES = src/libqmckl.la +src_libqmckl_la_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include +src_libqmckl_la_SOURCES = $(qmckl_h) $(qmckl_f) $(C_FILES) $(F_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES) + + export srcdir qmckl_f qmckl_h @@ -58,7 +63,7 @@ if QMCKL_DEVEL dist_src_DATA = $(ORG_FILES) BUILT_SOURCES = $(C_FILES) $(F_FILES) $(FH_FUNC_FILES) $(FH_TYPE_FILES) $(H_FUNC_FILES) $(H_TYPE_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES) -CLEANFILES += $(BUILT_SOURCES) $(C_TEST_FILES) $(F_TEST_FILES) $(TANGLED_FILES) +CLEANFILES += $(BUILT_SOURCES) $(C_TEST_FILES) $(F_TEST_FILES) $(TANGLED_FILES) $(C_TEST_FILES) $(F_TEST_FILES) # -----> endif diff --git a/configure.ac b/configure.ac index 1928515..e09075f 100644 --- a/configure.ac +++ b/configure.ac @@ -38,7 +38,7 @@ AC_PREREQ([2.69]) AC_INIT([QMCkl],[0.1.1], [https://github.com/TREX-CoE/qmckl/issues], [], [https://trex-coe.github.io/qmckl/index.html]) -AM_INIT_AUTOMAKE([color-tests parallel-tests silent-rules 1.11]) +AM_INIT_AUTOMAKE([subdir-objects color-tests parallel-tests silent-rules 1.11]) AM_MAINTAINER_MODE() LT_INIT AC_CONFIG_SRCDIR([Makefile.in]) diff --git a/tools/build_makefile.sh b/tools/build_makefile.sh index e22185e..6aca004 100755 --- a/tools/build_makefile.sh +++ b/tools/build_makefile.sh @@ -15,7 +15,7 @@ function make_src() cd ${srcdir} - declare -A DEPS DEPS_ORG + declare -A DEPS DEPS_ORG DEPS_TEST C_FILES= F_FILES= @@ -30,15 +30,15 @@ function make_src() TANGLED_FILES= for org in org/*.org ; do - tangled="\$(srcdir)/${org%.org}.tangled" - - i=${org%.org} + i=$(basename ${org%.org}) + tangled="\$(srcdir)/org/${i}.tangled" c_test_o="\$(srcdir)/src/test_${i}.o" f_test_o="\$(srcdir)/src/test_${i}_f.o" c_test="\$(srcdir)/src/test_${i}.c" f_test="\$(srcdir)/src/test_${i}_f.f90" - i="\$(srcdir)/src/${i#org/}" + i="\$(srcdir)/src/${i}" + c="${i}.c" o="${i}.o" h_func="${i}_func.h" @@ -113,16 +113,16 @@ function make_src() grep -q "(eval c_test)" $org if [[ $? -eq 0 ]] ; then - DEPS["$c_test"]="${tangled} " - DEPS["$c_test_o"]+=" $c_test $o" - C_TEST_FILES+=" $c_test" + DEPS_TEST["${c_test}"]="${tangled} " + DEPS_TEST["${c_test_o}"]+=" ${c_test} $o" + C_TEST_FILES+=" ${c_test}" fi grep -q "(eval f_test)" $org if [[ $? -eq 0 ]] ; then - DEPS["$f_test"]+="${tangled} " - DEPS["$f_test_o"]+=" $f_test $fo" - F_TEST_FILES+=" $f_test" + DEPS_TEST["${f_test}"]+="${tangled} " + DEPS_TEST["${f_test_o}"]+=" ${f_test} $fo" + F_TEST_FILES+=" ${f_test}" fi done @@ -187,7 +187,14 @@ function make_src() echo "## Source dependencies" >> ${OUTPUT} echo >> ${OUTPUT} for f in ${!DEPS[@]} ; do - echo ${f}: ${DEPS[$f]} + echo "${f}: ${DEPS[$f]}" + done | sort >> ${OUTPUT} + + echo >> ${OUTPUT} + echo "## Test files" >> ${OUTPUT} + echo >> ${OUTPUT} + for f in ${!DEPS_TEST[@]} ; do + echo "${f}: ${DEPS_TEST[$f]} \$(qmckl_h) \$(srcdir)/src/libqmckl.la" done | sort >> ${OUTPUT} }