Makefile 7.87 KB
Newer Older
Marco Govoni's avatar
Marco Govoni committed
1
2
# Makefile for the WEST software 

3
4
include ../make.inc

Marco Govoni's avatar
Marco Govoni committed
5
6
7
8
default :
	@echo "Welcome to WEST!"
	@echo ' '
	@echo 'to install WEST, type at the shell prompt:'
Marco Govoni's avatar
Marco Govoni committed
9
	@echo '  make conf PYT=python-3 PYT_LDFLAGS="`python3-config --ldflags --embed`"'
Marco Govoni's avatar
Marco Govoni committed
10
11
12
13
14
15
16
17
18
19
20
21
22
	@echo '  make [-j] target'
	@echo ' '
	@echo 'where target identifies one or multiple packages'
	@echo '  wstat        calculation of static dielectric response using PDEP'
	@echo '  wfreq        calculation of dynamical dielectric response and GW self-energy'
	@echo '  westpp       postprocessing programs'
	@echo '  all          same as "make wstat wfreq westpp"'
	@echo ' '
	@echo 'where target is one of the following operations:'
	@echo '  doc          build WEST documentation'
	@echo ' '
	@echo '  clean        remove executables and objects'
	@echo '  veryclean    remove files produced by "configure" as well'
Marco Govoni's avatar
Marco Govoni committed
23

Marco Govoni's avatar
Marco Govoni committed
24
25
conf:
	@[ "${PYT}" ] || ( echo ">> PYT is not set. Ex: make conf PYT=python3"; exit 1 )
Marco Govoni's avatar
Marco Govoni committed
26
27
28
29
30
	@echo "Welcome to WEST!"
	@echo ' '
	@echo "version : `${PYT} ./Pytools/read_json.py VERSION.json version`"
	@echo "url : `${PYT} ./Pytools/read_json.py VERSION.json url`"
	@echo "license : `${PYT} ./Pytools/read_json.py VERSION.json license`"
Marco Govoni's avatar
Marco Govoni committed
31
	@echo " " > west_make.inc
Marco Govoni's avatar
Marco Govoni committed
32
	@echo WESTDIR=`pwd` >> west_make.inc
Marco Govoni's avatar
Marco Govoni committed
33
	@echo PYT=${PYT} >> west_make.inc
Marco Govoni's avatar
Marco Govoni committed
34
	@echo PYT_LDFLAGS=${PYT_LDFLAGS} >> west_make.inc
Marco Govoni's avatar
Marco Govoni committed
35
	@echo " "
Marco Govoni's avatar
Marco Govoni committed
36
	@echo "Generated file: west_make.inc"
Marco Govoni's avatar
Marco Govoni committed
37
38
	@cat west_make.inc
	@echo " "
Marco Govoni's avatar
Marco Govoni committed
39
40
41
42
43

check_conf:
	@[ -f "west_make.inc" ] || ( echo ">> Cannot find west_make.inc. Run: make conf PYT=python3"; exit 1 )
	$(eval include ./west_make.inc)

44
45
46
47
48
49
report_build_vars :
	@echo "              "
	@echo "##############"
	@echo "# Build vars #"
	@echo "##############"
	@echo "              "
Marco Govoni's avatar
Marco Govoni committed
50
51
	@[ "${MPIF90}" ] || ( echo ">> MPIF90 is not set."; exit 1 )
	@[ "${CC}" ] || ( echo ">> CC is not set."; exit 1 )
Marco Govoni's avatar
Marco Govoni committed
52
	@echo "# WEST_VERSION_NUMBER : `${PYT} ./Pytools/read_json.py VERSION.json version`"
