Add doc in dist, and text doc

This commit is contained in:
Anthony Scemama 2021-04-21 12:44:03 +02:00
parent e18655b147
commit 399a632bdd
11 changed files with 83 additions and 43 deletions

1
.gitignore vendored
View File

@ -7,5 +7,6 @@ src/auto/
src/ltximg/ src/ltximg/
src/qmckl.mod src/qmckl.mod
*.swp *.swp
*.tar.gz

View File

@ -8,9 +8,18 @@ package = qmckl
version = 0.1-alpha version = 0.1-alpha
tarname = $(package) tarname = $(package)
distdir = $(tarname)-$(version) distdir = $(tarname)-$(version)
prefix = /usr/local
QMCKL_ROOT=$(CURDIR)
shared_lib=$(QMCKL_ROOT)/lib/libqmckl.so
static_lib=$(QMCKL_ROOT)/lib/libqmckl.a
qmckl_h=$(QMCKL_ROOT)/include/qmckl.h
qmckl_f=$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
export prefix shared_lib static_lib qmckl_h qmckl_f
all clean check: all clean doc check install uninstall:
$(MAKE) -C src $@ $(MAKE) -C src $@
dist: $(distdir).tar.gz dist: $(distdir).tar.gz
@ -21,16 +30,24 @@ $(distdir).tar.gz: $(distdir)
rm -rf $(distdir) rm -rf $(distdir)
$(distdir): include/qmckl.h include/qmckl_f.f90 src/Makefile.generated FORCE $(distdir): $(qmckl_h) $(qmckl_f) $(static_lib) $(shared_lib) src/Makefile.generated doc FORCE
mkdir -p $(distdir) mkdir -p $(distdir)
mkdir -p $(distdir)/munit mkdir -p $(distdir)/munit
mkdir -p $(distdir)/src mkdir -p $(distdir)/src
mkdir -p $(distdir)/include mkdir -p $(distdir)/include
cp munit/munit.h munit/munit.c $(distdir)/munit mkdir -p $(distdir)/share/qmckl/fortran
cp src/*.c src/*.h src/*.f90 $(distdir)/src mkdir -p $(distdir)/share/qmckl/doc/html/
mkdir -p $(distdir)/share/qmckl/doc/text/
mkdir -p $(distdir)/man
cp munit/munit.h munit/munit.c $(distdir)/munit/
cp src/*.c src/*.h src/*.f90 $(distdir)/src/
cp src/Makefile.generated $(distdir)/src/Makefile cp src/Makefile.generated $(distdir)/src/Makefile
cp include/* $(distdir)/include cp include/* $(distdir)/include
cp Makefile $(distdir)/ cp Makefile $(distdir)/
cp docs/*.html $(distdir)/share/qmckl/doc/html/
cp docs/*.css $(distdir)/share/qmckl/doc/html/
cp docs/*.txt $(distdir)/share/qmckl/doc/text/
cp share/qmckl/fortran/* $(distdir)/share/qmckl/fortran
mkdir -p $(distdir)/lib mkdir -p $(distdir)/lib
@ -49,9 +66,9 @@ distcheck: $(distdir).tar.gz
@echo "*** Package $(distdir).tar.gz is ready for distribution." @echo "*** Package $(distdir).tar.gz is ready for distribution."
include/qmckl.h include/qmckl_f.f90 src/Makefile.generated: $(qmckl_h) $(qmckl_f) $(static_lib) $(shared_lib) src/Makefile.generated:
$(MAKE) -C src $(MAKE) -C src $@
.PHONY: all clean dist FORCE .PHONY: all clean dist doc install uninstall FORCE

1
docs/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.txt

0
man/.gitignore vendored Normal file
View File

1
share/qmckl/fortran/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
qmckl_f.f90

View File

@ -18,7 +18,7 @@ QMCKL_ROOT=$(shell dirname $(CURDIR))
shared_lib=$(QMCKL_ROOT)/lib/libqmckl.so shared_lib=$(QMCKL_ROOT)/lib/libqmckl.so
static_lib=$(QMCKL_ROOT)/lib/libqmckl.a static_lib=$(QMCKL_ROOT)/lib/libqmckl.a
qmckl_h=$(QMCKL_ROOT)/include/qmckl.h qmckl_h=$(QMCKL_ROOT)/include/qmckl.h
qmckl_f=$(QMCKL_ROOT)/include/qmckl_f.f90 qmckl_f=$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
@ -92,18 +92,18 @@ endif
# The Makefile.generated is the one that will be distributed with the library. # The Makefile.generated is the one that will be distributed with the library.
.PHONY: clean shared static doc all check .PHONY: clean shared static doc all check install uninstall
.SECONDARY: # Needed to keep the produced C and Fortran files .SECONDARY: # Needed to keep the produced C and Fortran files
$(shared_lib) $(static_lib): $(qmckl_h) $(qmckl_f) Makefile.generated $(shared_lib) $(static_lib) install uninstall: $(qmckl_h) $(qmckl_f) Makefile.generated
$(MAKE) -f Makefile.generated $@ $(MAKE) -f Makefile.generated $@
$(qmckl_f) $(qmckl_h): Makefile.generated $(qmckl_f) $(qmckl_h): Makefile.generated
../tools/build_qmckl_h.sh $(QMCKL_ROOT)/tools/build_qmckl_h.sh
shared: $(shared_lib) shared: $(shared_lib)
static: $(static_lib) static: $(static_lib)
all: shared static doc all: shared static doc check
check: $(static_lib) check: $(static_lib)
$(MAKE) -f Makefile.generated check $(MAKE) -f Makefile.generated check
@ -125,5 +125,4 @@ Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURC
.SUFFIXES: .org .c .SUFFIXES: .org .c
.org.c: .org.c:
../tools/tangle.sh $< $(QMCKL_ROOT)/tools/tangle.sh $<

View File

@ -2,19 +2,19 @@
#+PROPERTY: comments org #+PROPERTY: comments org
#+SETUPFILE: ../docs/theme.setup #+SETUPFILE: ../docs/theme.setup
# -*- mode: org -*- # -*- mode: org -*-
* Using QMCkl * Using QMCkl
The =qmckl.h= header file has to be included in C codes when The =qmckl.h= header file installed in the =${prefix}/include= directory
QMCkl functions are used: has to be included in C codes when QMCkl functions are used:
#+begin_src c :tangle no #+begin_src c :tangle no
#include "qmckl.h" #include "qmckl.h"
#+end_src #+end_src
In Fortran programs, the =qmckl_f.f90= interface file should be In Fortran programs, the =qmckl_f.f90= installed in
included in the source code using the library, and the Fortran codes =${prefix}/share/qmckl/fortran= interface file should be copied in the source
should use the ~qmckl~ module as code using the library, and the Fortran codes should use the ~qmckl~ module as
#+begin_src f90 :tangle no #+begin_src f90 :tangle no
use qmckl use qmckl
@ -23,7 +23,7 @@ use qmckl
Both files are located in the =include/= directory. Both files are located in the =include/= directory.
* Developing in QMCkl * Developing in QMCkl
** Literate programming ** Literate programming
In a traditional source code, most of the lines of source files of a program In a traditional source code, most of the lines of source files of a program
@ -115,7 +115,7 @@ Both files are located in the =include/= directory.
[[http://fortranwiki.org/fortran/show/Generating+C+Interfaces][this link]]. [[http://fortranwiki.org/fortran/show/Generating+C+Interfaces][this link]].
** Coding rules ** Coding rules
The authors should follow the recommendations of the C99 The authors should follow the recommendations of the C99
[[https://wiki.sei.cmu.edu/confluence/display/c/SEI+CERT+C+Coding+Standard][SEI+CERT C Coding Standard]]. [[https://wiki.sei.cmu.edu/confluence/display/c/SEI+CERT+C+Coding+Standard][SEI+CERT C Coding Standard]].
@ -186,7 +186,7 @@ cppcheck --addon=cert --enable=all *.c &> cppcheck.out
The internal structure of the context is not specified, to give a The internal structure of the context is not specified, to give a
maximum of freedom to the different implementations. Modifying maximum of freedom to the different implementations. Modifying
the state is done by setters and getters, prefixed by the state is done by setters and getters, prefixed by
=qmckl_set_= an =qmckl_get_=. =qmckl_set_= an =qmckl_get_=.
** Headers ** Headers
@ -222,7 +222,7 @@ cppcheck --addon=cert --enable=all *.c &> cppcheck.out
| =*_private_func.h= | Private | Function definitions | | =*_private_func.h= | Private | Function definitions |
| =*fh_type.f90= | Public | Fortran type definitions | | =*fh_type.f90= | Public | Fortran type definitions |
| =*fh_func.f90= | Public | Fortran function definitions | | =*fh_func.f90= | Public | Fortran function definitions |
** Low-level functions ** Low-level functions
Low-level functions are very simple functions which are leaves of Low-level functions are very simple functions which are leaves of

View File

@ -898,7 +898,7 @@ munit_assert(qmckl_ao_basis_provided(context));
| double | P[n][ldp] | out | Array containing all the powers of ~X~ | | double | P[n][ldp] | out | Array containing all the powers of ~X~ |
| int64_t | ldp | in | Leading dimension of array ~P~ | | int64_t | ldp | in | Leading dimension of array ~P~ |
*** Requirements: *** Requirements
- ~context~ is not ~QMCKL_NULL_CONTEXT~ - ~context~ is not ~QMCKL_NULL_CONTEXT~
- ~n~ > 0 - ~n~ > 0
@ -1124,7 +1124,7 @@ munit_assert_int(0, ==, test_qmckl_ao_power(context));
| double | VGL[n][ldv] | out | Value, gradients and Laplacian of the polynomials | | double | VGL[n][ldv] | out | Value, gradients and Laplacian of the polynomials |
| int64_t | ldv | in | Leading dimension of array ~VGL~ | | int64_t | ldv | in | Leading dimension of array ~VGL~ |
*** Requirements: *** Requirements
- ~context~ is not ~QMCKL_NULL_CONTEXT~ - ~context~ is not ~QMCKL_NULL_CONTEXT~
- ~n~ > 0 - ~n~ > 0
@ -1470,7 +1470,7 @@ munit_assert_int(0, ==, test_qmckl_ao_polynomial_vgl(context));
| ~VGL(ldv,5)~ | output | Value, gradients and Laplacian of the Gaussians | | ~VGL(ldv,5)~ | output | Value, gradients and Laplacian of the Gaussians |
| ~ldv~ | input | Leading dimension of array ~VGL~ | | ~ldv~ | input | Leading dimension of array ~VGL~ |
Requirements : Requirements
- ~context~ is not 0 - ~context~ is not 0
- ~n~ > 0 - ~n~ > 0

View File

@ -85,7 +85,7 @@ QMCKL_ROOT=$(shell dirname $(CURDIR))
shared_lib=$(QMCKL_ROOT)/lib/libqmckl.so shared_lib=$(QMCKL_ROOT)/lib/libqmckl.so
static_lib=$(QMCKL_ROOT)/lib/libqmckl.a static_lib=$(QMCKL_ROOT)/lib/libqmckl.a
qmckl_h=$(QMCKL_ROOT)/include/qmckl.h qmckl_h=$(QMCKL_ROOT)/include/qmckl.h
qmckl_f=$(QMCKL_ROOT)/include/qmckl_f.f90 qmckl_f=$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
@ -164,10 +164,10 @@ endif
The Makefile.generated is the one that will be distributed with the library. The Makefile.generated is the one that will be distributed with the library.
#+begin_src makefile #+begin_src makefile
.PHONY: clean shared static doc all check .PHONY: clean shared static doc all check install uninstall
.SECONDARY: # Needed to keep the produced C and Fortran files .SECONDARY: # Needed to keep the produced C and Fortran files
$(shared_lib) $(static_lib): $(qmckl_h) $(qmckl_f) Makefile.generated $(shared_lib) $(static_lib) install uninstall: $(qmckl_h) $(qmckl_f) Makefile.generated
$(MAKE) -f Makefile.generated $@ $(MAKE) -f Makefile.generated $@
$(qmckl_f) $(qmckl_h): Makefile.generated $(qmckl_f) $(qmckl_h): Makefile.generated
@ -175,7 +175,7 @@ $(qmckl_f) $(qmckl_h): Makefile.generated
shared: $(shared_lib) shared: $(shared_lib)
static: $(static_lib) static: $(static_lib)
all: shared static doc all: shared static doc check
check: $(static_lib) check: $(static_lib)
$(MAKE) -f Makefile.generated check $(MAKE) -f Makefile.generated check
@ -306,7 +306,7 @@ cat << EOF > ${OUTPUT}
.POSIX: .POSIX:
.SUFFIXES: .SUFFIXES:
PREFIX=/usr/local prefix=/usr/local
CC=$CC CC=$CC
CFLAGS=$CFLAGS -I../munit/ CFLAGS=$CFLAGS -I../munit/
@ -324,7 +324,7 @@ QMCKL_ROOT=\$(shell dirname \$(CURDIR))
shared_lib=\$(QMCKL_ROOT)/lib/libqmckl.so shared_lib=\$(QMCKL_ROOT)/lib/libqmckl.so
static_lib=\$(QMCKL_ROOT)/lib/libqmckl.a static_lib=\$(QMCKL_ROOT)/lib/libqmckl.a
qmckl_h=\$(QMCKL_ROOT)/include/qmckl.h qmckl_h=\$(QMCKL_ROOT)/include/qmckl.h
qmckl_f=\$(QMCKL_ROOT)/include/qmckl_f.f90 qmckl_f=\$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
munit=\$(QMCKL_ROOT)/munit/munit.c munit=\$(QMCKL_ROOT)/munit/munit.c
shared: \$(shared_lib) shared: \$(shared_lib)
@ -339,7 +339,7 @@ all: shared static
# Test # Test
qmckl_f.o: \$(qmckl_f) qmckl_f.o: \$(qmckl_f)
\$(FC) \$(FFLAGS) -c \$(qmckl_f) -o \$@ \$(FC) \$(FFLAGS) -c \$(qmckl_f) -o \$@
@ -357,6 +357,16 @@ check: test_qmckl test_qmckl_shared
clean: clean:
\$(RM) -- *.o *.mod \$(shared_lib) \$(static_lib) test_qmckl \$(RM) -- *.o *.mod \$(shared_lib) \$(static_lib) test_qmckl
install:
install -d \$(prefix)/lib
install -d \$(prefix)/include
install -d \$(prefix)/share/qmckl/fortran
install -d \$(prefix)/man
install \$(shared_lib) \$(prefix)/lib
install \$(static_lib) \$(prefix)/lib
install \$(qmckl_h) \$(prefix)/include
install \$(qmckl_f) \$(prefix)/share/qmckl/fortran
.SUFFIXES: .c .f90 .o .SUFFIXES: .c .f90 .o
.c.o: .c.o:
@ -428,6 +438,7 @@ cat << EOF > ${OUTPUT}
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
EOF EOF
for i in ${HEADERS} for i in ${HEADERS}
@ -448,7 +459,7 @@ EOF
HEADERS_TYPE="qmckl_*_fh_type.f90" HEADERS_TYPE="qmckl_*_fh_type.f90"
HEADERS="qmckl_*_fh_func.f90" HEADERS="qmckl_*_fh_func.f90"
OUTPUT="../include/qmckl_f.f90" OUTPUT="../share/qmckl/fortran/qmckl_f.f90"
cat << EOF > ${OUTPUT} cat << EOF > ${OUTPUT}
! !
! <<qmckl-header>> ! <<qmckl-header>>

View File

@ -78,8 +78,8 @@ cat << EOF > ${OUTPUT}
* *
*/ */
#ifndef QMCKL_H #ifndef __QMCKL_H__
#define QMCKL_H #define __QMCKL_H__
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -105,7 +105,7 @@ EOF
HEADERS_TYPE="qmckl_*_fh_type.f90" HEADERS_TYPE="qmckl_*_fh_type.f90"
HEADERS="qmckl_*_fh_func.f90" HEADERS="qmckl_*_fh_func.f90"
OUTPUT="../include/qmckl_f.f90" OUTPUT="../share/qmckl/fortran/qmckl_f.f90"
cat << EOF > ${OUTPUT} cat << EOF > ${OUTPUT}
! !
! ------------------------------------------ ! ------------------------------------------

