File: rules

package info (click to toggle)
gromacs 2019.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 161,296 kB
  • sloc: cpp: 1,425,236; xml: 218,793; ansic: 40,813; python: 11,629; sh: 2,409; yacc: 644; perl: 620; fortran: 397; makefile: 243; lisp: 215; lex: 129; awk: 68; csh: 33
file content (320 lines) | stat: -rwxr-xr-x 13,782 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
#!/usr/bin/make -f
#
# build script for GROMACS

PACKAGE := gromacs

DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_CPU  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
DEB_HOST_ARCH_OS   ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

# add hardening flags, using dpkg-buildflags
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
#653916 and http://www.cmake.org/Bug/view.php?id=12928
CFLAGS   += $(CPPFLAGS)
CXXFLAGS += $(CPPFLAGS)

ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -g -Wall
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
endif

LDFLAGS += -Wl,--as-needed

COMMON_CONFIG_PARAMS = \
	$(CURDIR) \
	-DCMAKE_VERBOSE_MAKEFILE=ON \
	-DCMAKE_RULE_MESSAGES=OFF \
	-DCMAKE_INSTALL_PREFIX="/usr" \
	-DCMAKE_EXE_LINKER_FLAGS="$(LDFLAGS)" \
	-DGMX_EXTERNAL_ZLIB=ON

# For compatibility reasons, disable SIMD CPU optimizations EXCEPT
# for SSE2 on x86/amd64, VSX on ppc64el, and NEON on armhf/arm64.
# For local compilations, set DEB_BUILD_OPTIONS=cpuopt for automatic
# detection of the best available option.
# See http://www.gromacs.org/Documentation/Acceleration_and_parallelization#Acceleration
# and http://manual.gromacs.org/documentation/2016.3/install-guide/index.html#simd-support
ifeq (,$(findstring cpuopt,$(DEB_BUILD_OPTIONS)))
ifeq ($(DEB_HOST_ARCH_CPU), i386)
	COMMON_CONFIG_PARAMS += -DGMX_SIMD=SSE2
else ifeq ($(DEB_HOST_ARCH_CPU), amd64)
	COMMON_CONFIG_PARAMS += -DGMX_SIMD=SSE2
else ifeq ($(DEB_HOST_ARCH_CPU), ppc64el)
	COMMON_CONFIG_PARAMS += -DGMX_SIMD=IBM_VSX
else ifeq ($(DEB_HOST_ARCH_CPU), armhf)
	COMMON_CONFIG_PARAMS += -DGMX_SIMD=ARM_NEON
else ifeq ($(DEB_HOST_ARCH_CPU), arm64)
	COMMON_CONFIG_PARAMS += -DGMX_SIMD=ARM_NEON_ASIMD
else
	COMMON_CONFIG_PARAMS += -DGMX_SIMD=None
endif
endif

# Include "gpu" in DEB_BUILD_OPTIONS to build GPU-accelerated binaries as well.
# This build option is not always well tested, please send comments.
# You must have the pacakges "nvidia-cuda-toolkit" and "nvidia-cuda-dev"
# installed. Those are not official build dependencies to keep the package in
# Debian main!
#
# If you use this option, it is strongly recommended that you also set
# DEB_BUILD_OPTIONS=cpuopt, assuming you are compiling and running on the same
# machine.
#
# Further details at http://www.gromacs.org/GPU_acceleration
GPU_CONFIG_PARAMS =
ifneq (,$(findstring gpu,$(DEB_BUILD_OPTIONS)))
	GPU_CONFIG_PARAMS += -DGMX_GPU=ON
endif

MPICH_CONFIG_PARAMS = \
	-DGMX_MPI=ON \
	-DGMX_X11=OFF \
	-DGMX_DEFAULT_SUFFIX=OFF \
	-DMPIEXEC="/usr/bin/mpiexec.mpich" \
	-DGMX_BUILD_MDRUN_ONLY=ON

