diff --git a/src/Makefile b/src/Makefile index 042c095..8b52a4b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,7 +20,7 @@ OBJECT_FILES=$(filter-out $(EXCLUDED_OBJECTS), $(patsubst %.org,%.o,$(ORG_SOURCE INCLUDE=-I$(QMCKL_ROOT)/include/ # Compiler options - + # GNU, Intel and LLVM compilers are supported. Choose here: @@ -42,14 +42,14 @@ FFLAGS=-fPIC $(INCLUDE) \ -fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising \ -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation \ -Wreal-q-constant -Wuninitialized -fbacktrace -finit-real=nan \ - -ffpe-trap=zero,overflow,underflow + -ffpe-trap=zero,overflow,underflow -LIBS+=-lgfortran -lm +LIBS+=-lgfortran -lm #---------------------------------------------------------- endif # Intel - + ifeq ($(COMPILER),INTEL) #---------------------------------------------------------- @@ -65,7 +65,7 @@ CC=icc -xHost endif # LLVM - + ifeq ($(COMPILER),LLVM) #---------------------------------------------------------- @@ -87,7 +87,7 @@ endif .PHONY: clean .SECONDARY: # Needed to keep the produced C and Fortran files -libqmckl.so: Makefile.generated +libqmckl.so: Makefile.generated $(MAKE) -f Makefile.generated ../include/qmckl.h: libqmckl.so @@ -97,7 +97,7 @@ test: Makefile.generated ../include/qmckl.h $(MAKE) -f Makefile.generated test doc: $(ORG_SOURCE_FILES) - $(QMCKL_ROOT)/tools/create_doc.sh + $(QMCKL_ROOT)/tools/build_doc.sh clean: $(RM) test_qmckl_* test_qmckl.c test_qmckl \ diff --git a/src/test_qmckl.org b/src/test_qmckl.org index cc72999..fe8e3a4 100644 --- a/src/test_qmckl.org +++ b/src/test_qmckl.org @@ -65,9 +65,9 @@ echo "#+end_src" #+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_distance", test_qmckl_distance, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, -// { (char*) "test_qmckl_ao", test_qmckl_ao, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, + { (char*) "test_qmckl_memory", test_qmckl_memory, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, + { (char*) "test_qmckl_distance", test_qmckl_distance, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, + { (char*) "test_qmckl_ao", test_qmckl_ao, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, #+end_src :end: diff --git a/tools/Building.org b/tools/Building.org index 8443b82..200ef08 100644 --- a/tools/Building.org +++ b/tools/Building.org @@ -10,9 +10,9 @@ echo "This file was created by tools/Building.org" #+NAME: check-src #+begin_src bash -if [[ $(basename $PWD) != "src" ]] ; then - echo "This script needs to be run in the src directory" - exit -1 +if [[ $(basename ${PWD}) != "src" ]] ; then + echo "This script needs to be run in the src directory" + exit -1 fi #+end_src @@ -200,22 +200,26 @@ Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURC The file is not tangled if the last modification date of the org file is less recent than one of the tangled files. + #+begin_src bash function tangle() { - if [[ -f ${1%.org}.c && $1 -ot ${1%.org}.c ]] - then return - elif [[ -f ${1%.org}.f90 && $1 -ot ${1%.org}.f90 ]] - then return - fi - emacs --batch $1 --load=../tools/config_tangle.el -f org-babel-tangle -} + local org_file=$1 + local c_file=${org_file%.org}.c + local f_file=${org_file%.org}.f90 + if [[ ${org_file} -ot ${c_file} ]] ; then + return + elif [[ ${org_file} -ot ${f_file} ]] ; then + return + fi + emacs --batch ${org_file} --load=../tools/config_tangle.el -f org-babel-tangle +} for i in $@ do - echo "--- $i ----" - tangle $i + echo "--- ${i} ----" + tangle ${i} done #+end_src @@ -247,14 +251,9 @@ ${QMCKL_ROOT}/tools/tangle.sh *.org #+begin_src bash OBJECTS="qmckl_f.o" -for i in $(ls qmckl_*.c) ; do - FILE=${i%.c} - OBJECTS="${OBJECTS} ${FILE}.o" -done >> $OUTPUT - -for i in $(ls qmckl*_f.f90) ; do - FILE=${i%.f90} - OBJECTS="${OBJECTS} ${FILE}.o" +for i in $(ls qmckl_*.c qmckl_*f.f90) ; do + FILE=${i%.*} + OBJECTS+=" ${FILE}.o" done >> $OUTPUT #+end_src @@ -263,8 +262,8 @@ done >> $OUTPUT #+begin_src bash TESTS="" for i in $(ls test_qmckl_*.c) ; do - FILE=${i%.c}.o - TESTS="${TESTS} ${FILE}" + FILE=${i%.c} + TESTS+=" ${FILE}.o" done >> $OUTPUT #+end_src @@ -273,8 +272,8 @@ done >> $OUTPUT #+begin_src bash TESTS_F="" for i in $(ls test_qmckl_*_f.f90) ; do - FILE=${i%.f90}.o - TESTS_F="${TESTS_F} ${FILE}" + FILE=${i%.f90} + TESTS_F+=" ${FILE}.o" done >> $OUTPUT #+end_src diff --git a/tools/build_qmckl_h.sh b/tools/build_qmckl_h.sh index 03396f3..78f2665 100755 --- a/tools/build_qmckl_h.sh +++ b/tools/build_qmckl_h.sh @@ -69,7 +69,7 @@ cat << EOF > ${OUTPUT} * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * - * + * * */ @@ -139,7 +139,7 @@ cat << EOF > ${OUTPUT} ! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ! ! -! +! ! ! module qmckl diff --git a/tools/config_tangle.el b/tools/config_tangle.el index 53ca152..73b613d 100755 --- a/tools/config_tangle.el +++ b/tools/config_tangle.el @@ -14,7 +14,6 @@ ("gnu" . 10))) -(require 'htmlize) (require 'font-lock) (setq org-confirm-babel-evaluate nil) (global-font-lock-mode t) diff --git a/tools/create_makefile.sh b/tools/create_makefile.sh index e134089..209857c 100755 --- a/tools/create_makefile.sh +++ b/tools/create_makefile.sh @@ -7,7 +7,7 @@ # This script generates the Makefile that compiles the library. # The ~OUTPUT~ variable contains the name of the generated Makefile,typically # =Makefile.generated=. - + # This file was created by tools/Building.org @@ -29,14 +29,9 @@ ${QMCKL_ROOT}/tools/tangle.sh *.org OBJECTS="qmckl_f.o" -for i in $(ls qmckl_*.c) ; do - FILE=${i%.c} - OBJECTS="${OBJECTS} ${FILE}.o" -done >> $OUTPUT - -for i in $(ls qmckl*_f.f90) ; do - FILE=${i%.f90} - OBJECTS="${OBJECTS} ${FILE}.o" +for i in $(ls qmckl_*.c qmckl_*f.f90) ; do + FILE=${i%.*} + OBJECTS+=" ${FILE}.o" done >> $OUTPUT @@ -46,8 +41,8 @@ done >> $OUTPUT TESTS="" for i in $(ls test_qmckl_*.c) ; do - FILE=${i%.c}.o - TESTS="${TESTS} ${FILE}" + FILE=${i%.c} + TESTS+=" ${FILE}.o" done >> $OUTPUT @@ -57,8 +52,8 @@ done >> $OUTPUT TESTS_F="" for i in $(ls test_qmckl_*_f.f90) ; do - FILE=${i%.f90}.o - TESTS_F="${TESTS_F} ${FILE}" + FILE=${i%.f90} + TESTS_F+=" ${FILE}.o" done >> $OUTPUT @@ -68,7 +63,7 @@ done >> $OUTPUT cat << EOF > ${OUTPUT} CC=$CC -CFLAGS=$CFLAGS -I../munit/ +CFLAGS=$CFLAGS -I../munit/ FC=$FC FFLAGS=$FFLAGS @@ -80,8 +75,8 @@ LIBS=$LIBS libqmckl.so: \$(OBJECT_FILES) \$(CC) -shared \$(OBJECT_FILES) -o libqmckl.so - -%.o: %.c + +%.o: %.c \$(CC) \$(CFLAGS) -c \$*.c -o \$*.o %.o: %.f90 qmckl_f.o diff --git a/tools/tangle.sh b/tools/tangle.sh index 0250ec4..1615465 100755 --- a/tools/tangle.sh +++ b/tools/tangle.sh @@ -19,19 +19,23 @@ # The file is not tangled if the last modification date of the org # file is less recent than one of the tangled files. + function tangle() { - if [[ -f ${1%.org}.c && $1 -ot ${1%.org}.c ]] - then return - elif [[ -f ${1%.org}.f90 && $1 -ot ${1%.org}.f90 ]] - then return - fi - emacs --batch $1 --load=../tools/config_tangle.el -f org-babel-tangle -} + local org_file=$1 + local c_file=${org_file%.org}.c + local f_file=${org_file%.org}.f90 + if [[ ${org_file} -ot ${c_file} ]] ; then + return + elif [[ ${org_file} -ot ${f_file} ]] ; then + return + fi + emacs --batch ${org_file} --load=../tools/config_tangle.el -f org-babel-tangle +} for i in $@ do - echo "--- $i ----" - tangle $i + echo "--- ${i} ----" + tangle ${i} done