View File

@ -21,7 +21,7 @@ OUTPUT=Makefile.generated
${QMCKL_ROOT}/tools/tangle.sh *.org ${QMCKL_ROOT}/tools/tangle.sh *.org
../tools/build_qmckl_h.sh ${QMCKL_ROOT}/tools/build_qmckl_h.sh
@ -66,7 +66,7 @@ cat << EOF > ${OUTPUT}
.POSIX: .POSIX:
.SUFFIXES: .SUFFIXES:
PREFIX=/usr/local prefix=/usr/local
CC=$CC CC=$CC
CFLAGS=$CFLAGS -I../munit/ CFLAGS=$CFLAGS -I../munit/
@ -84,7 +84,7 @@ QMCKL_ROOT=\$(shell dirname \$(CURDIR))
shared_lib=\$(QMCKL_ROOT)/lib/libqmckl.so shared_lib=\$(QMCKL_ROOT)/lib/libqmckl.so
static_lib=\$(QMCKL_ROOT)/lib/libqmckl.a static_lib=\$(QMCKL_ROOT)/lib/libqmckl.a
qmckl_h=\$(QMCKL_ROOT)/include/qmckl.h qmckl_h=\$(QMCKL_ROOT)/include/qmckl.h
qmckl_f=\$(QMCKL_ROOT)/include/qmckl_f.f90 qmckl_f=\$(QMCKL_ROOT)/share/qmckl/fortran/qmckl_f.f90
munit=\$(QMCKL_ROOT)/munit/munit.c munit=\$(QMCKL_ROOT)/munit/munit.c
shared: \$(shared_lib) shared: \$(shared_lib)
@ -99,7 +99,7 @@ all: shared static
# Test # Test
qmckl_f.o: \$(qmckl_f) qmckl_f.o: \$(qmckl_f)
\$(FC) \$(FFLAGS) -c \$(qmckl_f) -o \$@ \$(FC) \$(FFLAGS) -c \$(qmckl_f) -o \$@
@ -108,7 +108,7 @@ test_qmckl: test_qmckl.c \$(qmckl_h) \$(static_lib) \$(TESTS) \$(TESTS_F)
\$(munit) \$(TESTS) \$(TESTS_F) \$(static_lib) \$(LIBS) test_qmckl.c -o \$@ \$(munit) \$(TESTS) \$(TESTS_F) \$(static_lib) \$(LIBS) test_qmckl.c -o \$@
test_qmckl_shared: test_qmckl.c \$(qmckl_h) \$(shared_lib) \$(TESTS) \$(TESTS_F) test_qmckl_shared: test_qmckl.c \$(qmckl_h) \$(shared_lib) \$(TESTS) \$(TESTS_F)
\$(CC) \$(CFLAGS) -Wl,-rpath,$PWD/../lib -L../lib \ \$(CC) \$(CFLAGS) -Wl,-rpath,\$(QMCKL_ROOT)/lib -L\$(QMCKL_ROOT)/lib \
\$(munit) \$(TESTS) \$(TESTS_F) -lqmckl \$(LIBS) test_qmckl.c -o \$@ \$(munit) \$(TESTS) \$(TESTS_F) -lqmckl \$(LIBS) test_qmckl.c -o \$@
check: test_qmckl test_qmckl_shared check: test_qmckl test_qmckl_shared
@ -117,6 +117,16 @@ check: test_qmckl test_qmckl_shared
clean: clean:
\$(RM) -- *.o *.mod \$(shared_lib) \$(static_lib) test_qmckl \$(RM) -- *.o *.mod \$(shared_lib) \$(static_lib) test_qmckl
install:
install -d \$(prefix)/lib
install -d \$(prefix)/include
install -d \$(prefix)/share/qmckl/fortran
install -d \$(prefix)/man
install \$(shared_lib) \$(prefix)/lib
install \$(static_lib) \$(prefix)/lib
install \$(qmckl_h) \$(prefix)/include
install \$(qmckl_f) \$(prefix)/share/qmckl/fortran
.SUFFIXES: .c .f90 .o .SUFFIXES: .c .f90 .o
.c.o: .c.o: