-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
237 lines (206 loc) · 6.72 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
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
#!/bin/bash
#----------------------------------------------------------------------------------------
#
# Copyright (C) 2018-2022 ENVIRON (www.quantum-environ.org)
#
#----------------------------------------------------------------------------------------
#
# This file is part of Environ version 3.0
#
# Environ 3.0 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Environ 3.0 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more detail, either the file
# `License' in the root directory of the present distribution, or
# online at <http://www.gnu.org/licenses/>.
#
#----------------------------------------------------------------------------------------
#
# Authors: Oliviero Andreussi (Department of Physics, UNT)
# Edan Bainglass (Department of Physics, UNT)
#
#----------------------------------------------------------------------------------------
#
# Makefile for Environ
#
#----------------------------------------------------------------------------------------
ifndef VERBOSE
.SILENT:
endif
.PHONY: install
ENVIRON_VERSION=3.1
################################################################################
# HELP/LIST
################################################################################
default:
@ echo
@ echo "- make help -> installation manual"
@ echo
@ echo "- make devs -> developer options"
@ echo
# quick manual
help:
@ echo
@ sed -n '/^# QE + Environ/,/^---/p' README.md
@ echo
# rundown of developer make routines
devs:
@ echo
@ echo "Installation"
@ echo "------------"
@ echo
@ echo "* see 'make help'"
@ echo
@ echo "Compilation"
@ echo "-----------"
@ echo
@ echo "* compile (requires Environ/make.inc)"
@ echo
@ echo " - compiles Environ's UtilXlib, FFTXlib, and src"
@ echo " - compilation generates Environ/install/Environ_comp.log"
@ echo
@ echo "Updating Dependencies"
@ echo "---------------------"
@ echo
@ echo "* depend"
@ echo
@ echo " - updates dependencies in Environ's UtilXlib, FFTXlib, and src"
@ echo
@ echo "* cannibalize-QE"
@ echo
@ echo " - updates UtilXlib and FFTXlib to currently checked-out QE branch"
@ echo
@ echo "Cleaning"
@ echo "--------"
@ echo
@ echo "* clean (requires Environ/make.inc)"
@ echo
@ echo " - remove Environ objects, libraries, and compilation logs"
@ echo
@ echo "* veryclean (requires Environ/make.inc)"
@ echo
@ echo " - 'make clean' + removes configuration files"
@ echo
################################################################################
# COMPILATION ROUTINES
################################################################################
compile: check-makeinc
@ printf "\nCompiling Environ $(ENVIRON_VERSION)...\n"; \
$(MAKE) compile-util; \
$(MAKE) compile-fft; \
$(MAKE) compile-src; \
$(MAKE) compile-programs; \
( \
cd install; \
cat UtilXlib_comp.log FFTXlib_comp.log src_comp.log > Environ_comp.log; \
/bin/rm UtilXlib_comp.log FFTXlib_comp.log src_comp.log \
)
@ printf "\nEnviron $(ENVIRON_VERSION) compilation successful! \n"
compile-util: check-makeinc
@ printf "\nCompiling UtilXlib...\n\n" 2>&1 | \
tee install/UtilXlib_comp.log
@ ( cd UtilXlib && $(MAKE) all || exit 1 ) 2>&1 | tee -a install/UtilXlib_comp.log
@ $(MAKE) check-for-errors prog=UtilXlib
compile-fft: check-makeinc
@ printf "\nCompiling FFTXlib...\n\n" 2>&1 | \
tee install/FFTXlib_comp.log
@ ( cd FFTXlib && $(MAKE) all || exit 1 ) 2>&1 | tee -a install/FFTXlib_comp.log
@ $(MAKE) check-for-errors prog=FFTXlib
compile-src: check-makeinc
@ printf "\nCompiling src...\n\n" 2>&1 | \
tee install/src_comp.log
@ ( cd src && $(MAKE) all || exit 1 ) 2>&1 | tee -a install/src_comp.log
@ $(MAKE) check-for-errors prog=src
compile-programs: check-makeinc
@ printf "\nCompiling programs...\n\n" 2>&1 | \
tee install/programs_comp.log
@ ( cd programs && $(MAKE) || exit 1 ) 2>&1 | tee -a install/programs_comp.log
@ $(MAKE) check-for-errors prog=programs
compile-doc:
@ if test -d Doc ; then (cd Doc; $(MAKE) TLDEPS=all || exit 1 ); fi
################################################################################
# CHECKS
################################################################################
check-makeinc:
@ if [ ! -e make.inc ]; then \
printf "\nMissing make.inc. Please configure installation.\n\n"; \
exit 1; \
fi
check-for-errors:
@ if grep -qE "^make.*Error [0-9]+" install/$(prog)_comp.log; then \
printf "\nErrors found. See install/$(prog)_comp.log\n\n"; \
exit 1; \
else \
printf "\n$(prog) compilation successful! \n"; \
exit; \
fi
################################################################################
# DEPENDENCY UPDATING ROUTINE
################################################################################
depend:
@ printf "\nUpdating Environ dependencies...\n\n"
@ ./install/makedeps.sh; echo
cannibalize-QE:
@ if test -d $(qedir) && test $(version); then \
./update_libs.sh -l fft -p $(qedir) -m -v $(version); \
./update_libs.sh -l util -p $(qedir) -m -v $(version); \
fi
################################################################################
# CLEANING
################################################################################
# remove executables and objects
clean: check-makeinc
@ $(MAKE) clean-libs
@ $(MAKE) clean-bin
@ $(MAKE) clean-logs
@ $(MAKE) clean-util
@ $(MAKE) clean-fft
@ $(MAKE) clean-src
@ $(MAKE) clean-programs
clean-bin:
@ printf "bin..........."
@ if test -d bin; then /bin/rm -fr bin; fi
@ printf " done! \n"
clean-libs:
@ printf "libs.........."
@ if test -d libs; then /bin/rm -fr libs; fi
@ printf " done! \n"
clean-logs:
@ printf "logs.........."
@ ( \
cd install && \
find . -type f -name '*log' -not -name config.log | xargs /bin/rm -f \
)
@ printf " done! \n"
clean-util:
@ printf "UtilXlib......"
@ (cd UtilXlib && $(MAKE) clean)
@ printf " done! \n"
clean-fft:
@ printf "FFTXlib......."
@ (cd FFTXlib && $(MAKE) clean)
@ printf " done! \n"
clean-src:
@ printf "src..........."
@ (cd src && $(MAKE) clean)
@ printf " done! \n"
clean-programs:
@@ printf "programs......"
@ (cd programs && $(MAKE) clean)
@ printf " done! \n"
clean-doc:
@ printf "Docs.........."
@ (cd Doc && $(MAKE) clean)
@ printf " done! \n"
# also remove configuration files
veryclean: clean
@ printf "config........"
@ (cd install && \
/bin/rm -rf *.log configure.msg config.status)
@ /bin/rm make.inc
@ printf " done! \n"