Marco Govoni's avatar
Marco Govoni committed
53
	@echo "# WESTDIR : ${WESTDIR}"
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
	@echo "# FDFLAGS : ${FDFLAGS}"
	@echo "# IFLAGS : ${IFLAGS}"
	@echo "# MOD_FLAG : ${MOD_FLAG}"
	@echo "# MPIF90 : ${MPIF90}"
	@echo "# CC : ${CC}"
	@echo "# F77 : ${F77}"
	@echo "# CPP : ${CPP}"
	@echo "# CPPFLAGS : ${CPPFLAGS}"
	@echo "# CFLAGS : ${CFLAGS}"
	@echo "# F90FLAGS : ${F90FLAGS}"
	@echo "# FFLAGS : ${FFLAGS}"
	@echo "# FFLAGS_NOOPT : ${FFLAGS_NOOPT}"
	@echo "# LD : ${LD}"
	@echo "# LDFLAGS : ${LDFLAGS}"
	@echo "# LD_LIBS : ${LD_LIBS}"
	@echo "# BLAS_LIBS : ${BLAS_LIBS}"
	@echo "# BLAS_LIBS_SWITCH : ${BLAS_LIBS_SWITCH}"
	@echo "# LAPACK_LIBS : ${LAPACK_LIBS}"
	@echo "# LAPACK_LIBS_SWITCH : ${LAPACK_LIBS_SWITCH}"
	@echo "# SCALAPACK_LIBS : ${SCALAPACK_LIBS}"
	@echo "# FFT_LIBS : ${FFT_LIBS}"
	@echo "# MPI_LIBS : ${MPI_LIBS}"
	@echo "# MASS_LIBS : ${MASS_LIBS}"
	@echo "# AR : ${AR}"
	@echo "# ARFLAGS : ${ARFLAGS}"
	@echo "# RANLIB : ${RANLIB}"
	@echo "# FLIB_TARGETS : ${FLIB_TARGETS}"
	@echo "# LIBOBJS : ${LIBOBJS}"
	@echo "# LIBS : ${LIBS}"
	@echo "# WGET : ${WGET}"
	@echo "# PYT : ${PYT}"
Marco Govoni's avatar
Marco Govoni committed
85
	@echo "# PYT_LDFLAGS : ${PYT_LDFLAGS}"
86
87
	@echo " "

Marco Govoni's avatar
Marco Govoni committed
88

89
pytools: \
Marco Govoni's avatar
Marco Govoni committed
90
check_conf \
91
report_build_vars \
92
93
pytools_do

94
wstat: \
Marco Govoni's avatar
Marco Govoni committed
95
pytools \
Marco Govoni's avatar
Marco Govoni committed
96
97
libraries_do \
modules_do \
Marco Govoni's avatar
Marco Govoni committed
98
99
100
101
102
103
104
tools_do \
fft_kernel_do \
coulomb_kernel_do \
para_kernel_do \
hamiltonian_kernel_do \
dfpt_kernel_do \
io_kernel_do \
105
106
107
wstat_do

wfreq: \
Marco Govoni's avatar
Marco Govoni committed
108
pytools \
109
110
wstat \
wfreq_do
Marco Govoni's avatar
Marco Govoni committed
111

112
westpp: \
Marco Govoni's avatar
Marco Govoni committed
113
pytools \
114
115
116
117
118
wstat \
wfreq \
westpp_do

all: \
119
pytools \
120
121
122
wstat \
wfreq \
westpp 
Marco Govoni's avatar
Marco Govoni committed
123

Marco Govoni's avatar
Marco Govoni committed
124
125
126
127
128
129
doc: check_conf
	if test -d doc ; then \
	( cd doc ; if test "$(MAKE)" = "" ; then make $(MFLAGS) html; \
	else $(MAKE) $(MFLAGS) html ; fi ) ; fi
	@echo 'Open the file: ${WESTDIR}/doc/_build/html/index.html'

130
131
132
133
134
pytools_do:
	if test -d Pytools ; then \
	( cd Pytools ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

Marco Govoni's avatar
Marco Govoni committed
135
136
137
138
139
libraries_do:
	if test -d Libraries ; then \
	( cd Libraries ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

Marco Govoni's avatar
Marco Govoni committed
140
141
modules_do:
	if test -d Modules ; then \
Marco Govoni's avatar
Marco Govoni committed
142
	( cd Modules ; sh ./update_west_version ${WESTDIR} `${PYT} ../Pytools/read_json.py ../VERSION.json version`; \
Marco Govoni's avatar
Marco Govoni committed
143
	if  test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
Marco Govoni's avatar
Marco Govoni committed
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

tools_do:
	if test -d Tools ; then \
	( cd Tools ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

fft_kernel_do:
	if test -d FFT_kernel ; then \
	( cd FFT_kernel ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

coulomb_kernel_do:
	if test -d Coulomb_kernel ; then \
	( cd Coulomb_kernel ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

para_kernel_do:
	if test -d Para_kernel ; then \
	( cd Para_kernel ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

hamiltonian_kernel_do:
	if test -d Hamiltonian_kernel ; then \
	( cd Hamiltonian_kernel ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

dfpt_kernel_do:
	if test -d DFPT_kernel ; then \
	( cd DFPT_kernel ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

io_kernel_do:
	if test -d IO_kernel ; then \
	( cd IO_kernel ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
	else $(MAKE) $(MFLAGS) all ; fi ) ; fi

wstat_do:
	if test -d Wstat ; then \
Marco Govoni's avatar
Marco Govoni committed
183
184
	( cd Wstat ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all PYT_LDFLAGS="${PYT_LDFLAGS}"; \
	else $(MAKE) $(MFLAGS) all PYT_LDFLAGS="${PYT_LDFLAGS}"; fi ) ; fi
Marco Govoni's avatar
Marco Govoni committed
185
186
187

wfreq_do:
	if test -d Wfreq ; then \
Marco Govoni's avatar
Marco Govoni committed
188
189
	( cd Wfreq ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all PYT_LDFLAGS="${PYT_LDFLAGS}"; \
	else $(MAKE) $(MFLAGS) all PYT_LDFLAGS="${PYT_LDFLAGS}"; fi ) ; fi
Marco Govoni's avatar
Marco Govoni committed
190
191
192

westpp_do:
	if test -d Westpp ; then \
Marco Govoni's avatar
Marco Govoni committed
193
194
	( cd Westpp ; if test "$(MAKE)" = "" ; then make $(MFLAGS) all PYT_LDFLAGS="${PYT_LDFLAGS}"; \
	else $(MAKE) $(MFLAGS) all PYT_LDFLAGS="${PYT_LDFLAGS}"; fi ) ; fi
Marco Govoni's avatar
Marco Govoni committed
195

Marco Govoni's avatar
Marco Govoni committed
196
clean: \
197
pytools_undo \
Marco Govoni's avatar
Marco Govoni committed
198
199
libraries_undo \
modules_undo \
Marco Govoni's avatar
Marco Govoni committed
200
201
202
203
204
205
206
207
208
tools_undo \
fft_kernel_undo \
coulomb_kernel_undo \
para_kernel_undo \
hamiltonian_kernel_undo \
dfpt_kernel_undo \
io_kernel_undo \
wstat_undo \
wfreq_undo \
209
westpp_undo 
Marco Govoni's avatar
Marco Govoni committed
210

211
212
213
214
215
pytools_undo:
	if test -d Pytools ; then \
	( cd Pytools ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

Marco Govoni's avatar
Marco Govoni committed
216
217
218
219
220
libraries_undo:
	if test -d Libraries ; then \
	( cd Libraries ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

Marco Govoni's avatar
Marco Govoni committed
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
modules_undo:
	if test -d Modules ; then \
	( cd Modules ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

tools_undo:
	if test -d Tools ; then \
	( cd Tools ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

fft_kernel_undo:
	if test -d FFT_kernel ; then \
	( cd FFT_kernel ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

coulomb_kernel_undo:
	if test -d Coulomb_kernel ; then \
	( cd Coulomb_kernel ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

para_kernel_undo:
	if test -d Para_kernel ; then \
	( cd Para_kernel ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

hamiltonian_kernel_undo:
	if test -d Hamiltonian_kernel ; then \
	( cd Hamiltonian_kernel ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

dfpt_kernel_undo:
	if test -d DFPT_kernel ; then \
	( cd DFPT_kernel ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

io_kernel_undo:
	if test -d IO_kernel ; then \
	( cd IO_kernel ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

wstat_undo:
	if test -d Wstat ; then \
	( cd Wstat ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

wfreq_undo:
	if test -d Wfreq ; then \
	( cd Wfreq ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

westpp_undo:
	if test -d Westpp ; then \
	( cd Westpp ; if test "$(MAKE)" = "" ; then make clean ; \
	else $(MAKE) clean ; fi ) ; fi

Marco Govoni's avatar
Marco Govoni committed
276
277
278
279
280
unconf:
	[ -f "west_make.inc" ] && ( rm west_make.inc )

veryclean: clean \
unconf