1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-07-22 10:47:45 +02:00

Fixed module depend

This commit is contained in:
Anthony Scemama 2021-05-12 01:51:26 +02:00
parent 4adcfa1df4
commit 5c40916bf3
8 changed files with 112 additions and 267 deletions

View File

@ -38,7 +38,7 @@ VERSION_MINOR = @VERSION_MINOR@
VERSION_PATCH = @VERSION_PATCH@
SUBDIRS =
CLEANFILES =
CLEANFILES = qmckl.mod
EXTRA_DIST =
pkgconfigdir = $(libdir)/pkgconfig
@ -47,13 +47,14 @@ pkgconfig_DATA = pkgconfig/qmckl.pc
qmckl_h = $(srcdir)/include/qmckl.h
include_HEADERS = $(qmckl_h)
qmckl_f = share/qmckl/fortran/qmckl_f.f90
qmckl_fo = share/qmckl/fortran/qmckl_f.$(OBJEXT)
qmckl_f = $(srcdir)/share/qmckl/fortran/qmckl_f.f90
test_qmckl_f = $(srcdir)/tests/qmckl_f.f90
test_qmckl_fo = $(srcdir)/tests/qmckl_f.o
src_qmckl_f = $(srcdir)/src/qmckl_f.f90
src_qmckl_fo = $(srcdir)/src/qmckl_f.o
fortrandir = $(datadir)/$(PACKAGE_NAME)/fortran/
fortran_DATA = $(qmckl_f)
dist_fortran_DATA = $(qmckl_f)
AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include
@ -62,37 +63,38 @@ src_libqmckl_la_SOURCES = $(qmckl_h) $(src_qmckl_f) $(C_FILES) $(F_FILES) $(H_PR
export srcdir qmckl_f qmckl_h
CLEANFILES+=$(test_qmckl_f) $(src_qmckl_f) $(qmckl_h) $(qmckl_f)
CLEANFILES+=$(test_qmckl_f) $(src_qmckl_f) $(test_qmckl_o) $(src_qmckl_o) \
$(qmckl_h) $(qmckl_f)
htmlize_el=$(srcdir)/share/doc/qmckl/html/htmlize.el
include $(srcdir)/generated.mk
if QMCKL_DEVEL
include Makefile.dev.mk
else
include Makefile.dist.mk
endif
ln_s_verbose = $(ln_s_verbose_@AM_V@)
ln_s_verbose_ = $(ln_s_verbose_@AM_DEFAULT_V@)
ln_s_verbose_0 = @echo " LN_S $<";
htmldir = $(docdir)/html
html_DATA = $(HTML_FILES) $(htmlize_el) $(srcdir)/share/doc/qmckl/html/index.html
dist_html_DATA = $(HTML_FILES) $(srcdir)/share/doc/qmckl/html/index.html
textdir = $(docdir)/text
text_DATA = $(TEXT_FILES)
dist_text_DATA = $(TEXT_FILES)
$(srcdir)/generated.mk: $(ORG_FILES)
$(srcdir)/tools/build_makefile.sh
$(test_qmckl_fo): $(test_qmckl_f)
$(test_qmckl_f): $(qmckl_f)
cp $(qmckl_f) $(test_qmckl_f)
$(src_qmckl_fo): $(src_qmckl_f)
$(src_qmckl_f): $(qmckl_f)
cp $(qmckl_f) $(src_qmckl_f)
$(srcdir)/share/doc/qmckl/html/index.html: $(srcdir)/share/doc/qmckl/html/README.html
mv -f $(srcdir)/share/doc/qmckl/html/README.html \
$(srcdir)/share/doc/qmckl/html/index.html
$(ln_s_verbose)cd $(srcdir)/share/doc/qmckl/html/ && \
$(LN_S) --force README.html index.html
rpms srcrpm:
for dir in $(SUBDIRS); do \
@ -102,3 +104,56 @@ rpms srcrpm:
.PHONY: rpms srcrpm
if QMCKL_DEVEL
dist_src_DATA = $(ORG_FILES) $(TANGLED_FILES) $(EXPORTED_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) $(qmckl_f) $(qmckl_h)
CLEANFILES += $(BUILT_SOURCES) $(C_TEST_FILES) $(F_TEST_FILES) $(TANGLED_FILES) $(C_TEST_FILES) $(F_TEST_FILES) $(qmckl_f) $(qmckl_h) $(HTML_FILES) $(TEXT_FILES) $(srcdir)/share/doc/qmckl/html/index.html $(EXPORTED_FILES)
EXTRA_DIST += \
tools/build_doc.sh \
tools/build_makefile.sh \
tools/build_qmckl_f.sh \
tools/build_qmckl_h.sh \
tools/config_doc.el \
tools/config_tangle.el \
tools/init.el \
tools/install_htmlize.sh \
tools/lib.org \
tools/tangle.sh \
tools/theme.setup
## Silent
## ======
export_verbose = $(export_verbose_@AM_V@)
export_verbose_ = $(export_verbose_@AM_DEFAULT_V@)
export_verbose_0 = @echo " DOC $<";
tangle_verbose = $(tangle_verbose_@AM_V@)
tangle_verbose_ = $(tangle_verbose_@AM_DEFAULT_V@)
tangle_verbose_0 = @echo " TANGLE $<";
cat_h_verbose = $(cat_h_verbose_@AM_V@)
cat_h_verbose_ = $(cat_h_verbose_@AM_DEFAULT_V@)
cat_h_verbose_0 = @echo " HEADER $@";
## Rules
## =====
SUFFIXES = .f90 .h .org .c _f.f90 _func.h _type.h _private_func.h _private_type.h
$(qmckl_h): $(H_FUNC_FILES) $(H_TYPE_FILES)
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_h.sh
$(qmckl_f): $(FH_FUNC_FILES) $(FH_TYPE_FILES)
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_f.sh
$(htmlize_el):
$(srcdir)/tools/install_htmlize.sh $(htmlize_el)
endif

View File

@ -1,84 +0,0 @@
# QMCkl - Quantum Monte Carlo kernel library
#
# BSD 3-Clause License
#
# Copyright (c) 2020, TREX Center of Excellence
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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) $(qmckl_f) $(qmckl_h)
CLEANFILES += $(BUILT_SOURCES) $(C_TEST_FILES) $(F_TEST_FILES) $(TANGLED_FILES) $(C_TEST_FILES) $(F_TEST_FILES) $(qmckl_f) $(qmckl_h) $(HTML_FILES) $(TEXT_FILES) $(srcdir)/share/doc/qmckl/html/index.html
EXTRA_DIST += \
tools/build_doc.sh \
tools/build_makefile.sh \
tools/build_qmckl_f.sh \
tools/build_qmckl_h.sh \
tools/config_doc.el \
tools/config_tangle.el \
tools/init.el \
tools/install_htmlize.sh \
tools/lib.org \
tools/tangle.sh \
tools/theme.setup
## Silent
## ======
export_verbose = $(export_verbose_@AM_V@)
export_verbose_ = $(export_verbose_@AM_DEFAULT_V@)
export_verbose_0 = @echo " DOC $<";
tangle_verbose = $(tangle_verbose_@AM_V@)
tangle_verbose_ = $(tangle_verbose_@AM_DEFAULT_V@)
tangle_verbose_0 = @echo " TANGLE $<";
cat_h_verbose = $(cat_h_verbose_@AM_V@)
cat_h_verbose_ = $(cat_h_verbose_@AM_DEFAULT_V@)
cat_h_verbose_0 = @echo " HEADER $@";
## Rules
## =====
SUFFIXES = .f90 .h .org .c _f.f90 _func.h _type.h _private_func.h _private_type.h
$(qmckl_h): $(H_FUNC_FILES) $(H_TYPE_FILES)
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_h.sh
$(qmckl_f): $(FH_FUNC_FILES) $(FH_TYPE_FILES)
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_f.sh
$(htmlize_el):
$(srcdir)/tools/install_htmlize.sh $(htmlize_el)
# vim: syntax=automake noet

