forked from shingleproject/Shingle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
213 lines (165 loc) · 6.26 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
##############################################################################
#
# Copyright (C) 2011-2018 Dr Adam S. Candy and others.
#
# Shingle: An approach and software library for the generation of
# boundary representation from arbitrary geophysical fields
# and initialisation for anisotropic, unstructured meshing.
#
# Web: http://www.shingleproject.org
#
# Contact: Dr Adam S. Candy, contact@shingleproject.org
#
# This file is part of the Shingle project.
#
# Please see the AUTHORS file in the main source directory for a full list
# of contributors.
#
# Shingle is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Shingle 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Shingle. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
ECHO = echo
MAKE = make
PYPI = pypi
default: bin/shingle
bin/shingle: src/shingle lib/libspud.so
@mkdir -p bin
@cp src/shingle bin/shingle
@chmod a+rx bin/shingle
install: bin/shingle
@$(ECHO) 'INSTALL shingle Python library'
@pip install .
clean:
@echo 'CLEAN test legacy'
@$(MAKE) -s -C test/legacy clean
@echo 'CLEAN test'
@rm -f test/*/*.log test/*/*.geo
@echo 'CLEAN shingle'
@rm -f shingle/*.pyc
@echo 'CLEAN tool'
@rm -f tool/spud-preprocess
@echo 'CLEAN lib'
@rm -rf lib
@echo 'CLEAN doc'
@$(MAKE) -s -C doc clean
@echo 'CLEAN spud'
@$(MAKE) -s -C spud clean
@echo 'CLEAN bin'
@rm -rf bin
@rm -rf spud.egg-info libspud.egg-info shingle.egg-info build dist
manual:
@$(MAKE) -s -C doc ShingleManual.pdf
# ------------------------------------------------------------------------
package:
@$(MAKE) -s packageclean
@$(ECHO) 'PACKAGE shingle'
@python setup.py sdist bdist_wheel
@$(ECHO) 'PACKAGE dxdiff'
@cd spud/dxdiff; python setup.py sdist; cp -rp dist/* ../../dist/; cd ../..
@$(ECHO) 'PACKAGE diamond'
@cd spud/diamond; python setup.py sdist; cp -rp dist/* ../../dist/; cd ../..
packageupload: package
@$(ECHO) 'PACKAGE UPLOAD shingle diamond dxdiff'
@twine upload --skip-existing dist/*
packageinstall: package
@$(ECHO) 'INSTALL shingle Python library'
@pip install ./dist/shingle-*.tar.gz
@$(ECHO) 'INSTALL dxdiff'
@pip install ./dist/dxdiff-*.tar.gz
@$(ECHO) 'INSTALL diamond'
@pip install ./dist/spud-diamond-*.tar.gz
packageclean:
@$(ECHO) 'PACKAGE CLEAN'
@rm -f dist/* spud/dxdiff/dist/* spud/diamond/dist/*
.PHONY: package packageupload packageinstall packageclean
# ------------------------------------------------------------------------
test: bin/shingle
@./bin/shingle -t test --tag continuous
testimage:
@./bin/shingle -t test --image
@convert ./test/*/*.png ./test/ShingleVerificationOverviewImages.pdf
testimagelabel:
@label -tf -nd -d test/images test/*/*.png
@convert test/images/*.png test/ShingleVerificationOverviewImages.pdf
@rm -r test/images
unittest:
@cd shingle; py.test; cd ..
# ------------------------------------------------------------------------
testlegacy:
@echo "Legacy test engine:"
@$(MAKE) -s -C test/legacy
testall:
@$(MAKE) test
@$(MAKE) testlegacy
data:
@$(MAKE) -s -C test/legacy data
datalink:
@$(MAKE) -s -C test/legacy datalink
testwithdatadownload:
@$(MAKE) -s -C test/legacy testwithdatadownload
.PHONY: test testlegacy data datalink testwithdatadownload schema doc datalocal
# ------------------------------------------------------------------------
spud: lib/libspud.so tool/spud-preprocess
libspud: lib/libspud.so
lib/libspud.so:
@mkdir -p lib
@python setup.py build_ext --inplace
@mv libspud.so lib/
@cd shingle; ln -sf ../lib/libspud.so .; cd ..
@mkdir -p bin
@cd bin; ln -sf ../lib/libspud.so .; cd ..
#@$(MAKE) -C spud install-pyspud
#@cp lib/python*/site-packages/libspud.so lib/
#@cp lib/python*/site-packages/libspud.so shingle/
# ------------------------------------------------------------------------
schema: schema/shingle_options.rng .FORCE
schema/shingle_options.rng: tool/spud-preprocess .FORCE
@echo "Rebuilding schema shingle_options.rng"
@./tool/spud-preprocess schema/shingle_options.rnc
tool/spud-preprocess: lib/libspud.so
@mkdir -p ./tool
@cp spud/bin/spud-preprocess tool/
@chmod a+x ./tool/spud-preprocess
@sed -i 's/\.\.\/share\/spud/schema/' ./tool/spud-preprocess
@sed -i -e 's/^\(cp \)\/share\(\/spud\)/\1\.\2\/schema/' ./tool/spud-preprocess
.FORCE:
# ------------------------------------------------------------------------
spudpatch:
@patch -p0 < spud.patch
# ------------------------------------------------------------------------
datalocal: dataset/Caribbean.nc dataset/ChilePacificWide.nc dataset/Coquimbo.nc dataset/SouthernOcean_noshelf_30m_fg.nc dataset/RTopo105b_50S.nc
dataset/Caribbean.nc:
@echo Downloading $@
@mkdir -p dataset
@curl -s 'https://zenodo.org/record/399213/files/Caribbean.nc' -o ./dataset/Caribbean.nc
dataset/ChilePacificWide.nc:
@echo Downloading $@
@mkdir -p dataset
@curl -s 'https://zenodo.org/record/399213/files/ChilePacificWide.nc' -o ./dataset/ChilePacificWide.nc
dataset/Coquimbo.nc:
@echo Downloading $@
@mkdir -p dataset
@curl -s 'https://zenodo.org/record/399213/files/Coquimbo.nc' -o ./dataset/Coquimbo.nc
dataset/SouthernOcean_noshelf_30m_fg.nc:
@echo Downloading $@
@mkdir -p dataset
@curl -s 'https://zenodo.org/record/399213/files/SouthernOcean_noshelf_30m_fg.nc' -o ./dataset/SouthernOcean_noshelf_30m_fg.nc
dataset/RTopo105b_50S.nc:
@echo Downloading $@
@mkdir -p dataset
@curl -s 'http://store.pangaea.de/Publications/TimmermannR_et_al_2010/RTopo105b_50S.nc' -o ./dataset/RTopo105b_50S.nc
test/Amundsen_Sea/data/RTopo.nc:
@wget --progress=dot:giga http://store.pangaea.de/Publications/TimmermannR_et_al_2010/RTopo105b_50S.nc -O test/Amundsen_Sea/data/RTopo.nc
pre_download_large_datasets: test/Amundsen_Sea/data/RTopo.nc
.PHONY: pre_download_large_datasets test/Amundsen_Sea/data/RTopo.nc