File: rules

package info (click to toggle)
hdf5 1.8.13%2Bdocs-15%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 171,908 kB
  • ctags: 30,335
  • sloc: ansic: 387,195; f90: 35,195; sh: 20,035; xml: 17,780; cpp: 13,516; makefile: 1,487; perl: 1,299; yacc: 327; lex: 178; ruby: 37
file content (346 lines) | stat: -rwxr-xr-x 12,589 bytes parent folder | download | duplicates (2)
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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
#!/usr/bin/make -f

# debian/rules for libhdf5,
# (c) 2001 Brian Russo, under GPL.
# (c) 2003 Josselin Mouette
# (c) 2007-2009 Francesco P. Lovergine.
# (c) 2010-2013 Sylvestre Ledru
# (c) 2014 Gilles Filippini

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

package = libhdf5
pkgversion ?= $(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
version ?= $(shell echo $(pkgversion) | sed 's/\([0-9\.]\)\(+docs[0-9]*\)\?-[^-]*$$/\1/')
soname =  8
major_version = $(shell echo $(version) | cut -d. -f1,2)
serpack = $(package)-$(soname)
sercpppack = $(package)-cpp-$(soname)
openmpipack = $(package)-openmpi-$(soname)
mpichpack = $(package)-mpich-$(soname)
virtpack = $(package)-$(major_version)

DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

ifneq (,$(wildcard /usr/share/mpi-default-dev/debian_defaults))
include /usr/share/mpi-default-dev/debian_defaults 
endif
DEFAULT_MPI=$(ARCH_DEFAULT_MPI_IMPL)

# Arches to build MPI flavors on
# Setting empty OMPIARCHS and MPICHARCHS environment variables disables
# the related mpi targets
#
# To be used if openmpi binary packages were buildable on any arch
#ARCH_FLAG=-a
#ARCHS=any
ARCH_FLAG=-s
OMPIARCHS?=alpha amd64 armel armhf arm64 i386 ia64 powerpc powerpcspe ppc64 ppc64el sparc sparc64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 mips64 mips64el mips mipsel
MPICHARCHS?=any

ifeq (,$(or $(filter $(DEB_HOST_ARCH),$(OMPIARCHS)),$(filter any,$(OMPIARCHS))))
build_openmpi = no
else
build_openmpi = yes
endif

ifeq (,$(or $(filter $(DEB_HOST_ARCH),$(MPICHARCHS)),$(filter any,$(MPICHARCHS))))
build_mpich = no
else
build_mpich = yes
endif

ifeq ($(build_openmpi),yes)
configure_stamp_openmpi = configure-stamp-openmpi
build_stamp_openmpi = build-stamp-openmpi
install_openmpi = install-openmpi
else
configure_stamp_openmpi =
build_stamp_openmpi =
install_openmpi =
endif

ifeq ($(build_mpich),yes)
configure_stamp_mpich = configure-stamp-mpich
build_stamp_mpich = build-stamp-mpich
install_mpich = install-mpich
else
configure_stamp_mpich =
build_stamp_mpich =
install_mpich =
endif

ifeq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
       USE_PROD = yes
else
       USE_PROD = no
endif

# export DEB_BUILD_OPTIONS="parallel=2"
#
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	MAKEFLAGS += -j$(NUMJOBS)
endif	

CONFIGURE_FLAGS = --prefix=/usr --host=$(DEB_HOST_GNU_TYPE) \
		  --build=$(DEB_BUILD_GNU_TYPE) \
		  --mandir=\$${prefix}/share/man \
		  --with-pthread --enable-linux-lfs --enable-unsupported \
		  --enable-shared --enable-production=$(USE_PROD) \
		  --disable-sharedlib-rpath --with-zlib --with-default-api-version=v18 \
		  --enable-fortran --enable-fortran2003
SERIAL_FLAGS = --enable-threadsafe --enable-cxx --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --includedir=\$${prefix}/include/hdf5/serial --with-flavor=serial
OPENMPI_FLAGS = --enable-parallel=yes --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --includedir=\$${prefix}/include/hdf5/openmpi --with-flavor=openmpi
MPICH_FLAGS = --enable-parallel=yes --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) --includedir=\$${prefix}/include/hdf5/mpich --with-flavor=mpich