View File

@ -1,34 +0,0 @@
# QMCkl - Quantum Monte Carlo kernel library
#
# BSD 3-Clause License
#
# Copyright (c) 2020, TREX Center of Excellence
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# vim: syntax=automake noet

View File

@ -35,7 +35,7 @@
AC_PREREQ([2.69])
AC_INIT([QMCkl],[0.1.1],
AC_INIT([qmckl],[0.1.1],
[https://github.com/TREX-CoE/qmckl/issues], [],
[https://trex-coe.github.io/qmckl/index.html])
AM_INIT_AUTOMAKE([subdir-objects color-tests parallel-tests silent-rules 1.11])

View File

@ -16,14 +16,14 @@ grep TITLE $(cat table_of_contents) | tr ':' ' '
#+end_src
#+RESULTS: toc
| qmckl.org | #+TITLE | Header | files |
| qmckl.org | #+TITLE | Introduction | |
| qmckl_error.org | #+TITLE | Error | handling |
| qmckl_context.org | #+TITLE | Context | |
| qmckl_precision.org | #+TITLE | Multi-precision | |
| qmckl_memory.org | #+TITLE | Memory | management |
| qmckl_distance.org | #+TITLE | Distances | |
| qmckl_numprec.org | #+TITLE | Numerical | precision |
| qmckl_electron.org | #+TITLE | Electrons | |
| qmckl_ao.org | #+TITLE | Atomic | Orbitals |
| test_qmckl.org | #+TITLE | Testing | |
| qmckl_distance.org | #+TITLE | Inter-particle | distances |
#+begin_src python :var data=toc :exports results :results raw
result = []
@ -38,11 +38,11 @@ return '\n'.join(result)
- [[./qmckl.html][Introduction]]
- [[./qmckl_error.html][Error handling]]
- [[./qmckl_context.html][Context]]
- [[./qmckl_precision.html][Multi-precision]]
- [[./qmckl_memory.html][Memory management]]
- [[./qmckl_distance.html][Distances]]
- [[./qmckl_numprec.html][Numerical precision]]
- [[./qmckl_electron.html][Electrons]]
- [[./qmckl_ao.html][Atomic Orbitals]]
- [[./test_qmckl.html][Testing]]
- [[./qmckl_distance.html][Inter-particle distances]]
--------------------------------

View File

@ -6,4 +6,3 @@ qmckl_numprec.org
qmckl_electron.org
qmckl_ao.org
qmckl_distance.org
test_qmckl.org

View File

@ -1,109 +0,0 @@
#+TITLE: Testing
#+SETUPFILE: ../tools/theme.setup
* QMCkl test :noexport:
This file is the main program of the unit tests. The tests rely on the
$\mu$unit framework, which is provided as a git submodule.
First, we use a script to find the list of all the generated test files:
#+NAME: test-files
#+begin_src sh :exports none
FILES=$(cat table_of_contents)
grep begin_src $FILES \
| grep c_test \
| cut -d '.' -f 1 \
| uniq
#+end_src
#+RESULTS: test-files
| qmckl_error |
| qmckl_context |
| qmckl_memory |
| qmckl_electron |
| qmckl_ao |
| qmckl_distance |
We generate the function headers
#+begin_src sh :var files=test-files :exports output :results drawer
echo "#+NAME: headers"
echo "#+begin_src c :tangle no"
for file in $files
do
routine=test_${file%.c}
echo "MunitResult ${routine}();"
done
echo "#+end_src"
#+end_src
#+RESULTS:
:results:
#+NAME: headers
#+begin_src c :tangle no
MunitResult test_qmckl_error();
MunitResult test_qmckl_context();
MunitResult test_qmckl_memory();
MunitResult test_qmckl_electron();
MunitResult test_qmckl_ao();
MunitResult test_qmckl_distance();
#+end_src
:end:
and the required function calls:
#+begin_src sh :var files=test-files :exports output :results drawer
echo "#+NAME: calls"
echo "#+begin_src c :tangle no"
for file in $files
do
routine=test_${file%.c}
echo " { (char*) \"${routine}\", ${routine}, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},"
done
echo "#+end_src"
#+end_src
#+RESULTS:
:results:
#+NAME: calls
#+begin_src c :tangle no
{ (char*) "test_qmckl_error", test_qmckl_error, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_context", test_qmckl_context, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_memory", test_qmckl_memory, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_electron", test_qmckl_electron, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_ao", test_qmckl_ao, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_distance", test_qmckl_distance, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
#+end_src
:end:
We include the =mcheck.h= header to enable the debugging of
allocations with ~mtrace~. Memory allocations will be traced in the
file specified by the ~MALLOC_TRACE~ environment variable.
#+begin_src c :comments link :noweb yes :tangle test_qmckl.c
#include "qmckl.h"
#include "munit.h"
#include "mcheck.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
<<headers>>
int main(int argc, char* argv[MUNIT_ARRAY_PARAM(argc + 1)]) {
mtrace();
static MunitTest test_suite_tests[] =
{
<<calls>>
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
};
static const MunitSuite test_suite =
{
(char*) "", test_suite_tests, NULL, 1, MUNIT_SUITE_OPTION_NONE
};
int result = munit_suite_main(&test_suite, (void*) "µnit", argc, argv);
muntrace();
return result;
}
#+end_src

View File

@ -3,8 +3,7 @@
# Creates all the dependencies from the org-mode files
if [[ -z ${srcdir} ]] ; then
echo "Error: srcdir environment variable is not defined"
exit 1
srcdir=.
fi
@ -34,8 +33,8 @@ function make_src()
tangled="\$(srcdir)/org/${i}.tangled"
exported="\$(srcdir)/org/${i}.exported"
c_test_x="\$(srcdir)/tests/test_${i}"
c_test_o="\$(srcdir)/tests/test_${i}.o"
f_test_o="\$(srcdir)/tests/test_${i}_f.o"
c_test_o="\$(srcdir)/tests/test_${i}.\$(OBJEXT)"
f_test_o="\$(srcdir)/tests/test_${i}_f.\$(OBJEXT)"
c_test="\$(srcdir)/tests/test_${i}.c"
f_test="\$(srcdir)/tests/test_${i}_f.f90"
html="\$(srcdir)/share/doc/qmckl/html/${i}.html"
@ -44,13 +43,13 @@ function make_src()
i="\$(srcdir)/src/${i}"
c="${i}.c"
o="${i}.o"
o="${i}.\$(OBJEXT)"
h_func="${i}_func.h"
h_type="${i}_type.h"
h_private_func="${i}_private_func.h"
h_private_type="${i}_private_type.h"
f90="${i}_f.f90"
fo="${i}_f.o"
fo="${i}_f.\$(OBJEXT)"
fh_func="${i}_fh_func.f90"
fh_type="${i}_fh_type.f90"
@ -98,8 +97,8 @@ function make_src()
grep -q "(eval f)" $org
if [[ $? -eq 0 ]] ; then
DEPS[$f90]+="$tangled "
DEPS[$fo]+="$f90 \$(qmckl_fo)"
DEPS[$f90]+=" $tangled \$(src_qmckl_fo)"
DEPS[$fo]+="$f90 \$(src_qmckl_fo)"
F_FILES+=" $f90"
fi
@ -117,16 +116,16 @@ function make_src()
grep -q "(eval c_test)" $org
if [[ $? -eq 0 ]] ; then
DEPS_TEST["${c_test}"]="${tangled} "
DEPS_TEST["${c_test}"]=" ${tangled}"
C_TEST_FILES+=" ${c_test}"
TESTS["${c_test_x}"]+="${c_test} \$(qmckl_h)"
fi
grep -q "(eval f_test)" $org
if [[ $? -eq 0 ]] ; then
DEPS_TEST["${f_test}"]+="${tangled} "
DEPS_TEST["${f_test}"]+=" ${tangled} \$(test_qmckl_fo)"
F_TEST_FILES+=" ${f_test}"
TESTS["${c_test_x}"]+=" ${f_test} \$(test_qmckl_f)"
TESTS["${c_test_x}"]+=" ${f_test} \$(test_qmckl_fo)"
fi
done
@ -140,7 +139,6 @@ function make_src()
echo "C_FILES=${C_FILES}"
echo "F_FILES=${F_FILES}"
echo "C_O_FILES=${C_O_FILES}"
echo "F_O_FILES=${F_O_FILES}"
echo "FH_FUNC_FILES=${FH_FUNC_FILES}"
echo "FH_TYPE_FILES=${FH_TYPE_FILES}"
echo "H_FUNC_FILES=${H_FUNC_FILES}"
@ -155,28 +153,46 @@ function make_src()
echo
echo
echo "## Org-mode inherited dependencies"
echo
echo "if QMCKL_DEVEL"
for f in ${!DEPS_ORG[@]} ; do
echo ${DEPS_ORG[$f]}: $f
echo " \$(tangle_verbose)\$(srcdir)/tools/tangle.sh $f"
echo ""
done
echo "endif"
echo
echo
echo "## Source dependencies"
echo
echo "if QMCKL_DEVEL"
for f in ${!DEPS[@]} ; do
x="${DEPS[$f]}"
if [[ "${x%.tangled}x" != ${x}x ]] ; then
echo "${f}: ${DEPS[$f]}"
fi
done | sort
echo "endif"
echo "${src_qmckl_fo}: ${src_qmckl_f}"
for f in ${!DEPS[@]} ; do
x="${DEPS[$f]}"
if [[ "${x%.tangled}x" == ${x}x ]] ; then
echo "${f}: ${DEPS[$f]}"
fi
done | sort
echo
echo "## Test files"
echo
echo "\$(test_qmckl_fo): \$(test_qmckl_f)"
echo "if QMCKL_DEVEL"
for f in ${!DEPS_TEST[@]} ; do
echo "${f}: ${DEPS_TEST[$f]}"
done | sort
echo "endif"
echo
echo "check_PROGRAMS = \$(TESTS)"
for f in ${!TESTS[@]} ; do
@ -188,6 +204,7 @@ function make_src()
echo
echo "## Documentation"
echo
echo "if QMCKL_DEVEL"
for f in ${ORG_FILES} ; do
echo "${HTML[$f]}: ${DEPS_DOC[$f]} \$(htmlize_el)"
echo "${TEXT[$f]}: ${DEPS_DOC[$f]}"
@ -198,6 +215,7 @@ function make_src()
echo " \$(export_verbose)\$(srcdir)/tools/build_doc.sh $f"
echo ""
done
echo "endif"
}