1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-10-18 05:51:52 +02:00
qmckl/src/Makefile

109 lines
2.3 KiB
Makefile
Raw Normal View History

2021-03-09 01:16:23 +01:00
# Header :noexport:
# This file was created by tools/Building.org
2021-03-10 12:58:38 +01:00
# Dependencies
LIBS=-lpthread
2021-03-09 01:16:23 +01:00
# Variables
QMCKL_ROOT=$(shell dirname $(CURDIR))
export CC CFLAGS FC FFLAGS LIBS QMCKL_ROOT
ORG_SOURCE_FILES=$(wildcard *.org)
OBJECT_FILES=$(filter-out $(EXCLUDED_OBJECTS), $(patsubst %.org,%.o,$(ORG_SOURCE_FILES)))
INCLUDE=-I$(QMCKL_ROOT)/include/
# Compiler options
2021-03-19 13:47:50 +01:00
2021-03-09 01:16:23 +01:00
# GNU, Intel and LLVM compilers are supported. Choose here:
2020-11-06 10:58:22 +01:00
COMPILER=GNU
#COMPILER=INTEL
#COMPILER=LLVM
2021-03-09 01:16:23 +01:00
# GNU
2020-11-06 12:10:20 +01:00
ifeq ($(COMPILER),GNU)
2021-03-09 01:16:23 +01:00
#----------------------------------------------------------
2020-11-05 00:46:19 +01:00
CC=gcc -g
2021-03-09 01:16:23 +01:00
CFLAGS=-fPIC $(INCLUDE) \
-fexceptions -Wall -Werror -Wpedantic -Wextra -fmax-errors=3
2020-10-14 00:52:50 +02:00
2020-11-05 00:46:19 +01:00
FC=gfortran -g
2021-03-09 01:16:23 +01:00
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 \
2021-03-19 13:47:50 +01:00
-ffpe-trap=zero,overflow,underflow
2020-10-15 12:36:52 +02:00
2021-03-19 13:47:50 +01:00
LIBS+=-lgfortran -lm
2021-03-09 01:16:23 +01:00
#----------------------------------------------------------
2020-11-06 10:58:22 +01:00
endif
2021-03-09 01:16:23 +01:00
# Intel
2021-03-19 13:47:50 +01:00
2021-03-09 01:16:23 +01:00
2020-11-06 12:10:20 +01:00
ifeq ($(COMPILER),INTEL)
2021-03-09 01:16:23 +01:00
#----------------------------------------------------------
2020-11-06 10:58:22 +01:00
CC=icc -xHost
2021-03-09 01:16:23 +01:00
CFLAGS=-fPIC -g -O2 $(INCLUDE)
2020-11-06 10:58:22 +01:00
FC=ifort -xHost
2021-03-09 01:16:23 +01:00
FFLAGS=-fPIC -g -O2 $(INCLUDE)
2020-11-06 10:58:22 +01:00
2021-03-10 12:58:38 +01:00
LIBS+=-lm -lifcore -lirc
2021-03-09 01:16:23 +01:00
#----------------------------------------------------------
CC=icc -xHost
2020-11-06 10:58:22 +01:00
endif
2021-03-09 01:16:23 +01:00
# LLVM
2021-03-19 13:47:50 +01:00
2021-03-09 01:16:23 +01:00
2020-11-06 12:10:20 +01:00
ifeq ($(COMPILER),LLVM)
2021-03-09 01:16:23 +01:00
#----------------------------------------------------------
2020-11-06 10:58:22 +01:00
CC=clang
2021-03-09 01:16:23 +01:00
CFLAGS=-fPIC -g -O2 $(INCLUDE)
2020-11-06 10:58:22 +01:00
FC=flang
2021-03-09 01:16:23 +01:00
FFLAGS=fPIC -g -O2 $(INCLUDE)
2020-11-05 15:27:25 +01:00
2021-03-10 12:58:38 +01:00
LIBS+=-lm
2021-03-09 01:16:23 +01:00
#----------------------------------------------------------
2020-11-06 10:58:22 +01:00
endif
2020-10-26 19:30:50 +01:00
2021-03-09 01:16:23 +01:00
# Rules
2020-10-22 00:50:07 +02:00
2021-03-10 12:58:38 +01:00
# The source files are created during the generation of the file ~Makefile.generated~.
2020-10-21 19:50:18 +02:00
.PHONY: clean
2020-10-16 13:58:05 +02:00
.SECONDARY: # Needed to keep the produced C and Fortran files
2020-10-15 09:41:26 +02:00
libqmckl.so: ../include/qmckl.h
2020-10-16 13:58:05 +02:00
$(MAKE) -f Makefile.generated
2020-10-14 00:52:50 +02:00
../include/qmckl.h: Makefile.generated
2021-03-10 12:58:38 +01:00
../tools/build_qmckl_h.sh
test: libqmckl.so
2020-10-17 00:28:49 +02:00
$(MAKE) -f Makefile.generated test
2020-11-05 15:27:25 +01:00
doc: $(ORG_SOURCE_FILES)
2021-03-20 16:58:48 +01:00
$(QMCKL_ROOT)/tools/build_doc.sh
2020-11-05 15:27:25 +01:00
clean:
2021-03-10 12:58:38 +01:00
$(RM) test_qmckl_* test_qmckl.c test_qmckl \
2021-03-09 01:16:23 +01:00
qmckl_*.f90 qmckl_*.c qmckl_*.o qmckl_*.h \
Makefile.generated libqmckl.so *.html *.mod
2021-03-06 18:19:13 +01:00
Makefile.generated: Makefile $(QMCKL_ROOT)/tools/create_makefile.sh $(ORG_SOURCE_FILES)
2021-03-09 01:16:23 +01:00
$(QMCKL_ROOT)/tools/create_makefile.sh