OPENMPI_CONFIG_PARAMS = \
	-DGMX_MPI=ON \
	-DGMX_X11=OFF \
	-DGMX_DEFAULT_SUFFIX=OFF \
	-DCMAKE_EXE_LINKER_FLAGS="-L/usr/lib/openmpi/lib $(LDFLAGS)" \
	-DMPIEXEC="/usr/bin/mpiexec.openmpi" \
	-DGMX_BUILD_MDRUN_ONLY=ON

# optional parallel build
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	MAKE += -j$(NUMJOBS)
endif

export GTEST_COLOR=no
export CTEST_OUTPUT_ON_FAILURE=1

configure: configure-stamp
configure-stamp:
	dh_testdir
	(mkdir -p build/basic; cd build/basic; cmake $(COMMON_CONFIG_PARAMS) $(GPU_CONFIG_PARAMS) -DGMX_MPI=OFF -DGMX_X11=ON -DBUILD_SHARED_LIBS=ON)
	(mkdir -p build/basic-dp; cd build/basic-dp; cmake $(COMMON_CONFIG_PARAMS) -DGMX_MPI=OFF -DGMX_X11=ON -DBUILD_SHARED_LIBS=ON -DGMX_DOUBLE=ON)
	(mkdir -p build/mpich; cd build/mpich; CC=/usr/bin/mpicc.mpich CXX=/usr/bin/mpicxx.mpich cmake \
	$(COMMON_CONFIG_PARAMS) $(MPICH_CONFIG_PARAMS) $(GPU_CONFIG_PARAMS) -DGMX_BINARY_SUFFIX="_mpi.mpich" -DGMX_LIBS_SUFFIX="_mpi.mpich")
	(mkdir -p build/mpich-dp; cd build/mpich-dp; CC=/usr/bin/mpicc.mpich CXX=/usr/bin/mpicxx.mpich cmake \
	$(COMMON_CONFIG_PARAMS) $(MPICH_CONFIG_PARAMS) -DGMX_DOUBLE=ON -DGMX_BINARY_SUFFIX="_mpi_d.mpich" -DGMX_LIBS_SUFFIX="_mpi_d.mpich")
	(mkdir -p build/openmpi; cd build/openmpi; CC=/usr/bin/mpicc.openmpi CXX=/usr/bin/mpicxx.openmpi cmake \
	$(COMMON_CONFIG_PARAMS) $(OPENMPI_CONFIG_PARAMS) $(GPU_CONFIG_PARAMS) -DGMX_BINARY_SUFFIX="_mpi.openmpi" -DGMX_LIBS_SUFFIX="_mpi.openmpi")
	(mkdir -p build/openmpi-dp; cd build/openmpi-dp; CC=/usr/bin/mpicc.openmpi CXX=/usr/bin/mpicxx.openmpi cmake \
	$(COMMON_CONFIG_PARAMS) $(OPENMPI_CONFIG_PARAMS) -DGMX_DOUBLE=ON -DGMX_BINARY_SUFFIX="_mpi_d.openmpi" -DGMX_LIBS_SUFFIX="_mpi_d.openmpi")
	touch $@


build: build-arch build-indep

build-arch: configure-stamp build-basic build-mpich build-openmpi
build-indep: build-manual

build-basic: configure-stamp
	dh_testdir
	$(MAKE) -C build/basic
	$(MAKE) -C build/basic-dp
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	$(MAKE) -C build/basic tests
	(cd build/basic;    LD_LIBRARY_PATH=$(CURDIR)/build/basic/lib    ctest -V || dpkg-architecture -i hurd-i386 )
	$(MAKE) -C build/basic-dp tests
	(cd build/basic-dp; LD_LIBRARY_PATH=$(CURDIR)/build/basic-dp/lib ctest -V || dpkg-architecture -i hurd-i386 )
endif
	touch $@