configure: configure-stamp-debian configure-stamp \
	   $(configure_stamp_openmpi) $(configure_stamp_mpich)

configure-stamp-debian: debian/control.in
	# This loop generates helper files from debian/*.*.in templates
	cd debian && for file in *.*.in; do \
	  for flavor in serial openmpi mpich; do \
	    helper=`basename $$file .in | sed 's/soname/$(soname)/g'` ; \
	    flavorpkgstr="" ; \
	    flavorlibstr="" ; \
	    ifmpi="#"; \
	    ifserial=""; \
	    if [ "$$flavor" != "serial" ]; then \
	      if echo "$$helper" | grep -Eq '\-cpp'; then \
	        continue ; \
	      fi ; \
	      flavorpkgstr="-$$flavor" ; \
	      ifmpi="" ; \
	      ifserial="#"; \
	    fi ; \
	    flavorlibstr="_$$flavor" ; \
	    helper=`echo $$helper | sed 's/-flavor/'$$flavorpkgstr'/'` ; \
	    sed -e 's/@FLAVORLIB@/'$$flavorlibstr'/g' \
		-e 's/@FLAVORPKG@/'$$flavorpkgstr'/g' \
		-e 's/@FLAVOR@/'$$flavor'/g' \
                -e 's/@IFMPI@/'$$ifmpi'/g' \
                -e 's/@IFSERIAL@/'$$ifserial'/g' \
                -e 's/@MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' \
                -e 's/@SONAME@/$(soname)/g' \
	      $$file >$$helper ; \
	    done ; \
	  done
	#
	mkdir -p m4
	dh_autoreconf
	touch $@
	echo "builddeps:Built-Using=doxygen (= $$(dpkg-query -W -f='$${source:Version}' doxygen))" >>debian/libhdf5-doc.substvars

configure-stamp: configure-stamp-debian
	dh_testdir
	-mkdir debian/build
# configure serial version
	cd debian/build && CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" FFLAGS="$(FFLAGS)" CC=/usr/bin/cc CXX=/usr/bin/c++ FC=gfortran \
		H5_LDFLAGS="-Wl,--version-script,\$$(top_srcdir)/debian/map_serial.ver" \
		../../configure $(CONFIGURE_FLAGS) $(SERIAL_FLAGS) || { cat config.log; exit 1; }
	# Upgrade the doxygen configuration file
	cp c++/src/cpp_doc_config c++/src/cpp_doc_config_u
	cd c++/src && doxygen -s -u cpp_doc_config_u
	touch $@

configure-stamp-openmpi: configure-stamp-debian
	dh_testdir
	-mkdir debian/build-openmpi
# configure version with openmpi
	cd debian/build-openmpi && CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" FFLAGS="$(FFLAGS)" \
		H5_LDFLAGS="-Wl,--version-script,\$$(top_srcdir)/debian/map_mpi.ver" \
		CC=mpicc.openmpi FC=mpif90.openmpi F9X=mpif90.openmpi RUNPARALLEL=/usr/bin/mpirun.openmpi \
		OMPI_MCA_disable_memory_allocator=1 ../../configure $(CONFIGURE_FLAGS) $(OPENMPI_FLAGS) \
		|| { cat config.log; exit 1; }
	ln debian/man/h5pcc.1 debian/man/h5pcc.openmpi.1
	ln debian/man/h5pfc.1 debian/man/h5pfc.openmpi.1
	touch $@

configure-stamp-mpich: configure-stamp-debian
	dh_testdir
	-mkdir debian/build-mpich
# configure version with mpich
	cd debian/build-mpich && CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" FFLAGS="$(FFLAGS)" \
		H5_LDFLAGS="-Wl,--version-script,\$$(top_srcdir)/debian/map_mpi.ver" \
		CC=mpicc.mpich \
		CXX=mpicxx.mpich FC=mpif90.mpich F9X=mpif90.mpich RUNPARALLEL=/usr/bin/mpirun.mpich \
		../../configure $(CONFIGURE_FLAGS) $(MPICH_FLAGS) \
		|| { cat config.log; exit 1; }
	ln debian/man/h5pcc.1 debian/man/h5pcc.mpich.1
	ln debian/man/h5pfc.1 debian/man/h5pfc.mpich.1
	touch $@

