mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-08-24 22:21:46 +02:00
Cleaned Makefiles
This commit is contained in:
parent
afd3f6ae7a
commit
3618cde7b1
2
.github/workflows/test-build.yml
vendored
2
.github/workflows/test-build.yml
vendored
@ -37,4 +37,4 @@ jobs:
|
|||||||
git submodule sync
|
git submodule sync
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
- name: make
|
- name: make
|
||||||
run: make -C src/ test
|
run: make -C src/ check
|
||||||
|
41
src/Makefile
41
src/Makefile
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
# This file was created by tools/Building.org
|
# This file was created by tools/Building.org
|
||||||
|
|
||||||
|
.POSIX:
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
|
|
||||||
|
|
||||||
@ -13,10 +15,15 @@ LIBS=-lpthread
|
|||||||
|
|
||||||
QMCKL_ROOT=$(shell dirname $(CURDIR))
|
QMCKL_ROOT=$(shell dirname $(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)/include/qmckl_f.f90
|
||||||
|
|
||||||
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
|
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
|
||||||
|
|
||||||
ORG_SOURCE_FILES=$(wildcard *.org)
|
ORG_SOURCE_FILES=$(wildcard *.org)
|
||||||
OBJECT_FILES=$(filter-out $(EXCLUDED_OBJECTS), $(patsubst %.org,%.o,$(ORG_SOURCE_FILES)))
|
C_SOURCE_FILES=$(patsubst %.org,%.c,$(ORG_SOURCE_FILES))
|
||||||
INCLUDE=-I$(QMCKL_ROOT)/include/
|
INCLUDE=-I$(QMCKL_ROOT)/include/
|
||||||
|
|
||||||
# Compiler options
|
# Compiler options
|
||||||
@ -82,27 +89,41 @@ endif
|
|||||||
# Rules
|
# Rules
|
||||||
|
|
||||||
# The source files are created during the generation of the file ~Makefile.generated~.
|
# The source files are created during the generation of the file ~Makefile.generated~.
|
||||||
|
# The Makefile.generated is the one that will be distributed with the library.
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean shared static doc all check
|
||||||
.SECONDARY: # Needed to keep the produced C and Fortran files
|
.SECONDARY: # Needed to keep the produced C and Fortran files
|
||||||
|
|
||||||
libqmckl.so: ../include/qmckl.h
|
$(shared_lib) $(static_lib): $(qmckl_h) $(qmckl_f) Makefile.generated
|
||||||
$(MAKE) -f Makefile.generated
|
$(MAKE) -f Makefile.generated $@
|
||||||
|
|
||||||
../include/qmckl.h: Makefile.generated
|
$(qmckl_f) $(qmckl_h): Makefile.generated
|
||||||
../tools/build_qmckl_h.sh
|
../tools/build_qmckl_h.sh
|
||||||
|
|
||||||
test: libqmckl.so
|
shared: $(shared_lib)
|
||||||
$(MAKE) -f Makefile.generated test
|
static: $(static_lib)
|
||||||
|
all: shared static doc
|
||||||
|
|
||||||
|
check: $(static_lib)
|
||||||
|
$(MAKE) -f Makefile.generated check
|
||||||
|
|
||||||
doc: $(ORG_SOURCE_FILES)
|
doc: $(ORG_SOURCE_FILES)
|
||||||
$(QMCKL_ROOT)/tools/build_doc.sh
|
$(QMCKL_ROOT)/tools/build_doc.sh
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) test_qmckl_* test_qmckl.c test_qmckl \
|
- $(MAKE) -f Makefile.generated clean
|
||||||
qmckl_*.f90 qmckl_*.c qmckl_*.o qmckl_*.h \
|
- $(RM) test_qmckl_* test_qmckl.c \
|
||||||
Makefile.generated libqmckl.so *.html *.mod
|
$(qmckl_h) $(qmckl_f) \
|
||||||
|
qmckl_*.f90 qmckl_*.c qmckl_*.h \
|
||||||
|
Makefile.generated *.html
|
||||||
|
|
||||||
Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES)
|
Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES)
|
||||||
$(QMCKL_ROOT)/tools/create_makefile.sh
|
$(QMCKL_ROOT)/tools/create_makefile.sh
|
||||||
|
|
||||||
|
|
||||||
|
.SUFFIXES: .org .c
|
||||||
|
|
||||||
|
.org.c:
|
||||||
|
../tools/tangle.sh $<
|
||||||
|
|
||||||
|
@ -68,6 +68,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
#+begin_src makefile
|
#+begin_src makefile
|
||||||
# <<header()>>
|
# <<header()>>
|
||||||
|
|
||||||
|
.POSIX:
|
||||||
#+end_src
|
#+end_src
|
||||||
** Dependencies
|
** Dependencies
|
||||||
|
|
||||||
@ -80,10 +82,15 @@ LIBS=-lpthread
|
|||||||
#+begin_src makefile
|
#+begin_src makefile
|
||||||
QMCKL_ROOT=$(shell dirname $(CURDIR))
|
QMCKL_ROOT=$(shell dirname $(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)/include/qmckl_f.f90
|
||||||
|
|
||||||
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
|
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
|
||||||
|
|
||||||
ORG_SOURCE_FILES=$(wildcard *.org)
|
ORG_SOURCE_FILES=$(wildcard *.org)
|
||||||
OBJECT_FILES=$(filter-out $(EXCLUDED_OBJECTS), $(patsubst %.org,%.o,$(ORG_SOURCE_FILES)))
|
C_SOURCE_FILES=$(patsubst %.org,%.c,$(ORG_SOURCE_FILES))
|
||||||
INCLUDE=-I$(QMCKL_ROOT)/include/
|
INCLUDE=-I$(QMCKL_ROOT)/include/
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
@ -154,30 +161,44 @@ endif
|
|||||||
** Rules
|
** Rules
|
||||||
|
|
||||||
The source files are created during the generation of the file ~Makefile.generated~.
|
The source files are created during the generation of the file ~Makefile.generated~.
|
||||||
|
The Makefile.generated is the one that will be distributed with the library.
|
||||||
|
|
||||||
#+begin_src makefile
|
#+begin_src makefile
|
||||||
.PHONY: clean
|
.PHONY: clean shared static doc all check
|
||||||
.SECONDARY: # Needed to keep the produced C and Fortran files
|
.SECONDARY: # Needed to keep the produced C and Fortran files
|
||||||
|
|
||||||
libqmckl.so: ../include/qmckl.h
|
$(shared_lib) $(static_lib): $(qmckl_h) $(qmckl_f) Makefile.generated
|
||||||
$(MAKE) -f Makefile.generated
|
$(MAKE) -f Makefile.generated $@
|
||||||
|
|
||||||
../include/qmckl.h: Makefile.generated
|
$(qmckl_f) $(qmckl_h): Makefile.generated
|
||||||
../tools/build_qmckl_h.sh
|
$(QMCKL_ROOT)/tools/build_qmckl_h.sh
|
||||||
|
|
||||||
test: libqmckl.so
|
shared: $(shared_lib)
|
||||||
$(MAKE) -f Makefile.generated test
|
static: $(static_lib)
|
||||||
|
all: shared static doc
|
||||||
|
|
||||||
|
check: $(static_lib)
|
||||||
|
$(MAKE) -f Makefile.generated check
|
||||||
|
|
||||||
doc: $(ORG_SOURCE_FILES)
|
doc: $(ORG_SOURCE_FILES)
|
||||||
$(QMCKL_ROOT)/tools/build_doc.sh
|
$(QMCKL_ROOT)/tools/build_doc.sh
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) test_qmckl_* test_qmckl.c test_qmckl \
|
- $(MAKE) -f Makefile.generated clean
|
||||||
qmckl_*.f90 qmckl_*.c qmckl_*.o qmckl_*.h \
|
- $(RM) test_qmckl_* test_qmckl.c \
|
||||||
Makefile.generated libqmckl.so *.html *.mod
|
$(qmckl_h) $(qmckl_f) \
|
||||||
|
qmckl_*.f90 qmckl_*.c qmckl_*.h \
|
||||||
|
Makefile.generated *.html
|
||||||
|
|
||||||
Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES)
|
Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES)
|
||||||
$(QMCKL_ROOT)/tools/create_makefile.sh
|
$(QMCKL_ROOT)/tools/create_makefile.sh
|
||||||
|
|
||||||
|
|
||||||
|
.SUFFIXES: .org .c
|
||||||
|
|
||||||
|
.org.c:
|
||||||
|
$(QMCKL_ROOT)/tools/tangle.sh $<
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* Script to tangle the org-mode files
|
* Script to tangle the org-mode files
|
||||||
@ -244,6 +265,7 @@ OUTPUT=Makefile.generated
|
|||||||
|
|
||||||
#+begin_src bash
|
#+begin_src bash
|
||||||
${QMCKL_ROOT}/tools/tangle.sh *.org
|
${QMCKL_ROOT}/tools/tangle.sh *.org
|
||||||
|
${QMCKL_ROOT}/tools/build_qmckl_h.sh
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Then we create the list of ~*.o~ files to be created, for library
|
Then we create the list of ~*.o~ files to be created, for library
|
||||||
@ -281,40 +303,69 @@ done >> $OUTPUT
|
|||||||
|
|
||||||
#+begin_src bash
|
#+begin_src bash
|
||||||
cat << EOF > ${OUTPUT}
|
cat << EOF > ${OUTPUT}
|
||||||
|
.POSIX:
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
PREFIX=/usr/local
|
||||||
|
|
||||||
CC=$CC
|
CC=$CC
|
||||||
CFLAGS=$CFLAGS -I../munit/
|
CFLAGS=$CFLAGS -I../munit/
|
||||||
|
|
||||||
FC=$FC
|
FC=$FC
|
||||||
FFLAGS=$FFLAGS
|
FFLAGS=$FFLAGS
|
||||||
|
|
||||||
OBJECT_FILES=$OBJECTS
|
OBJECT_FILES=$OBJECTS
|
||||||
TESTS=$TESTS
|
TESTS=$TESTS
|
||||||
TESTS_F=$TESTS_F
|
TESTS_F=$TESTS_F
|
||||||
|
|
||||||
LIBS=$LIBS
|
LIBS=$LIBS
|
||||||
|
|
||||||
libqmckl.so: \$(OBJECT_FILES)
|
QMCKL_ROOT=\$(shell dirname \$(CURDIR))
|
||||||
\$(CC) -shared \$(OBJECT_FILES) -o libqmckl.so
|
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)/include/qmckl_f.f90
|
||||||
|
munit=\$(QMCKL_ROOT)/munit/munit.c
|
||||||
|
|
||||||
%.o: %.c
|
shared: \$(shared_lib)
|
||||||
\$(CC) \$(CFLAGS) -c \$*.c -o \$*.o
|
static: \$(static_lib)
|
||||||
|
all: shared static
|
||||||
|
|
||||||
%.o: %.f90 qmckl_f.o
|
\$(shared_lib): \$(OBJECT_FILES)
|
||||||
\$(FC) \$(FFLAGS) -c \$*.f90 -o \$*.o
|
\$(CC) -shared \$(OBJECT_FILES) -o \$(shared_lib)
|
||||||
|
|
||||||
../include/qmckl.h ../include/qmckl_f.f90:
|
\$(static_lib): \$(OBJECT_FILES)
|
||||||
../tools/build_qmckl_h.sh
|
\$(AR) rcs \$(static_lib) \$(OBJECT_FILES)
|
||||||
|
|
||||||
qmckl_f.o: ../include/qmckl_f.f90
|
|
||||||
\$(FC) \$(FFLAGS) -c ../include/qmckl_f.f90 -o qmckl_f.o
|
|
||||||
|
|
||||||
test_qmckl: test_qmckl.c libqmckl.so \$(TESTS) \$(TESTS_F)
|
# Test
|
||||||
\$(CC) \$(CFLAGS) -Wl,-rpath,$PWD -L. \
|
|
||||||
../munit/munit.c \$(TESTS) \$(TESTS_F) -lqmckl \$(LIBS) test_qmckl.c -o test_qmckl
|
|
||||||
|
|
||||||
test: test_qmckl
|
qmckl_f.o: \$(qmckl_f)
|
||||||
|
\$(FC) \$(FFLAGS) -c \$(qmckl_f) -o \$@
|
||||||
|
|
||||||
|
test_qmckl: test_qmckl.c \$(qmckl_h) \$(static_lib) \$(TESTS) \$(TESTS_F)
|
||||||
|
\$(CC) \$(CFLAGS) \
|
||||||
|
\$(munit) \$(TESTS) \$(TESTS_F) \$(static_lib) \$(LIBS) test_qmckl.c -o \$@
|
||||||
|
|
||||||
|
test_qmckl_shared: test_qmckl.c \$(qmckl_h) \$(shared_lib) \$(TESTS) \$(TESTS_F)
|
||||||
|
\$(CC) \$(CFLAGS) -Wl,-rpath,\$(QMCKL_ROOT)/lib -L\$(QMCKL_ROOT)/lib \
|
||||||
|
\$(munit) \$(TESTS) \$(TESTS_F) -lqmckl \$(LIBS) test_qmckl.c -o \$@
|
||||||
|
|
||||||
|
check: test_qmckl test_qmckl_shared
|
||||||
./test_qmckl
|
./test_qmckl
|
||||||
|
|
||||||
.PHONY: test
|
clean:
|
||||||
|
\$(RM) -- *.o *.mod \$(shared_lib) \$(static_lib) test_qmckl
|
||||||
|
|
||||||
|
.SUFFIXES: .c .f90 .o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
\$(CC) \$(CFLAGS) -c \$*.c -o \$*.o
|
||||||
|
|
||||||
|
.f90.o: qmckl_f.o
|
||||||
|
\$(FC) \$(FFLAGS) -c \$*.f90 -o \$*.o
|
||||||
|
|
||||||
|
.PHONY: check clean all
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
@ -21,6 +21,7 @@ OUTPUT=Makefile.generated
|
|||||||
|
|
||||||
|
|
||||||
${QMCKL_ROOT}/tools/tangle.sh *.org
|
${QMCKL_ROOT}/tools/tangle.sh *.org
|
||||||
|
../tools/build_qmckl_h.sh
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -62,38 +63,67 @@ done >> $OUTPUT
|
|||||||
|
|
||||||
|
|
||||||
cat << EOF > ${OUTPUT}
|
cat << EOF > ${OUTPUT}
|
||||||
|
.POSIX:
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
PREFIX=/usr/local
|
||||||
|
|
||||||
CC=$CC
|
CC=$CC
|
||||||
CFLAGS=$CFLAGS -I../munit/
|
CFLAGS=$CFLAGS -I../munit/
|
||||||
|
|
||||||
FC=$FC
|
FC=$FC
|
||||||
FFLAGS=$FFLAGS
|
FFLAGS=$FFLAGS
|
||||||
|
|
||||||
OBJECT_FILES=$OBJECTS
|
OBJECT_FILES=$OBJECTS
|
||||||
TESTS=$TESTS
|
TESTS=$TESTS
|
||||||
TESTS_F=$TESTS_F
|
TESTS_F=$TESTS_F
|
||||||
|
|
||||||
LIBS=$LIBS
|
LIBS=$LIBS
|
||||||
|
|
||||||
libqmckl.so: \$(OBJECT_FILES)
|
QMCKL_ROOT=\$(shell dirname \$(CURDIR))
|
||||||
\$(CC) -shared \$(OBJECT_FILES) -o libqmckl.so
|
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)/include/qmckl_f.f90
|
||||||
|
munit=\$(QMCKL_ROOT)/munit/munit.c
|
||||||
|
|
||||||
%.o: %.c
|
shared: \$(shared_lib)
|
||||||
\$(CC) \$(CFLAGS) -c \$*.c -o \$*.o
|
static: \$(static_lib)
|
||||||
|
all: shared static
|
||||||
|
|
||||||
%.o: %.f90 qmckl_f.o
|
\$(shared_lib): \$(OBJECT_FILES)
|
||||||
\$(FC) \$(FFLAGS) -c \$*.f90 -o \$*.o
|
\$(CC) -shared \$(OBJECT_FILES) -o \$(shared_lib)
|
||||||
|
|
||||||
../include/qmckl.h ../include/qmckl_f.f90:
|
\$(static_lib): \$(OBJECT_FILES)
|
||||||
../tools/build_qmckl_h.sh
|
\$(AR) rcs \$(static_lib) \$(OBJECT_FILES)
|
||||||
|
|
||||||
qmckl_f.o: ../include/qmckl_f.f90
|
|
||||||
\$(FC) \$(FFLAGS) -c ../include/qmckl_f.f90 -o qmckl_f.o
|
|
||||||
|
|
||||||
test_qmckl: test_qmckl.c libqmckl.so \$(TESTS) \$(TESTS_F)
|
# Test
|
||||||
\$(CC) \$(CFLAGS) -Wl,-rpath,$PWD -L. \
|
|
||||||
../munit/munit.c \$(TESTS) \$(TESTS_F) -lqmckl \$(LIBS) test_qmckl.c -o test_qmckl
|
|
||||||
|
|
||||||
test: test_qmckl
|
qmckl_f.o: \$(qmckl_f)
|
||||||
|
\$(FC) \$(FFLAGS) -c \$(qmckl_f) -o \$@
|
||||||
|
|
||||||
|
test_qmckl: test_qmckl.c \$(qmckl_h) \$(static_lib) \$(TESTS) \$(TESTS_F)
|
||||||
|
\$(CC) \$(CFLAGS) \
|
||||||
|
\$(munit) \$(TESTS) \$(TESTS_F) \$(static_lib) \$(LIBS) test_qmckl.c -o \$@
|
||||||
|
|
||||||
|
test_qmckl_shared: test_qmckl.c \$(qmckl_h) \$(shared_lib) \$(TESTS) \$(TESTS_F)
|
||||||
|
\$(CC) \$(CFLAGS) -Wl,-rpath,$PWD/../lib -L../lib \
|
||||||
|
\$(munit) \$(TESTS) \$(TESTS_F) -lqmckl \$(LIBS) test_qmckl.c -o \$@
|
||||||
|
|
||||||
|
check: test_qmckl test_qmckl_shared
|
||||||
./test_qmckl
|
./test_qmckl
|
||||||
|
|
||||||
.PHONY: test
|
clean:
|
||||||
|
\$(RM) -- *.o *.mod \$(shared_lib) \$(static_lib) test_qmckl
|
||||||
|
|
||||||
|
.SUFFIXES: .c .f90 .o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
\$(CC) \$(CFLAGS) -c \$*.c -o \$*.o
|
||||||
|
|
||||||
|
.f90.o: qmckl_f.o
|
||||||
|
\$(FC) \$(FFLAGS) -c \$*.f90 -o \$*.o
|
||||||
|
|
||||||
|
.PHONY: check clean all
|
||||||
EOF
|
EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user