From 4adcfa1df47d1c6bae683771fac6981d625fbdef Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 12 May 2021 00:22:51 +0200 Subject: [PATCH] Complete build OK --- .gitignore | 2 + Makefile.am | 23 ++++-- Makefile.dev.mk | 23 +++++- configure.ac | 2 +- org/.gitignore | 1 + qmckl.pc.in => pkgconfig/qmckl.pc.in | 0 tools/build_doc.sh | 118 ++++++--------------------- tools/build_makefile.sh | 27 +++++- tools/install_htmlize.sh | 9 ++ 9 files changed, 103 insertions(+), 102 deletions(-) rename qmckl.pc.in => pkgconfig/qmckl.pc.in (100%) create mode 100755 tools/install_htmlize.sh diff --git a/.gitignore b/.gitignore index 2e94e5e..96b7a1b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ test-driver .dirstamp *.la *.lo +qmckl-*.tar.gz +qmckl.mod diff --git a/Makefile.am b/Makefile.am index e739375..38a4a5f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,15 +39,16 @@ VERSION_PATCH = @VERSION_PATCH@ SUBDIRS = CLEANFILES = +EXTRA_DIST = pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = $(srcdir)/qmckl.pc +pkgconfig_DATA = pkgconfig/qmckl.pc qmckl_h = $(srcdir)/include/qmckl.h include_HEADERS = $(qmckl_h) -qmckl_f = $(srcdir)/share/qmckl/fortran/qmckl_f.f90 -qmckl_fo = $(srcdir)/share/qmckl/fortran/qmckl_f.$(OBJEXT) +qmckl_f = share/qmckl/fortran/qmckl_f.f90 +qmckl_fo = share/qmckl/fortran/qmckl_f.$(OBJEXT) test_qmckl_f = $(srcdir)/tests/qmckl_f.f90 src_qmckl_f = $(srcdir)/src/qmckl_f.f90 @@ -55,14 +56,15 @@ fortrandir = $(datadir)/$(PACKAGE_NAME)/fortran/ fortran_DATA = $(qmckl_f) AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include -EXTRA_DIST = share/doc/qmckl/ lib_LTLIBRARIES = src/libqmckl.la src_libqmckl_la_SOURCES = $(qmckl_h) $(src_qmckl_f) $(C_FILES) $(F_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES) export srcdir qmckl_f qmckl_h -CLEANFILES+=$(test_qmckl_f) +CLEANFILES+=$(test_qmckl_f) $(src_qmckl_f) $(qmckl_h) $(qmckl_f) + +htmlize_el=$(srcdir)/share/doc/qmckl/html/htmlize.el include $(srcdir)/generated.mk @@ -72,6 +74,13 @@ else include Makefile.dist.mk endif + +htmldir = $(docdir)/html +html_DATA = $(HTML_FILES) $(htmlize_el) $(srcdir)/share/doc/qmckl/html/index.html + +textdir = $(docdir)/text +text_DATA = $(TEXT_FILES) + $(srcdir)/generated.mk: $(ORG_FILES) $(srcdir)/tools/build_makefile.sh @@ -81,6 +90,10 @@ $(test_qmckl_f): $(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 + rpms srcrpm: for dir in $(SUBDIRS); do \ (cd $$dir && $(MAKE) $(AM_MAKEFLAGS) $@) || exit 1; \ diff --git a/Makefile.dev.mk b/Makefile.dev.mk index 53ec8a6..7bfb7de 100644 --- a/Makefile.dev.mk +++ b/Makefile.dev.mk @@ -33,12 +33,30 @@ 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) + +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 $<"; @@ -59,5 +77,8 @@ $(qmckl_h): $(H_FUNC_FILES) $(H_TYPE_FILES) $(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 diff --git a/configure.ac b/configure.ac index 5dabe5d..c3c3bdc 100644 --- a/configure.ac +++ b/configure.ac @@ -204,7 +204,7 @@ AC_SUBST([PKG_LIBS]) AC_SUBST([PKG_CFLAGS]) AC_CONFIG_FILES([Makefile - qmckl.pc + pkgconfig/qmckl.pc ]) diff --git a/org/.gitignore b/org/.gitignore index 0e4e804..e0963f0 100644 --- a/org/.gitignore +++ b/org/.gitignore @@ -1 +1,2 @@ *.tangled +*.exported diff --git a/qmckl.pc.in b/pkgconfig/qmckl.pc.in similarity index 100% rename from qmckl.pc.in rename to pkgconfig/qmckl.pc.in diff --git a/tools/build_doc.sh b/tools/build_doc.sh index 77f5264..389e3f3 100755 --- a/tools/build_doc.sh +++ b/tools/build_doc.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Script to build the documentation. +# Extracts documentation from an org-mode file. set -e @@ -11,104 +11,34 @@ readonly HTMLIZE=${DOCS}/html/htmlize.el readonly CONFIG_DOC=${srcdir}/tools/config_doc.el readonly CONFIG_TANGLE=${srcdir}/tools/config_tangle.el -# Checks that all the defined global variables correspond to files. - -for dir in ${DOCS}/html ${DOCS}/text ${ORG} -do - if [[ ! -d ${dir} ]] - then - print "${dir} not found" - exit 2 - fi -done - -for file in ${CONFIG_DOC} ${CONFIG_TANGLE} -do - if [[ ! -f ${file} ]] - then - print "${file} not found" - exit 3 - fi -done - - - - -function install_htmlize() -{ -# Installs the htmlize Emacs plugin if the =htmlize.el= file is not present. - - local url="https://github.com/hniksic/emacs-htmlize" - local repo="emacs-htmlize" - - [[ -f ${HTMLIZE} ]] || ( - cd ${DOCS}/html - ${srcdir}/missing git clone ${url} \ - && cp ${repo}/htmlize.el ${HTMLIZE} \ - && rm -rf ${repo} - cd - - ) - - # Assert htmlize is installed - [[ -f ${HTMLIZE} ]] \ - || exit 1 -} - - - function extract_doc() { -# Extracts documentation from an org-mode file. + org=$1 + local_html=${org%.org}.html + local_text=${org%.org}.txt + html=${DOCS}/html/$(basename ${org%.org}.html) + text=${DOCS}/text/$(basename ${org%.org}.txt) - local org=$1 - local local_html=${ORG}/${org%.org}.html - local local_text=${ORG}/${org%.org}.txt - local html=${DOCS}/html/${org%.org}.html - local text=${DOCS}/text/${org%.org}.txt - - if [[ -f ${html} && ${org} -ot ${html} ]] - then - return - fi - ${srcdir}/missing emacs --batch \ - --load ${HTMLIZE} \ - --load ${CONFIG_DOC} \ - ${org} \ - --load ${CONFIG_TANGLE} \ - -f org-html-export-to-html \ - -f org-ascii-export-to-ascii - mv ${local_html} ${DOCS}/html - mv ${local_text} ${DOCS}/text + ./missing emacs --batch \ + --load ${HTMLIZE} \ + --load ${CONFIG_DOC} \ + ${org} \ + --load ${CONFIG_TANGLE} \ + -f org-html-export-to-html \ + -f org-ascii-export-to-ascii + mv ${local_html} ${html} + mv ${local_text} ${text} } +for i in $@ +do + exported=${i%.org}.exported + NOW=$(date +"%m%d%H%M.%S") + extract_doc ${i} &> $exported + + # Make log file older than the exported files + touch -t ${NOW} $exported +done - -function main() { - - # Install htmlize if needed - install_htmlize || exit 2 - - # Create documentation - cd ${ORG} \ - || exit 3 - - for i in *.org - do - echo "======= ${i} =======" - extract_doc ${i} - done - - if [[ $? -eq 0 ]] - then - cd ${DOCS}/html - rm -f index.html - ln README.html index.html - exit 0 - else - exit 3 - fi - -} -main diff --git a/tools/build_makefile.sh b/tools/build_makefile.sh index bf0e546..1188e6d 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 DEPS_TEST TESTS + declare -A DEPS DEPS_ORG DEPS_TEST TESTS HTML TEXT DEPS_DOC C_FILES= F_FILES= @@ -32,11 +32,14 @@ function make_src() for org in org/*.org ; do i=$(basename ${org%.org}) 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="\$(srcdir)/tests/test_${i}.c" f_test="\$(srcdir)/tests/test_${i}_f.f90" + html="\$(srcdir)/share/doc/qmckl/html/${i}.html" + text="\$(srcdir)/share/doc/qmckl/text/${i}.txt" i="\$(srcdir)/src/${i}" @@ -53,7 +56,11 @@ function make_src() ORG_FILES+="\$(srcdir)/$org " TANGLED_FILES+="$tangled " + EXPORTED_FILES+="$exported " DEPS_ORG["\$(srcdir)/$org"]=$tangled + DEPS_DOC["\$(srcdir)/$org"]=$exported + TEXT["\$(srcdir)/$org"]=$text + HTML["\$(srcdir)/$org"]=$html grep -q "(eval c)" $org if [[ $? -eq 0 ]] ; then @@ -129,6 +136,7 @@ function make_src() echo echo "ORG_FILES=${ORG_FILES}" echo "TANGLED_FILES=${TANGLED_FILES}" + echo "EXPORTED_FILES=${EXPORTED_FILES}" echo "C_FILES=${C_FILES}" echo "F_FILES=${F_FILES}" echo "C_O_FILES=${C_O_FILES}" @@ -142,6 +150,8 @@ function make_src() echo "C_TEST_FILES=${C_TEST_FILES}" echo "F_TEST_FILES=${F_TEST_FILES}" echo "TESTS=${!TESTS[@]}" | sed "s|\$(srcdir)/||g" + echo "HTML_FILES"=${HTML[@]} + echo "TEXT_FILES"=${TEXT[@]} echo echo @@ -172,7 +182,22 @@ function make_src() for f in ${!TESTS[@]} ; do echo "tests_$(basename $f)_SOURCES = ${TESTS[$f]}" #| sed "s|\$(srcdir)/||" echo "tests_$(basename $f)_LDADD = src/libqmckl.la" + echo "tests_$(basename $f)_LDFLAGS = -no-install" done | sort + + echo + echo "## Documentation" + echo + for f in ${ORG_FILES} ; do + echo "${HTML[$f]}: ${DEPS_DOC[$f]} \$(htmlize_el)" + echo "${TEXT[$f]}: ${DEPS_DOC[$f]}" + echo "" + done + for f in ${!DEPS_DOC[@]} ; do + echo "${DEPS_DOC[$f]}: $f" + echo " \$(export_verbose)\$(srcdir)/tools/build_doc.sh $f" + echo "" + done } diff --git a/tools/install_htmlize.sh b/tools/install_htmlize.sh new file mode 100755 index 0000000..29f8208 --- /dev/null +++ b/tools/install_htmlize.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# +# Installs the htmlize Emacs plugin + +./missing git clone "https://github.com/hniksic/emacs-htmlize" +mv emacs-htmlize/htmlize.el $1 +rm -rf emacs-htmlize + +