prep: 
	dh_prep


build: build-arch build-indep
build-arch: build-stamp $(build_stamp_openmpi) $(build_stamp_mpich)
build-indep: build-stamp-doc

build-stamp: configure-stamp
	dh_testdir
	$(MAKE) $(MAKEFLAGS) -C debian/build/
	touch $@

build-stamp-openmpi: configure-stamp-openmpi 
	dh_testdir
	$(MAKE)  $(MAKEFLAGS) -C debian/build-openmpi/ OMPI_MCA_disable_memory_allocator=1
	touch $@

build-stamp-mpich: configure-stamp-mpich 
	dh_testdir
	$(MAKE)  $(MAKEFLAGS) -C debian/build-mpich/
	touch $@

build-stamp-doc: configure-stamp
	cd c++/src && doxygen cpp_doc_config_u >/dev/null
	rm -rf html/cpplus_RM
	mv c++/src/HTML/HTML html/cpplus_RM
	touch $@

#
# Be sure to not have a previous version installed before running
# the test suite
#
test: build-stamp
	$(MAKE) -C debian/build/ test

clean:
	test -f debian/control.in
	-rm -rf debian/build
	-rm -rf debian/build-openmpi
	-rm -rf debian/build-mpich
	grep -v ^\% debian/control.in | sed -e "s/@SONAME@/$(soname)/g" -e "s/@OMPIARCHS@/$(OMPIARCHS)/" -e "s/@MPICHARCHS@/$(MPICHARCHS)/" -e "s/@MAJOR_VERSION@/$(major_version)/" > debian/control
	dh_autoreconf_clean
	rm -rf m4
	-cd debian && rm -f `ls libhdf5-*.install libhdf5-*.shlibs libhdf5-*.doc | grep -v 'libhdf5-doc'`
	-rm -rf c++/src/HTML
	-rm -rf html/cpplus_RM
	-rm -f c++/src/cpp_doc_config_u*
	-rm -f debian/man/h5pcc.*.1
	-rm -f debian/man/h5pfc.*.1
	dh_clean configure-stamp* build-stamp* install-stamp*

install: build prep install-serial $(install_openmpi) $(install_mpich) install-doc

install-serial: build-stamp
	dh_testdir
	dh_testroot
	-mkdir debian/build/tmpinst
	$(MAKE) -C debian/build/ install prefix=$(CURDIR)/debian/build/tmpinst/usr
	chrpath -d $(CURDIR)/debian/build/tmpinst/usr/lib/*/libhdf5*so*
	dh_install -p$(serpack) -p$(package)-dev -phdf5-helpers -phdf5-tools -p$(sercpppack) \
		--sourcedir=debian/build/tmpinst
	find debian/$(serpack)/usr/lib -name '*cpp*' -delete
	install -d debian/$(package)-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	sed 's/@MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' debian/hdf5-serial.pc >debian/$(package)-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/hdf5-serial.pc

install-openmpi: build-stamp-openmpi
	dh_testdir
	dh_testroot
	-mkdir debian/build-openmpi/tmpinst
	$(MAKE) -C debian/build-openmpi/ install prefix=$(CURDIR)/debian/build-openmpi/tmpinst/usr
	chrpath -d $(CURDIR)/debian/build-openmpi/tmpinst/usr/lib/*/libhdf5*so*
	dh_install -p$(openmpipack) -p$(package)-openmpi-dev \
		--sourcedir=debian/build-openmpi/tmpinst
	install -d debian/$(package)-openmpi-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	sed 's/@MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' debian/hdf5-openmpi.pc >debian/$(package)-openmpi-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/hdf5-openmpi.pc
	cd debian/$(package)-openmpi-dev/usr/bin && \
		mv h5pcc h5pcc.openmpi && \
		mv h5pfc h5pfc.openmpi

