File: plugins_makefile

package info (click to toggle)
espresso 5.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 146,004 kB
  • ctags: 17,245
  • sloc: f90: 253,041; sh: 51,271; ansic: 27,494; tcl: 15,570; xml: 14,508; makefile: 2,958; perl: 2,035; fortran: 1,924; python: 337; cpp: 200; awk: 57
file content (592 lines) | stat: -rw-r--r-- 22,248 bytes parent folder | download
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
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
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
183
184
185
186
187
188
189
190
191
192
193
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
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592

#===============================
# espresso
#===============================
#
# Makefile for plugins
#

include ../make.sys
include plugins_list
#
# MAIN target
#

EXTLIBS=liblapack libblas libiotk

##########################################################
# LD1
###########################################################
ld1:  uncompress-ld1
	if test -d ../atomic; then \
	cd ../atomic; $(MAKE) all || exit 1; cd ../bin; ln -fs ../atomic/src/ld1.x . ; fi
	touch make-ld1
uncompress-ld1: touch-dummy
	@(if test ! -s ../archive/$(LD1).tar.gz && test ! -d ../atomic ; then \
	wget -O ../archive/$(LD1).tar.gz $(LD1_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(LD1).tar.gz $(LD1_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download ld1. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
        echo "*** $(LD1).tar.gz from $(LD1_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../atomic; then \
	(gzip -dc ../archive/$(LD1).tar.gz | (cd ../ ; tar -xvf -)) ; fi
	touch uncompress-ld1
##########################################################
# XSpectra
###########################################################
xspectra:  uncompress-xspectra
	if test -d ../XSpectra; then \
	cd ../XSpectra; $(MAKE) all || exit 1; cd ../bin; ln -fs ../XSpectra/src/xspectra.x . ; fi
	touch make-xspectra
uncompress-xspectra: touch-dummy
	@(if test ! -s ../archive/$(XSPECTRA).tar.gz && test ! -d ../XSpectra ; then \
	wget -O ../archive/$(XSPECTRA).tar.gz $(XSPECTRA_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(XSPECTRA).tar.gz $(XSPECTRA_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download xspectra. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(XSPECTRA).tar.gz from $(XSPECTRA_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../XSpectra; then \
	(gzip -dc ../archive/$(XSPECTRA).tar.gz | (cd ../ ; tar -xvf -)) ; fi
	touch uncompress-xspectra
##########################################################
# PWCOND
###########################################################
pwcond:  uncompress-pwcond
	if test -d ../PWCOND; then \
	cd ../PWCOND; $(MAKE) all || exit 1; cd ../bin; ln -fs ../PWCOND/src/pwcond.x . ; fi
	touch make-pwcond
uncompress-pwcond: touch-dummy
	@(if test ! -s ../archive/$(PWCOND).tar.gz && test ! -d ../PWCOND ; then \
	wget -O ../archive/$(PWCOND).tar.gz $(PWCOND_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(PWCOND).tar.gz $(PWCOND_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download pwcond. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(PWCOND).tar.gz from $(PWCOND_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../PWCOND; then \
	(gzip -dc ../archive/$(PWCOND).tar.gz | (cd ../ ; tar -xvf -)) ; \
	(cd ../ ; ln -s $(PWCOND) PWCOND) ; fi 
	touch uncompress-pwcond
##########################################################
# NEB
###########################################################
neb:  uncompress-neb
	if test -d ../NEB; then \
	cd ../NEB; $(MAKE) all || exit 1; cd ../bin; ln -fs ../NEB/src/neb.x . ; fi
	touch make-neb
uncompress-neb: touch-dummy
	@(if test ! -s ../archive/$(NEB).tar.gz && test ! -d ../NEB ; then \
	wget -O ../archive/$(NEB).tar.gz $(NEB_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(NEB).tar.gz $(NEB_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download neb. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(NEB).tar.gz from $(NEB_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../NEB; then \
	(gzip -dc ../archive/$(NEB).tar.gz | (cd ../ ; tar -xvf -)) ; fi
	touch uncompress-neb
##########################################################
# TDDFPT
###########################################################
tddfpt:  uncompress-tddfpt
	if test -d ../TDDFPT; then \
	cd ../TDDFPT; $(MAKE) all || exit 1; cd ../bin; ln -fs ../TDDFPT/src/turbo_lanczos.x . ; \
	ln -fs ../TDDFPT/tools/turbo_spectrum.x . ; fi
	touch make-tddfpt
uncompress-tddfpt: touch-dummy
	@(if test ! -s ../archive/$(TDDFPT).tar.gz && test ! -d ../TDDFPT ; then \
	wget -O ../archive/$(TDDFPT).tar.gz $(TDDFPT_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(TDDFPT).tar.gz $(TDDFPT_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download tddfpt. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(TDDFPT).tar.gz from $(TDDFPT_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../TDDFPT; then \
	(gzip -dc ../archive/$(TDDFPT).tar.gz | (cd ../ ; tar -xvf -)) ; fi
	touch uncompress-tddfpt
##########################################################
# PHonon
###########################################################
phonon:  uncompress-phonon
	if test -d ../PHonon; then \
	cd ../PHonon; $(MAKE) all || exit 1; cd ../bin; \
	ln -fs ../PHonon/PH/ph.x . ; \
	ln -fs ../PHonon/PH/dynmat.x . ; \
	ln -fs ../PHonon/PH/matdyn.x . ; \
	ln -fs ../PHonon/PH/q2r.x . ; \
	ln -fs ../PHonon/PH/q2qstar.x . ; \
	ln -fs ../PHonon/PH/lambda.x . ; \
	ln -fs ../PHonon/PH/fqha.x . ; \
	ln -fs ../PHonon/Gamma/phcg.x . ; \
	ln -fs ../PHonon/D3/d3.x . ; \
	fi
	touch make-phonon
uncompress-phonon: touch-dummy
	@(if test ! -s ../archive/$(PHONON).tar.gz && test ! -d ../PHonon ; then \
	wget -O ../archive/$(PHONON).tar.gz $(PHONON_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(PHONON).tar.gz $(PHONON_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download phonon. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(PHONON).tar.gz from $(PHONON_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../PHonon; then \
	(gzip -dc ../archive/$(PHONON).tar.gz | (cd ../ ; tar -xvf -)) ; fi
	touch uncompress-phonon
##########################################################
# GIPAW
###########################################################
#gipaw:  uncompress-gipaw configure-gipaw
gipaw:  download-gipaw configure-gipaw
	if test -d ../GIPAW; then \
	cd ../GIPAW; $(MAKE) all || exit 1; cd ../bin; ln -fs ../GIPAW/bin/gipaw.x . ; fi
	touch make-gipaw
download-gipaw:
	@echo "GIPAW 5 is not ready for distribution. Donwloading the development version."
	@echo "This version is not bug free. Please, check if your results make sense."
	svn checkout http://qeforge.qe-forge.org/svn/qe-gipaw/trunk ../GIPAW
uncompress-gipaw: touch-dummy
	@(if test ! -s ../archive/$(GIPAW).tar.gz && test ! -d ../GIPAW ; then \
	wget -O ../archive/$(GIPAW).tar.gz $(GIPAW_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(GIPAW).tar.gz $(GIPAW_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download qe-gipaw. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(GIPAW).tar.gz from $(GIPAW_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../GIPAW; then \
	(gzip -dc ../archive/$(GIPAW).tar.gz | (cd ../ ; tar -xvf -)) ; \
	(cd ../ ; ln -s $(GIPAW) GIPAW) ; fi 
	touch uncompress-gipaw
configure-gipaw: touch-dummy
	cd ../GIPAW ; \
	./configure --with-qe-source=${TOPDIR}
	touch ./configure-gipaw
##########################################################
# EPW
###########################################################
epw: 
	if test -d ../EPW; then \
	cd ../EPW; $(MAKE) all || exit 1; cd ../bin; ln -fs ../EPW/bin/epw.x . ; fi
	-(cd ../bin; ln -fs ../EPW/src/epw.x .)
	touch make-epw

###########################################################
# wannier90
###########################################################

w90: uncompress-w90 configure-w90
	if test -d ../W90; then \
	cd ../W90; $(MAKE) all || exit 1; cd ../bin; ln -fs ../W90/wannier90.x . ; fi
	-(cd ../bin; ln -fs ../W90/wannier90.x .)
	touch make-w90
uncompress-w90: touch-dummy
	@(if test ! -s ../archive/$(W90).tar.gz && test ! -d ../W90 ; then \
	wget -O ../archive/$(W90).tar.gz $(W90_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(W90).tar.gz $(W90_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download wannier90. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(W90).tar.gz from $(W90_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../W90; then \
	(gzip -dc ../archive/$(W90).tar.gz | (cd ../ ; tar -xvf -)) ; \
	(cd ../ ; ln -s $(W90) W90) ; fi 
	touch uncompress-w90

configure-w90: touch-dummy
	cd ../W90 ; \
	if (test -e ../install/make_wannier90.sys) || (test -d ../W90); then \
	(cp ../install/make_wannier90.sys ../W90/make.sys); fi 
	touch ./configure-w90
###########################################################
# WANT
###########################################################

want: extlibs uncompress-want configure-want
	if test -d ../WANT; then \
	cd ../WANT; $(MAKE) all || exit 1; fi
#	- ( cd ../bin ; ln -sf ../WANT/bin/* . ) 
	touch ./make-want
uncompress-want: touch-dummy
	@(if test ! -s ../archive/$(WANT)-base.tar.gz && test ! -d ../WANT ; then \
	wget -O ../archive/$(WANT)-base.tar.gz $(WANT_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(WANT)-base.tar.gz $(WANT_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download want. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(WANT)-base.tar.gz from $(WANT_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../WANT; then \
	(gzip -dc ../archive/$(WANT)-base.tar.gz | (cd ../ ; tar -xvf -)) ; \
	(cd ../ ; ln -s $(WANT) WANT) ; fi 
	touch uncompress-want

configure-want: touch-dummy
	cd ../WANT ; \
	./conf/configure \
	--with-external-iotk \
	IOTK_LIBS="-L../../S3DE/iotk/src -liotk" \
	IOTK_INCLUDE="$(MOD_FLAG)../../S3DE/iotk/src" \
	CC="$(CC)" \
	F90="$(F90)" \
	MPIF90="$(MPIF90)" \
	F90FLAGS="$(F90FLAGS) $($PRE_FDFLAGS) $(FDFLAGS) $(IFLAGS) $(MODFLAGS)" \
	F77="$(F77)" \
	FFLAGS="$(FFLAGS)" \
	FFLAGS_NOOPT="$(FFLAGS_NOOPT)" \
	LD="$(LD)" \
	LDFLAGS="$(LDFLAGS)" \
	AR="$(AR)" \
	ARFLAGS="$(ARFLAGS)" \
	RANLIB="$(RANLIB)" \
	DFLAGS="$(DFLAGS)" \
	FDFLAGS="$(DFLAGS)" \
	LAPACK_LIBS="$(LAPACK_LIBS)" \
	BLAS_LIBS="$(BLAS_LIBS)" \
	FFT_LIBS="$(FFT_LIBS)" 
	touch ./configure-want

###################################################
# YAMBO
###################################################

yambo: extlibs uncompress-yambo configure-yambo
	if test -d ../YAMBO; then \
	cd ../YAMBO; $(MAKE) all || exit 1; fi
	touch ./make-yambo
uncompress-yambo: touch-dummy
	@(if test ! -s ../archive/$(YAMBO).tar.gz && test ! -d ../YAMBO ; then \
	wget -O ../archive/$(YAMBO).tar.gz $(YAMBO_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(YAMBO).tar.gz $(YAMBO_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download yambo. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(YAMBO).tar.gz from $(YAMBO_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../YAMBO; then \
	(gzip -dc ../archive/$(YAMBO).tar.gz | (cd ../ ; tar -xvf -)) ; \
	(cd ../ ; ln -s $(YAMBO) YAMBO) ; fi 
	touch uncompress-yambo

configure-yambo: touch-dummy
	cd ../YAMBO ; \
	./configure --with-blas="$(BLAS_LIBS)" \
	--with-lapack="$(LAPACK_LIBS)" \
	--with-iotk="$(TOPDIR)/iotk" \
	PFC="$(MPIF90)" \
	FC="$(LD)" \
	FCFLAGS="$(F90FLAGS) $(FDFLAGS) $(IFLAGS) $(MODFLAGS) $(FFLAGS_NOMAIN)"
	F77="$(F77)" \
	FFLAGS="$(FFLAGS)"
	AR="$(AR)" \
	ARFLAGS="$(ARFLAGS)" 
	touch ./configure-yambo
touch-dummy:
	$(dummy-variable)
###########################################################
# plumed
###########################################################

plumed: test-plumed uncompress-plumed patch-plumed
	if test -d ../PLUMED; then \
	cd ../; $(MAKE) pw; $(MAKE) cp; fi
	touch make-plumed
test-plumed: touch-dummy
	@(if test ! -s ../archive/$(PLUMED).tar.gz && test ! -d ../PLUMED; then \
	echo "The release contains no PLUMED package. Trying to download it from qe-forge."; fi) 
	touch ./test-plumed
uncompress-plumed: touch-dummy
	@(if test ! -s ../archive/$(PLUMED).tar.gz && test ! -d ../PLUMED ; then \
	wget -O ../archive/$(PLUMED).tar.gz $(PLUMED_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(PLUMED).tar.gz $(PLUMED_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download plumed. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(PLUMED).tar.gz from $(PLUMED_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../PLUMED; then \
	(gzip -dc ../archive/$(PLUMED).tar.gz | (cd ../ ; tar -xvf -)) ; \
	(cd ../ ; ln -s $(PLUMED) PLUMED) ; fi 
	touch uncompress-plumed

patch-plumed: touch-dummy
	if test -d ../PLUMED; then \
	(cd ../PLUMED ; export plumedir="`pwd`" ; \
	cp  patches/plumedpatch_qespresso_5.1.sh ../ ; \
	cd ../ ; ./plumedpatch_qespresso_5.1.sh -patch) ; fi	
	touch ./patch-plumed

##################################
# SaX
##################################

sax: extlibs uncompress-sax configure-sax
	if test -d ../SaX; then \
	cd ../SaX; $(MAKE) sax_all; fi
#	- ( cd ../bin ; ln -sf ../SaX/sax/bin/* . ) 
	touch ./make-sax
uncompress-sax: touch-dummy
	@(if test ! -s ../archive/$(SAX).tar.gz && test ! -d ../SaX ; then \
	wget -O ../archive/$(SAX).tar.gz $(SAX_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(SAX).tar.gz $(SAX_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download SaX. Test whether curl or wget is installed and working." ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(SAX).tar.gz from $(SAX_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../SaX; then \
	(gzip -dc ../archive/$(SAX).tar.gz | (cd ../ ; tar -xvf -)) ; \
	(cd ../ ; ln -s $(SAX) SaX) ; fi 
	touch uncompress-sax

configure-sax: touch-dummy
	cd ../SaX ; \
	./configure \
	--with-external-iotk \
	IOTK_LIBS="-L../../S3DE/iotk/src -liotk" \
	IOTK_INCLUDE="$(MOD_FLAG)../../S3DE/iotk/src" \
	CC="$(CC)" \
	F90="$(F90)" \
	MPIF90="$(MPIF90)" \
	F90FLAGS="$(F90FLAGS) $($PRE_FDFLAGS) $(FDFLAGS) $(IFLAGS) $(MODFLAGS)" \
	F77="$(F77)" \
	FFLAGS="$(FFLAGS)" \
	FFLAGS_NOOPT="$(FFLAGS_NOOPT)" \
	LD="$(LD)" \
	LDFLAGS="$(LDFLAGS)" \
	AR="$(AR)" \
	ARFLAGS="$(ARFLAGS)" \
	RANLIB="$(RANLIB)" \
	DFLAGS="$(DFLAGS)" \
	FDFLAGS="$(DFLAGS)" \
	LAPACK_LIBS="$(LAPACK_LIBS)" \
	BLAS_LIBS="$(BLAS_LIBS)" \
	FFT_LIBS="$(FFT_LIBS)" 
	touch ./configure-sax


##################################
# extlibs
###################################
extlibs:
	test -n "$(EXTLIBS)" && ( cd .. ; $(MAKE) $(EXTLIBS) || exit 1) || :

##########################################################
# GUI
###########################################################
gui:  uncompress-gui
	touch make-gui
uncompress-gui: touch-dummy
	@(if test ! -s ../archive/$(GUI).tgz && test ! -d ../GUI && test ! -d ../$(GUI); then \
	wget -O ../archive/$(GUI).tgz $(GUI_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(GUI).tgz $(GUI_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download pwGUI. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(GUI).tar.gz from $(GUI_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	if test ! -d ../GUI && test ! -d ../$(GUI); then \
	(gzip -dc ../archive/$(GUI).tgz | (cd ../ ; tar -xvf -)) ; fi
	touch uncompress-gui

##########################################################
# GPU
###########################################################
gpu:  uncompress-gpu
	touch make-gpu
uncompress-gpu: touch-dummy
	@(if test ! -s ../archive/$(GPU).tar.gz && test ! -d ../GPU && test ! -d ../$(GPU); then \
	wget -O ../archive/$(GPU).tar.gz $(GPU_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	curl -o ../archive/$(GPU).tar.gz $(GPU_URL) > /dev/null 2>&1; \
	if test "`echo $$?`" -ne "0" ; then \
	echo "*** Unable to download QE-GPU. Test whether curl or wget is installed and working," ; \
	echo "*** if you have direct access to internet. If not, copy into archive/ the file" ; \
	echo "*** $(GPU).tar.gz from $(GPU_URL)." ; \
	exit 1 ; fi ; fi ; fi) 
	@ echo ""
	@ echo " *****************************************************************************"
	@ echo " * QE-GPU has been downloaded under ./archive Please follow the instructions *"
	@ echo " *   reported here: http://qe-forge.org/gf/project/q-e-gpu/                  *" 
	@ echo " *****************************************************************************"
	@ echo ""
	touch uncompress-gpu

###################################
# cleaning
###################################
# each lib independently
ld1_clean:
	if test -d ../atomic; then (cd ../atomic; \
	$(MAKE) clean); fi
	rm -f ../bin/ld1.x
	rm -rf ./make-ld1 

ld1_veryclean: ld1_clean
# dir is not deleted for compatibility with the repository

xspectra_clean:
	if test -d ../XSpectra; then (cd ../XSpectra; \
	$(MAKE) clean); fi
	rm -f ../bin/xspectra.x
	rm -rf ./make-xspectra

xspectra_veryclean: xspectra_clean
# dir is not deleted for compatibility with the repository

pwcond_clean:
	if test -d ../PWCOND; then (cd ../PWCOND; \
	$(MAKE) clean); fi
	rm -f ../bin/pwcond.x
	rm -rf ./make-pwcond

pwcond_veryclean: pwcond_clean
# dir is not deleted for compatibility with the repository

neb_clean:
	if test -d ../NEB; then (cd ../NEB; \
	$(MAKE) clean); fi
	rm -f ../bin/neb.x
	rm -rf ./make-neb
 
neb_veryclean: neb_clean
# dir is not deleted for compatibility with the repository

tddfpt_clean:
	if test -d ../TDDFPT; then (cd ../TDDFPT; \
	$(MAKE) clean); fi
	rm -f ../bin/turbo_lanczos.x
	rm -f ../bin/turbo_spectrum.x
	rm -rf ./make-tddfpt

tddfpt_veryclean: tddfpt_clean 
# dir is not deleted for compatibility with the repository

phonon_clean:
	if test -d ../PHonon; then (cd ../PHonon; \
	$(MAKE) clean); fi
	rm -rf ../bin/ph.x
	rm -rf ../bin/dynmat.x
	rm -rf ../bin/matdyn.x
	rm -rf ../bin/q2r.x
	rm -rf ../bin/q2qstar.x
	rm -rf ../bin/lambda.x
	rm -rf ../bin/fqha.x
	rm -rf ../bin/phcg.x
	rm -rf ../bin/d3.x
	rm -rf ./make-phonon 

phonon_veryclean: phonon_clean
# dir is not deleted for compatibility with the repository
# exe links to main bin dir are deleted by PHonon Makefile

gipaw_clean:
	if test -d ../GIPAW; then (cd ../GIPAW; $(MAKE) clean); fi
	rm -f ../bin/gipaw.x
	rm -rf ./make-gipaw 

gipaw_veryclean: gipaw_clean
	if test -d ../GIPAW; then (cd ../GIPAW; \
	rm -f config.log config.status ); fi
	rm -rf ./configure-gipaw

epw_clean:
	if test -d ../EPW; then (cd ../EPW; \
	$(MAKE) clean); fi
	rm -f ../bin/epw.x
	rm -rf ./make-epw 
epw_veryclean: epw_clean

w90_clean:
	if test -d ../W90; then (cd ../W90; \
	$(MAKE) veryclean); fi
	rm -f ../bin/wannier90.x
	rm -rf ./make-w90 ./configure-w90
w90_veryclean: w90_clean
	if test -d ../W90; then (rm -R -f ../W90); fi
	if test -d ../$(W90); then (rm -R -f ../$(W90)); fi
	rm -f ../bin/wannier90.x
	rm -rf ./uncompress-w90
want_clean:
	if test -d ../WANT; then (cd ../WANT; \
	$(MAKE) clean); fi
	- rm -rf ./make-want ./configure-want

want_veryclean: want_clean
	if test -d ../WANT; then (rm -R -f ../WANT); fi
	if test -d ../$(WANT); then (rm -R -f ../$(WANT)); fi
	- rm -rf ./uncompress-want
yambo_clean:
	if test -d ../YAMBO; then (cd ../YAMBO; \
	$(MAKE) clean); fi
	- rm -rf ./make-yambo ./configure-yambo

yambo_veryclean: yambo_clean
	if test -d ../YAMBO; then (rm -R -f ../YAMBO); fi
	if test -d ../$(YAMBO); then (rm -R -f ../$(YAMBO)); fi
	- rm -rf ./uncompress-yambo

plumed_clean:
	if test -d ../PLUMED; then (cd ../PLUMED; \
	export plumedir="`pwd`" ; \
	cd ../ ; ./plumedpatch_qespresso_5.1.sh -revert); fi
	cd ../PW ; $(MAKE) clean; cd ../CPV ; $(MAKE) clean
	rm -rf ./make-plumed ./patch-plumed

plumed_veryclean: plumed_clean
	if test -d ../PLUMED; then (rm -R -f ../PLUMED); fi
	if test -d ../$(PLUMED); then (rm -R -f ../$(PLUMED)); fi
	rm -rf ./uncompress-plumed ../plumedpatch_qespresso_5.1.sh

sax_clean:
	if test -d ../SaX; then (cd ../SaX; \
	$(MAKE) clean); fi
	- rm -rf ./make-sax ./configure-sax

sax_veryclean: sax_clean
	if test -d ../SaX; then (rm -R -f ../SaX); fi
	if test -d ../$(SAX); then (rm -R -f ../$(SAX)); fi
	- rm -rf ./uncompress-sax

gui_clean:
	rm -rf ./make-gui 

gui_veryclean: gui_clean
# dir is not deleted for compatibility with the repository

gpu_clean:
	rm -f ./make-gpu 

gpu_veryclean: gpu_clean
# dir is not deleted for compatibility with the repository

##########################################################
# general cleaning
##########################################################
clean: w90_clean want_clean yambo_clean plumed_clean epw_clean \
	gui_clean phonon_clean tddfpt_clean xspectra_clean neb_clean pwcond_clean \
	ld1_clean gipaw_clean gpu_clean 
veryclean: w90_veryclean want_veryclean yambo_veryclean plumed_veryclean epw_veryclean \
	gui_veryclean phonon_veryclean tddfpt_veryclean xspectra_veryclean neb_veryclean \
	pwcond_veryclean ld1_veryclean gipaw_veryclean gpu_veryclean