File: rules

package info (click to toggle)
gromacs 4.0.7-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 56,760 kB
  • ctags: 28,606
  • sloc: asm: 844,232; ansic: 264,574; sh: 11,691; makefile: 1,755; csh: 702; perl: 685; python: 264
file content (271 lines) | stat: -rwxr-xr-x 10,770 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
#!/usr/bin/make -f
#
# build script for GROMACS

# export DH_VERBOSE=1

# debhelper compatibility version set to 5 in debian/compat

PACKAGE := gromacs
include /usr/share/dpatch/dpatch.make

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

# OpenMPI is only supported on a subset of architectures at this time.
# This list should remain synced with the Build-Depends and the Architecture
# line of gromacs-openmpi in debian/control.

OPENMPI_ARCH    = alpha amd64 i386 ia64 powerpc sparc kfreebsd-i386 kfreebsd-amd64 hurd-i386
DEB_HOST_ARCH  ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

CFLAGS =
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 = \
	--host=$(DEB_HOST_GNU_TYPE) \
	--build=$(DEB_BUILD_GNU_TYPE) \
	--prefix=/usr \
	--exec_prefix=\$${prefix} \
	--datadir=\$${prefix}/share \
	--mandir=\$${prefix}/share/man \
	--infodir=\$${prefix}/share/info \
	--enable-shared

ifdef CFLAGS
	COMMON_CONFIG_PARAMS += CFLAGS="$(CFLAGS)"
endif

MPICH_CONFIG_PARAMS = \
	--enable-mpi \
	--without-x \
	--without-gsl \
	MPICC=/usr/bin/mpicc.mpich2 \
	CC=/usr/bin/mpicc.mpich2

OPENMPI_CONFIG_PARAMS = \
	--enable-mpi \
	--disable-fortran \
	--without-x \
	--without-gsl \
	MPICC=/usr/bin/mpicc.openmpi \
	CC=/usr/bin/mpicc.openmpi \
	LDFLAGS="-L/usr/lib/openmpi/lib $(LDFLAGS)"

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

# gfortran transition: configure script looks for f77/g77 binaries, not f95/g95/gfortran
# FORTRAN inner loops are used on Alpha only
ifneq (,$(findstring alpha,$(DEB_HOST_GNU_TYPE)))
	export F77=/usr/bin/gfortran
endif

configure: patch-stamp configure-stamp
configure-stamp: patch-stamp
	dh_testdir
	-test -r /usr/share/misc/config.sub && \
	   cp -f /usr/share/misc/config.sub config.sub
	-test -r /usr/share/misc/config.guess && \
	   cp -f /usr/share/misc/config.guess config.guess
	# patch 04_autoconf_mpisuffix changes configure.ac, requiring a fresh autotools pass
	autoreconf --force --install --verbose
	# -dp is the place for double-precision builds
	(mkdir -p build/basic; cd build/basic; ../../configure $(COMMON_CONFIG_PARAMS) --with-gsl )
	(mkdir -p build/basic-dp; cd build/basic-dp; ../../configure $(COMMON_CONFIG_PARAMS) --with-gsl --program-suffix=_d --enable-double)
	(mkdir -p build/mpich; cd build/mpich; ../../configure $(COMMON_CONFIG_PARAMS) $(MPICH_CONFIG_PARAMS) LIBSUFFIX=_mpi_mpich --program-suffix=_mpi.mpich)
	(mkdir -p build/mpich-dp; cd build/mpich-dp; ../../configure $(COMMON_CONFIG_PARAMS) $(MPICH_CONFIG_PARAMS) LIBSUFFIX=_mpi_d_mpich --program-suffix=_mpi_d.mpich --enable-double)
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH)))
	(mkdir -p build/openmpi; cd build/openmpi; ../../configure $(COMMON_CONFIG_PARAMS) $(OPENMPI_CONFIG_PARAMS) LIBSUFFIX=_mpi_openmpi --program-suffix=_mpi.openmpi)
	(mkdir -p build/openmpi-dp; cd build/openmpi-dp; ../../configure $(COMMON_CONFIG_PARAMS) $(OPENMPI_CONFIG_PARAMS) LIBSUFFIX=_mpi_d_openmpi --program-suffix=_mpi_d.openmpi --enable-double)