install-mpich: build-stamp-mpich
	dh_testdir
	dh_testroot
	-mkdir debian/build-mpich/tmpinst
	$(MAKE) -C debian/build-mpich/ install prefix=$(CURDIR)/debian/build-mpich/tmpinst/usr
	chrpath -d $(CURDIR)/debian/build-mpich/tmpinst/usr/lib/*/libhdf5*so*
	dh_install -p$(mpichpack) -p$(package)-mpich-dev \
		--sourcedir=debian/build-mpich/tmpinst
	install -d debian/$(package)-mpich-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	sed 's/@MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' debian/hdf5-mpich.pc >debian/$(package)-mpich-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/hdf5-mpich.pc
	cd debian/$(package)-mpich-dev/usr/bin && \
		mv h5pcc h5pcc.mpich && \
		mv h5pfc h5pfc.mpich

install-doc: HTML_DIR := debian/$(package)-doc/usr/share/doc/$(package)-doc/html
install-doc: build-indep
	dh_testdir
	dh_testroot
	dh_install -p$(package)-doc -X Dependencies -X Makefile.in -X CppUserNotes.doc
	# process php in html files
	find "$(HTML_DIR)"/ -type f -iname '*.html' \
	  -execdir /bin/sh -c "/usr/bin/php -f '{}' > '{}.new'" \; \
	  -exec mv "{}.new" "{}" \;

binary-indep: install-doc
	dh_testdir
	dh_testroot
	dh_installdocs -i
	dh_installchangelogs -i -k release_docs/RELEASE.txt
	dh_link
	dh_compress -i -X.pdf
	dh_fixperms -i
	dh_installdeb -i
	dh_lintian -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: prep install-serial $(install_openmpi) $(install_mpich)
	dh_testdir
	dh_testroot
	echo "hdf5-mpi-dev=libhdf5-$(DEFAULT_MPI)-dev" > debian/libhdf5-mpi-dev.substvars
	dh_installdocs $(ARCH_FLAG)
	dh_installman $(ARCH_FLAG)
	dh_lintian $(ARCH_FLAG)
	dh_installchangelogs -a -k release_docs/RELEASE.txt
	dh_link $(ARCH_FLAG)
	dh_strip -phdf5-tools
	dh_strip -phdf5-helpers
	dh_strip -p$(serpack) --dbg-package=$(serpack)-dbg
	dh_strip -p$(sercpppack) --dbg-package=$(sercpppack)-dbg
ifeq ($(build_mpich),yes)
	dh_strip -p$(mpichpack) --dbg-package=$(mpichpack)-dbg
endif
ifeq ($(build_openmpi),yes)
	dh_strip -p$(openmpipack) --dbg-package=$(openmpipack)-dbg
endif
	dh_compress $(ARCH_FLAG)
	dh_fixperms $(ARCH_FLAG)
ifeq ($(build_openmpi),yes)
	dh_makeshlibs -p$(openmpipack) -V $(openmpipack) -- -v$(version)
endif
	dh_makeshlibs -p$(mpichpack) -V $(mpichpack) -- -v$(version)
	dh_makeshlibs -p$(serpack) -V $(serpack) -- -v$(version)
	dh_makeshlibs -p$(sercpppack) -V $(sercpppack) -- -v$(version)
	dh_installdeb $(ARCH_FLAG)
	dh_shlibdeps -p$(serpack) -L$(serpack) -lusr/lib/$(DEB_HOST_MULTIARCH)
	dh_shlibdeps -p$(sercpppack) -L$(serpack) -lusr/lib/$(DEB_HOST_MULTIARCH)
	dh_shlibdeps -phdf5-tools -L$(serpack) -lusr/lib/$(DEB_HOST_MULTIARCH)
	dh_shlibdeps -phdf5-helpers -L$(serpack) -lusr/lib/$(DEB_HOST_MULTIARCH)
ifeq ($(build_openmpi),yes)
	dh_shlibdeps -p$(openmpipack) -L$(openmpipack) -lusr/lib/$(DEB_HOST_MULTIARCH)
endif
ifeq ($(build_mpich),yes)
	dh_shlibdeps -p$(mpichpack) -L$(mpichpack) -lusr/lib/$(DEB_HOST_MULTIARCH)
endif
	dh_gencontrol $(ARCH_FLAG)
	dh_md5sums $(ARCH_FLAG)
	dh_builddeb $(ARCH_FLAG)

binary: binary-indep binary-arch

.PHONY: build clean binary-indep binary-arch binary install configure \
		install-doc install-serial install-openmpi install-mpich prep

.NOTPARALLEL: configure-stamp-debian configure-stamp \
	   $(configure_stamp_openmpi) $(configure_stamp_mpich)