forked from shedsaw/exciting-plus-rgvw-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
169 lines (118 loc) · 4.05 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
###############################################################################
# Main Makefile for Exciting-Plus
###############################################################################
# Note (WYP): this Makefile is heavily skewed towards GNU Make,
# especially the '-C' option
ifndef $MAKE
MAKE = make
endif
# Don't forget to supply a 'make.inc' file
# COMPILER and EXE_SFX should be set inside make.inc
include make.inc
# List of default utilities (ignored if UTILS already set somewhere else)
DEFUTILS := spacegroup pp
#------------------------------------------------------------------------------
.PHONY: all
all: clean-elk elk install-elk
clean: clean-elk clean-utils
distclean: clean-elk clean-allutils clean-docs rmdirs
install: install-elk install-utils
# Note: Only runs elk's standard tests/test-{001..016}
# TODO: add Summit-specific tests and streamline job script generation
test:
cd tests; ./tests.sh
docs: docs-elk docs-spacegroup # docs-crpa
install-docs: docs |
#------------------------------------------------------------------------------
elk: elk-cpu # elk-gpu
elk-cpu:
$(MAKE) -C src gensrc
$(MAKE) -C src elk
clean-elk:
$(MAKE) -C src clean
install-elk: elk | mkdir-bin
cp src/elk bin/elk-$(COMPILER)-$(EXE_SFX)
#------------------------------------------------------------------------------
gensrc:
cd src; $(MAKE) gensrc; cd ..
#------------------------------------------------------------------------------
docs-elk: | mkdir-docs
$(MAKE) -C src doc
cp src/elk.pdf docs/
docs-spacegroup: spacegroup | mkdir-docs
$(MAKE) -C utilities/spacegroup doc
cp utilities/spacegroup/spacegroup.pdf docs/
#docs-crpa: | mkdir-docs
# cp src/addons/CRPA-Calculation.pdf docs/
clean-docs: clean-docs-elk clean-docs-spacegroup # clean-docs-crpa
clean-docs-elk:
$(MAKE) -C src clean-doc
clean-docs-spacegroup:
$(MAKE) -C utilities/spacegroup clean-doc
#------------------------------------------------------------------------------
ifndef $(UTILS)
UTILS := $(DEFUTILS)
endif
utils: $(UTILS)
lsutils:
echo "$(UTILS)"
clean-utils:
$(foreach dir,$(UTILS),$(MAKE) -C utilities/$(dir) clean;)
install-utils: utils | mkdir-bin
$(foreach dir,$(UTILS),$(MAKE) -C utilities/$(dir) install;)
UTILDIRS := $(subst /,,$(subst utilities,,$(shell ls -d utilities/*/)))
lsutildirs:
echo "$(UTILDIRS)"
$(%UTILDIRS):
$(MAKE) -C utilities/$@;
$(foreach util,$(UTILDIRS),lsutil-$(util)):
$(MAKE) -C utilities/$(subst lsutil-,,$@) utilhelp;
$(foreach util,$(UTILDIRS),clean-$(util)):
$(MAKE) -C utilities/$(subst clean-,,$@) clean;
$(foreach util,$(UTILDIRS),install-$(util)): $@
$(MAKE) -C utilities/$(subst install-,,$@) install;
allutils: $(%UTILDIRS)
lsallutils:
$(foreach dir,$(UTILDIRS),$(MAKE) -C utilities/$(dir) lsutil;)
clean-allutils:
$(foreach dir,$(UTILDIRS),$(MAKE) -C utilities/$(dir) clean;)
install-allutils: allutils | mkdir-bin
$(foreach dir,$(UTILDIRS),$(MAKE) -C utilities/$(dir) install;)
#------------------------------------------------------------------------------
mkdirs: mkdir-bin mkdir-docs
mkdir-bin:
[ -d bin ] || mkdir bin
mkdir-docs:
[ -d docs ] || mkdir docs
rmdirs: rmdir-bin rmdir-docs
rmdir-bin:
rm -rf bin/
rmdir-docs:
rm -rf docs/
# Function to dump unexpanded variable
showvar = $(info $(1)='$(value $(1))')
showvars:
@touch .showvars
$(info ) $(call showvar,MAKE)
$(foreach var,COMPILER F90 CC CXX,$(call showvar,$(var))) $(info )
$(foreach var,CPP_OPTS F90_OPTS F90_LINK_OPTS,$(call showvar,$(var)))
$(info ) $(call showvar,EXE_SFX) $(info )
$(call showvar,OMP_OPTS) $(info )
ifdef F90SERIAL
$(call showvar,F90SERIAL) $(call showvar,F90_OPTS_SERIAL) $(info )
else
$(info F90SERIAL not set) $(info )
endif
$(call showvar,LIBS) $(info )
$(call showvar,LAPACK_LIB) $(info )
ifdef HDF5_LIB
$(foreach var,HDF5_CPP_OPTS HDF5_INC HDF5_LIB,$(call showvar,$(var)))
$(info )
else
$(info HDF5 vars not set) $(info )
endif
@rm .showvars
# Workaround for TAU -OptLinking
lsvars:
echo "export LIBS=\"$(LIBS)\"" > libs.sh; chmod +x libs.sh
# echo "export F90_OPTS=\"$(F90_OPTS)\"" > f90opts.sh; chmod +x f90opts.sh