endif
	touch $@


build: patch-stamp configure-stamp build-basic build-mpich build-openmpi

build-basic: configure-stamp
	dh_testdir
	$(MAKE) -C build/basic
	$(MAKE) -C build/basic-dp
	touch $@

build-mpich: configure-stamp
	dh_testdir
	$(MAKE) -C build/mpich mdrun 
	$(MAKE) -C build/mpich-dp mdrun
	sed -e 's/#MPIABBR#/mpich/g' -e 's/#MPIPROG#/MPICH2/g' \
	    < debian/gromacs-parallel.README.Debian.in \
	    > debian/gromacs-mpich.README.Debian
	touch $@
	
build-openmpi: configure-stamp
	dh_testdir
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH)))
	$(MAKE) -C build/openmpi mdrun
	$(MAKE) -C build/openmpi-dp mdrun
	sed -e 's/#MPIABBR#/openmpi/g' -e 's/#MPIPROG#/OpenMPI/g' \
	    < debian/gromacs-parallel.README.Debian.in \
	    > debian/gromacs-openmpi.README.Debian
endif
	touch $@	


clean: clean-patched unpatch
clean-patched:
	dh_testdir
	dh_testroot
	rm -rf build
	dh_clean patch-stamp build-basic build-mpich build-openmpi configure-stamp \
	         debian/gromacs-mpich.README.Debian debian/gromacs-openmpi.README.Debian