build-manual:
	dh_testdir
	# Build speedy, stripped-down version just for documentation generation.
	# Derived from admin/build-docs.sh
	(mkdir -p build/documentation ; cd build/documentation; \
	cmake $(CURDIR) -DCMAKE_BUILD_TYPE=Debug -DGMX_OPENMP=OFF -DGMX_SIMD=None -DGMX_GPU=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES=OFF -DGMX_BUILD_MANUAL=ON)
	$(MAKE) gmx -C build/documentation
	# Generate PDF
	$(MAKE) manual -C build/documentation
	# Generate HTML
	# This sometimes seems to work the *second* time?  Still trying to trace it down.
	$(MAKE) webpage -C build/documentation || \
	(echo "===== Failed to build documentation, retrying." ; $(MAKE) webpage -C build/documentation )

build-mpich: configure-stamp
	dh_testdir
	$(MAKE) -C build/mpich
	$(MAKE) -C build/mpich-dp
	sed -e 's/#MPIABBR#/mpich/g' -e 's/#MPIPROG#/MPICH/g' \
	    < debian/gromacs-parallel.README.Debian.in \
	    > debian/gromacs-mpich.README.Debian
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
ifneq ($(DEB_HOST_ARCH), armhf)
	$(MAKE) -C build/mpich tests
	(cd build/mpich;     LD_LIBRARY_PATH=$(CURDIR)/build/mpich/lib    ctest -V || dpkg-architecture -i hurd-i386 )
	$(MAKE) -C build/mpich-dp tests
	(cd build/mpich-dp ; LD_LIBRARY_PATH=$(CURDIR)/build/mpich-dp/lib ctest -V || dpkg-architecture -i hurd-i386 )
endif
endif
	touch $@

build-openmpi: configure-stamp
	dh_testdir
	$(MAKE) -C build/openmpi
	$(MAKE) -C build/openmpi-dp
	sed -e 's/#MPIABBR#/openmpi/g' -e 's/#MPIPROG#/OpenMPI/g' \
	    < debian/gromacs-parallel.README.Debian.in \
	    > debian/gromacs-openmpi.README.Debian
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# rsh_agent: https://bugs.debian.org/494046
	# oversubscribe: https://bugs.debian.org/850229#51
	$(MAKE) -C build/openmpi tests
	(cd build/openmpi    ; LD_LIBRARY_PATH=$(CURDIR)/build/openmpi/lib \
                               OMPI_MCA_plm_rsh_agent=/bin/false \
                               OMPI_MCA_rmaps_base_oversubscribe=1 \
                               ctest -V || dpkg-architecture -i hurd-i386 || dpkg-architecture -i x32 )
	$(MAKE) -C build/openmpi-dp tests
	(cd build/openmpi-dp ; LD_LIBRARY_PATH=$(CURDIR)/build/openmpi-dp/lib \
                               OMPI_MCA_plm_rsh_agent=/bin/false \
                               OMPI_MCA_rmaps_base_oversubscribe=1 \
                               ctest -V || dpkg-architecture -i hurd-i386 || dpkg-architecture -i x32 )
endif
	touch $@


