forked from PHOTOX/ABIN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·124 lines (103 loc) · 3.2 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Makefile for ABIN
# The user-defined variables are included from file "make.vars',
# which is not under version control
# No user modification to this Makefile file should be necessary.
# Type "make" and you should get the binary named src/$BIN as defined in make.vars
# Before recompiling, it is wise to clean up by "make clean"
# WARNING: dependecies on *.mod files are not properly resolved here!
# If you change modules, you should recompile the whole thing by running
# $ make clean && make
# By default run all end-to-end tests in tests/
TEST=all
# ABIN binary name
BIN=abin
# Optional compilation parameters
# Some functionality will not work without them
MPI=FALSE
FFTW=FALSE
CP2K=FALSE
PLUMED=FALSE
# https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
LDLIBS=
LDFLAGS=
# Export all vars into submake commands
export
# User-defined compilation parameters are in make.vars
# and should override the defaults defined above
include make.vars
export SHELL=/bin/bash
export COMMIT=NaN
ifeq ($(shell git --version | cut -b -3),git)
ifneq ($(shell git status 2>&1 | head -1 | cut -b -5),fatal)
export COMMIT=`git rev-parse HEAD`
endif
endif
ifeq ($(strip $(FFTW)),TRUE)
DFLAGS += -DUSE_FFTW
ifeq ($(CP2K),TRUE)
$(info "!!!!!-------------WARNING---------------!!!!!!!")
$(info "Using FFTW flag with CP2K may lead to troubles!")
$(info "!!!!!-------------WARNING---------------!!!!!!!")
$(info "")
else
LDLIBS += -lfftw3
endif
endif
ifeq ($(strip $(CP2K)),TRUE)
DFLAGS += -DUSE_CP2K
# OpenMP does not work with -fno-underscoring
FFLAGS += -fno-underscoring -fno-openmp
# The following variables should be the same that were used to compile CP2K.
# Also, be carefull with FFTW clashes
LDLIBS += -lcp2k ${CP2K_LIBS}
LDFLAGS += -L${CP2K_PATH}
endif
ifeq ($(strip $(PLUMED)),TRUE)
include ${PLUMED_INC}
DFLAGS += -DUSE_PLUMED
LDLIBS += ${PLUMED_STATIC_LOAD}
endif
ifeq ($(strip $(MPI)),TRUE)
DFLAGS += -DUSE_MPI
endif
LDLIBS := -labin -lwater ${LDLIBS} -lm -lstdc++
LDFLAGS += -fopenmp -L../src/ -L../water_potentials/
# This is the default target
${BIN} :
mkdir -p bin/
$(MAKE) -C water_potentials all
$(MAKE) -C src $(BIN)
$(MAKE) -C utils all
utils: ${BIN}
$(MAKE) -C utils all
clean:
/bin/rm -f *.gcov bin/*
$(MAKE) -C water_potentials clean
$(MAKE) -C src clean
$(MAKE) -C utils clean
ifneq ($(strip $(PFUNIT_PATH)),)
$(MAKE) -C unit_tests clean
endif
# Build and run Unit tests (powered by pFUnit library)
unittest: ${BIN}
ifneq ($(strip $(PFUNIT_PATH)),)
$(MAKE) -C unit_tests all
$(MAKE) -C unit_tests test
else
echo "pFUnit library not available. Skipping unit tests."
endif
# End-To-End (E2E) tests
e2etest: ${BIN}
/bin/bash tests/test.sh ${BIN} $(TEST) ${MPI} ${FFTW} ${PLUMED} ${CP2K} test
# Runs both end-to-end and unit tests
test: unittest e2etest
# Clean all test folders.
testclean:
ifneq ($(strip $(PFUNIT_PATH)),)
$(MAKE) -C unit_tests clean
endif
/bin/bash tests/test.sh ${BIN} $(TEST) ${MPI} ${FFTW} $(PLUMED) ${CP2K} clean
# This will automatically generate new reference data for E2E tests
makeref: ${BIN}
/bin/bash tests/test.sh ${BIN} $(TEST) ${MPI} ${FFTW} $(PLUMED) ${CP2K} makeref
.PHONY: clean test testclean makeref unittest e2etest