install: build install-basic install-lam install-mpich install-openmpi
	dh_testdir
	dh_testroot
	dh_prep -pgromacs-data -pgromacs-dev
	
	# remove a duplicated file
	rm -f $(CURDIR)/debian/gromacs/usr/share/gromacs/tutor/gmxdemo/demo_d
	
	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/gromacs/tutor \
	   $(CURDIR)/debian/gromacs-data/usr/share/gromacs
	mv $(CURDIR)/debian/gromacs/usr/share/gromacs/html \
	   $(CURDIR)/debian/gromacs-data/usr/share/doc/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
	mv $(CURDIR)/debian/gromacs/usr/bin/GMXRC* \
	   $(CURDIR)/debian/gromacs/usr/bin/completion* \
	   $(CURDIR)/debian/gromacs-data/usr/share/gromacs/shell-specific
	chmod 644 $(CURDIR)/debian/gromacs-data/usr/share/gromacs/shell-specific/*
	dh_link -pgromacs-data usr/share/doc/gromacs/html usr/share/doc/gromacs-data/html
	dh_link -pgromacs-data usr/share/doc/gromacs/html usr/share/doc/gromacs-dev/html
	# one lintian warnings is overridden:
	# - csh-considered-harmful: from a tutorial script, not essential for routine package operation
	cp $(CURDIR)/debian/lintian-overrides.gromacs-data \
	   $(CURDIR)/debian/gromacs-data/usr/share/lintian/overrides/gromacs-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

	dh_installdirs -pgromacs-dev
	mv $(CURDIR)/debian/gromacs/usr/include $(CURDIR)/debian/gromacs-dev/usr/include
	# catch normal libraries plus all applicable MPI variants
	mv $(CURDIR)/debian/gromacs/usr/lib/*.so $(CURDIR)/debian/gromacs/usr/lib/*.a $(CURDIR)/debian/gromacs/usr/lib/*.la $(CURDIR)/debian/gromacs-dev/usr/lib
	mv $(CURDIR)/debian/gromacs-mpich/usr/lib/*.so $(CURDIR)/debian/gromacs-mpich/usr/lib/*.a $(CURDIR)/debian/gromacs-mpich/usr/lib/*.la $(CURDIR)/debian/gromacs-dev/usr/lib
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH)))
	mv $(CURDIR)/debian/gromacs-openmpi/usr/lib/*.so $(CURDIR)/debian/gromacs-openmpi/usr/lib/*.a $(CURDIR)/debian/gromacs-openmpi/usr/lib/*.la $(CURDIR)/debian/gromacs-dev/usr/lib
endif
	mv $(CURDIR)/debian/gromacs/usr/share/gromacs/template $(CURDIR)/debian/gromacs-dev/usr/share/gromacs/template
	-rmdir $(CURDIR)/debian/gromacs/usr/share/gromacs


install-basic: build
	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
	rm -f $(CURDIR)/debian/gromacs/usr/share/man/man1/*_d.1
	dh_installman -pgromacs debian/man/luck.1 debian/man/g_kinetics.1 debian/man/gromacs.7
	for manpage in $(CURDIR)/debian/gromacs/usr/share/man/man1/*.1; do \
		dh_link -pgromacs usr/share/man/man1/`basename $${manpage}` usr/share/man/man1/`basename $${manpage} .1`_d.1 ; \
	done
	# man pages for a pair of Perl scripts are installed *after* the _d duplication,
	# as they have no double-precision variants.
	dh_installman -pgromacs debian/man/demux.1 debian/man/xplor2gmx.1
	# three lintian warnings are overridden:
	# - package-name-doesnt-match-sonames: the libraries are private to
	#   GROMACS, and it's unlikely that any new package will start using
	#   them; therefore, separate lib packages would just be bloat.
	#   This is also overridden for the -mpich and -openmpi packages.
	# - shlib-with-executable-stack: it's a side effect of the ASM inner
	#   loops (i386/amd64 only)
	# - binary-without-manpage: shipped in gromacs-data instead.
	cp $(CURDIR)/debian/lintian-overrides.gromacs $(CURDIR)/debian/gromacs/usr/share/lintian/overrides/gromacs

install-lam: build
	dh_testdir
	dh_testroot
	dh_prep -pgromacs-lam

install-mpich: build
	dh_testdir
	dh_testroot
	dh_prep -pgromacs-mpich
	dh_installdirs -pgromacs-mpich
	$(MAKE) -C build/mpich install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-mpich
	$(MAKE) -C build/mpich-dp install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-mpich
	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
	cp $(CURDIR)/debian/lintian-overrides.gromacs-mpich $(CURDIR)/debian/gromacs-mpich/usr/share/lintian/overrides/gromacs-mpich

install-openmpi: build
	dh_testdir
	dh_testroot
	dh_prep -pgromacs-openmpi
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH)))
	dh_installdirs -pgromacs-openmpi
	$(MAKE) -C build/openmpi install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-openmpi
	$(MAKE) -C build/openmpi-dp install-mdrun DESTDIR=$(CURDIR)/debian/gromacs-openmpi
	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
	cp $(CURDIR)/debian/lintian-overrides.gromacs-openmpi $(CURDIR)/debian/gromacs-openmpi/usr/share/lintian/overrides/gromacs-openmpi
endif

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -i
	dh_installdocs -pgromacs-data
	dh_compress -i
	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build install
	dh_testdir -s
	dh_testroot -s
	dh_installchangelogs -s
	dh_installdocs -s
	dh_strip -A
	dh_link -s
	dh_compress -s
	dh_fixperms -s
	dh_makeshlibs -s
	dh_shlibdeps -pgromacs -L gromacs -l debian/gromacs/usr/lib
	dh_shlibdeps -pgromacs-mpich -L gromacs-mpich -l debian/gromacs-mpich/usr/lib
ifneq (,$(findstring $(DEB_HOST_ARCH),$(OPENMPI_ARCH)))
	dh_shlibdeps -pgromacs-openmpi -L gromacs-openmpi -l debian/gromacs-openmpi/usr/lib
endif
	dh_gencontrol -s
	dh_installdeb -s
	dh_md5sums -s
	dh_builddeb -s

binary: binary-indep binary-arch

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

# Because multiple versions of the same programs are created using the same source tree,
# the various build-* targets can't be compiled simultaneously.
# Passing down -j# to child make processes remains unaffected.
.NOTPARALLEL: