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

Marco Govoni's avatar
Marco Govoni committed
3
include ./VERSION
4
5
include ../make.inc

Marco Govoni's avatar
Marco Govoni committed
6
7
default: all

Marco Govoni's avatar
Marco Govoni committed
8
9
conf:
	@[ "${PYT}" ] || ( echo ">> PYT is not set. Ex: make conf PYT=python3"; exit 1 )
Marco Govoni's avatar
Marco Govoni committed
10
	@echo "# WEST_VERSION_NUMBER : ${WEST_VERSION_NUMBER}"
Marco Govoni's avatar
Marco Govoni committed
11
	@echo " " > west_make.inc
Marco Govoni's avatar
Marco Govoni committed
12
	@echo WESTDIR=`pwd` >> west_make.inc
Marco Govoni's avatar
Marco Govoni committed
13
	@echo PYT=${PYT} >> west_make.inc
Marco Govoni's avatar
Marco Govoni committed
14
15
	@if [ -z "${PYT_LDFLAGS}" ] ; then echo PYT_LDFLAGS="`${PYT}-config --ldflags`" >> west_make.inc ; else echo PYT_LDFLAGS=${PYT_LDFLAGS} >> west_make.inc ; fi
	@echo " "
Marco Govoni's avatar
Marco Govoni committed
16
	@echo "Generated file: west_make.inc"
Marco Govoni's avatar
Marco Govoni committed
17
18
	@cat west_make.inc
	@echo " "
Marco Govoni's avatar
Marco Govoni committed
19
20
21
22
23

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

24
25
26
27
28
29
report_build_vars :
	@echo "              "
	@echo "##############"
	@echo "# Build vars #"
	@echo "##############"
	@echo "              "
Marco Govoni's avatar
Marco Govoni committed
30
31
32
	@[ "${MPIF90}" ] || ( echo ">> MPIF90 is not set."; exit 1 )
	@[ "${CC}" ] || ( echo ">> CC is not set."; exit 1 )
	@echo "# WEST_VERSION_NUMBER : ${WEST_VERSION_NUMBER}"
Marco Govoni's avatar
Marco Govoni committed
33
	@echo "# WESTDIR : ${WESTDIR}"
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
	@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
65
	@echo "# PYT_LDFLAGS : ${PYT_LDFLAGS}"
66
67
	@echo " "

Marco Govoni's avatar
Marco Govoni committed
68

69
pytools: \
Marco Govoni's avatar
Marco Govoni committed
70
check_conf \
71
report_build_vars \
72
73
pytools_do

74
wstat: \
Marco Govoni's avatar
Marco Govoni committed
75
76
libraries_do \
modules_do \
Marco Govoni's avatar
Marco Govoni committed
77
78
79
80
81
82
83
tools_do \
fft_kernel_do \
coulomb_kernel_do \
para_kernel_do \
hamiltonian_kernel_do \
dfpt_kernel_do \
io_kernel_do \
84
85
86
wstat_do

wfreq: \
Marco Govoni's avatar
Marco Govoni committed
87
pytools \
88
89
wstat \
wfreq_do
Marco Govoni's avatar
Marco Govoni committed
90

91
westpp: \
Marco Govoni's avatar
Marco Govoni committed
92
pytools \
93
94
95
96
97
wstat \
wfreq \
westpp_do

all: \
98
pytools \
99
100
101
wstat \
wfreq \
westpp 
Marco Govoni's avatar
Marco Govoni committed
102

103
104
105
106
107
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
108
109
110
111
112
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
113
114
modules_do:
	if test -d Modules ; then \
Marco Govoni's avatar
Marco Govoni committed
115
116
	( cd Modules ; sh ./update_west_version ${WESTDIR} ${WEST_VERSION_NUMBER}; \
	if  test "$(MAKE)" = "" ; then make $(MFLAGS) all; \
Marco Govoni's avatar
Marco Govoni committed
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
	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
156
157
	( 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
158
159
160

wfreq_do:
	if test -d Wfreq ; then \
Marco Govoni's avatar
Marco Govoni committed
161
162
	( 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
163
164
165

westpp_do:
	if test -d Westpp ; then \
Marco Govoni's avatar
Marco Govoni committed
166
167
	( 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
168

Marco Govoni's avatar
Marco Govoni committed
169
clean: \
170
pytools_undo \
Marco Govoni's avatar
Marco Govoni committed
171
172
libraries_undo \
modules_undo \
Marco Govoni's avatar
Marco Govoni committed
173
174
175
176
177
178
179
180
181
tools_undo \
fft_kernel_undo \
coulomb_kernel_undo \
para_kernel_undo \
hamiltonian_kernel_undo \
dfpt_kernel_undo \
io_kernel_undo \
wstat_undo \
wfreq_undo \
182
westpp_undo 
Marco Govoni's avatar
Marco Govoni committed
183

184
185
186
187
188
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
189
190
191
192
193
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
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
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
249
250
251
252
253
unconf:
	[ -f "west_make.inc" ] && ( rm west_make.inc )

veryclean: clean \
unconf