clean:
	dh_testdir
	dh_testroot
	rm -rf build docs/doxygen/*.pyc
	dh_clean build-basic build-mpich build-openmpi build-manual configure-stamp \
	         debian/gromacs-mpich.README.Debian debian/gromacs-openmpi.README.Debian


install: build-arch install-basic install-mpich install-openmpi
	dh_testdir
	dh_testroot
	dh_prep -pgromacs-data -plibgromacs-dev

	dh_installdirs -pgromacs-data
	mv $(CURDIR)/debian/gromacs/usr/share/gromacs/top \
	   $(CURDIR)/debian/gromacs-data/usr/share/gromacs
	mv $(CURDIR)/debian/gromacs/usr/share/man \
	   $(CURDIR)/debian/gromacs-data/usr/share/man
	# some of the default installation directories for documentation and
	# example shell scripts are not FHS-friendly; move them appropriately
	cat $(CURDIR)/debian/gromacs/usr/bin/gmx*.bash > \
	    $(CURDIR)/debian/gromacs-data/usr/share/bash-completion/completions/gmx
	rm -f $(CURDIR)/debian/gromacs/usr/bin/GMXRC* $(CURDIR)/debian/gromacs/usr/bin/gmx*.bash
	# symlinks, primarily for /usr/share/doc/{gromacs,libgromacs*} -> gromacs-data
	dh_link -pgromacs-data
	# rename a pair of Perl scripts to drop the .pl extension (Policy 10.4)
	mv $(CURDIR)/debian/gromacs/usr/bin/demux.pl     $(CURDIR)/debian/gromacs/usr/bin/demux
	mv $(CURDIR)/debian/gromacs/usr/bin/xplor2gmx.pl $(CURDIR)/debian/gromacs/usr/bin/xplor2gmx

	mkdir -p $(CURDIR)/debian/libgromacs4/usr/lib/$(DEB_HOST_MULTIARCH)
	mv $(CURDIR)/debian/gromacs/usr/lib/*/*.so.* $(CURDIR)/debian/libgromacs4/usr/lib/$(DEB_HOST_MULTIARCH)/

	dh_installdirs -plibgromacs-dev
	mv $(CURDIR)/debian/gromacs/usr/include $(CURDIR)/debian/libgromacs-dev/usr/include
	# catch normal libraries plus all applicable MPI variants
	mkdir -p $(CURDIR)/debian/libgromacs-dev/usr/lib/$(DEB_HOST_MULTIARCH)
	mv $(CURDIR)/debian/gromacs/usr/lib/$(DEB_HOST_MULTIARCH)/*.so \
	   $(CURDIR)/debian/gromacs/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \
	   $(CURDIR)/debian/libgromacs-dev/usr/lib/$(DEB_HOST_MULTIARCH)/
	rmdir $(CURDIR)/debian/gromacs/usr/lib/$(DEB_HOST_MULTIARCH) $(CURDIR)/debian/gromacs/usr/lib
	mv $(CURDIR)/debian/gromacs/usr/share/gromacs/template $(CURDIR)/debian/libgromacs-dev/usr/share/gromacs/template
	# remaining documentation catch-all
	mv $(CURDIR)/debian/gromacs/usr/share/gromacs/* $(CURDIR)/debian/gromacs-data/usr/share/doc/gromacs
	-rmdir $(CURDIR)/debian/gromacs/usr/share/gromacs
	# what are you doing here?
	mv $(CURDIR)/debian/gromacs/usr/share/cmake $(CURDIR)/debian/libgromacs-dev/usr/share/gromacs/
	dh_lintian -pgromacs -pgromacs-data -plibgromacs4

install-manual: build-manual install
	dh_testdir
	dh_testroot
	dh_install -pgromacs-data
	rdfind -outputname /dev/null -makesymlinks true $(CURDIR)/debian/gromacs-data/usr/share/doc/
	symlinks -r -s -c $(CURDIR)/debian/gromacs-data/usr/share/doc/

install-basic: build-arch
	dh_testdir
	dh_testroot
	dh_prep -pgromacs
	dh_installdirs -pgromacs
	$(MAKE) -C build/basic install DESTDIR=$(CURDIR)/debian/gromacs
	$(MAKE) -C build/basic-dp install DESTDIR=$(CURDIR)/debian/gromacs
	dh_installman -pgromacs debian/man/demux.1 debian/man/xplor2gmx.1
	# gmx(1) -> gmx_d(1)
	dh_link -pgromacs -pgromacs-data
	# temporary as of 2019-beta2 and removal of CMAKE_SKIP_RPATH
	chrpath -d $(CURDIR)/debian/gromacs/usr/bin/gmx $(CURDIR)/debian/gromacs/usr/bin/gmx_d

install-mpich: build-mpich
	dh_testdir
	dh_testroot
	dh_prep -pgromacs-mpich
	dh_installdirs -pgromacs-mpich
	$(MAKE) -C build/mpich install DESTDIR=$(CURDIR)/debian/gromacs-mpich
	$(MAKE) -C build/mpich-dp install DESTDIR=$(CURDIR)/debian/gromacs-mpich
	chmod 644 $(CURDIR)/debian/gromacs-mpich/usr/bin/gmx-completion*
	mv $(CURDIR)/debian/gromacs-mpich/usr/bin/gmx-completion-mdrun_mpi.mpich.bash $(CURDIR)/debian/gromacs-mpich/usr/share/bash-completion/completions/mdrun_mpi.mpich
	mv $(CURDIR)/debian/gromacs-mpich/usr/bin/gmx-completion-mdrun_mpi_d.mpich.bash $(CURDIR)/debian/gromacs-mpich/usr/share/bash-completion/completions/mdrun_mpi_d.mpich
	# temporary as of 2019-beta2
	chrpath -d $(CURDIR)/debian/gromacs-mpich/usr/bin/mdrun_mpi*
	dh_installman -pgromacs-mpich debian/man/mdrun_mpi.mpich.1
	dh_link -pgromacs-mpich usr/share/man/man1/mdrun_mpi.mpich.1.gz usr/share/man/man1/mdrun_mpi_d.mpich.1.gz
	dh_lintian -pgromacs-mpich

install-openmpi: build-openmpi
	dh_testdir
	dh_testroot
	dh_prep -pgromacs-openmpi
	dh_installdirs -pgromacs-openmpi
	$(MAKE) -C build/openmpi install DESTDIR=$(CURDIR)/debian/gromacs-openmpi
	$(MAKE) -C build/openmpi-dp install DESTDIR=$(CURDIR)/debian/gromacs-openmpi
	chmod 644 $(CURDIR)/debian/gromacs-openmpi/usr/bin/gmx-completion*
	mv $(CURDIR)/debian/gromacs-openmpi/usr/bin/gmx-completion-mdrun_mpi.openmpi.bash $(CURDIR)/debian/gromacs-openmpi/usr/share/bash-completion/completions/mdrun_mpi.openmpi
	mv $(CURDIR)/debian/gromacs-openmpi/usr/bin/gmx-completion-mdrun_mpi_d.openmpi.bash $(CURDIR)/debian/gromacs-openmpi/usr/share/bash-completion/completions/mdrun_mpi_d.openmpi
	# Force-disable RUNPATH - see <https://github.com/open-mpi/ompi/issues/521>
	# and lintian tag binary-or-shlib-defines-rpath in versions >= 2.5.50
	chrpath -d $(CURDIR)/debian/gromacs-openmpi/usr/bin/mdrun_mpi*
	dh_installman -pgromacs-openmpi debian/man/mdrun_mpi.openmpi.1
	dh_link -pgromacs-openmpi usr/share/man/man1/mdrun_mpi.openmpi.1.gz usr/share/man/man1/mdrun_mpi_d.openmpi.1.gz
	dh_lintian -pgromacs-openmpi

binary-indep: build-arch build-indep install install-manual
	dh_testdir
	dh_testroot
	dh_installchangelogs -i
	dh_installdocs -pgromacs-data
	dh_compress -i -X.pdf
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build-arch install
	dh_testdir -a
	dh_testroot -a
	dh_installchangelogs -a
	dh_installdocs -a
	dh_strip -A
	dh_compress -a
	dh_fixperms -a
	dh_makeshlibs -a
	dh_shlibdeps -plibgromacs4 -L libgromacs4 -l debian/libgromacs4/usr/lib
	dh_shlibdeps -pgromacs -L libgromacs4 -l debian/libgromacs4/usr/lib:debian/gromacs/usr/lib
	dh_shlibdeps -pgromacs-mpich -L gromacs-mpich -l debian/gromacs-mpich/usr/lib
	dh_shlibdeps -pgromacs-openmpi -L gromacs-openmpi -l debian/gromacs-openmpi/usr/lib
	dh_gencontrol -a
	dh_installdeb -a
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

.PHONY: binary binary-arch binary-indep build clean install install-basic install-mpich install-openmpi install-manual