Whamcloud - gitweb
LU-15103 tests: clean up busy cifs mount
[fs/lustre-release.git] / debian / rules
1 #!/usr/bin/make -f
2 #
3 # Created 2009 by Brian J. Murrell based on work by
4 # Alastair McKinstry, <alastair.mckinstry@ichec.ie>, <mckinstry@debian.org>
5 # Patrick Winnertz, and the pkg-lustre Debian maintainers
6 #
7 # Copying and modification is unlimited, provided that the modified
8 # version is marked as being modified.
9
10 # Uncomment this to turn on verbose mode.
11 # export DH_VERBOSE=1
12
13 DEB_BUILD_GNU_SYSTEM = $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
14 DEB_BUILD_GNU_CPU = $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU)
15
16
17 # whether to use module-assistant to build the kernel modules or not
18 USE_MA = true
19
20 # Whether to build the DKMS packages
21 BUILD_DKMS ?= false
22
23 ifeq ($(BUILD_DKMS),true)
24         DKMS_TARGET = binary-$(DKMS_PKG)
25 else
26         DKMS_TARGET =
27 endif
28
29 CFLAGS = -Wall -g
30 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
31         CFLAGS += -O0
32 else
33         CFLAGS += -O2
34 endif
35
36 # We need the kernels to be built with gcc-3.3; suspect that gcc-4.1 uses too
37 # much stack and crashes because of it.
38 #CC?=gcc-3.3
39 #export CC
40
41 # This is the debhelper compatibility version to use.
42 export DH_COMPAT=9
43
44 # Module-assistant stuff
45 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
46         PACKAGE=lustre-server-modules
47 else
48         PACKAGE=lustre-client-modules
49 endif
50 MA_DIR ?= /usr/share/modass
51 -include $(MA_DIR)/include/generic.make
52 -include $(MA_DIR)/include/common-rules.make
53
54 ARCH=$(shell dpkg --print-architecture)
55 TOP_DIR:=$(shell pwd)
56
57 # This is the Lustre version
58 VERSION=$(shell sed -n -e '1s/.*(\(.*\)) .*/\1/p' debian/changelog)
59 UPVERSION=$(shell echo $(VERSION) | sed -e 's/-[^-]*$$//')
60
61 # KVER is set to LINUXRELEASE being by autoconf which is either
62 # $(uname -r) or the version of the source specified by the user
63 KVER?=$(LINUXRELEASE)
64
65 # KVERS, KSRC are the kernel version and source to use when building lustre
66 # Will be the default when building lustre-{server,client}-utils, etc but whatever module-assistant
67 # supplied when building modules
68 KVERS?=$(KVER)
69 KSRC?=$(LINUX_OBJ)
70 KSRC_TREE?=$(LINUX)
71 EXTRA_OPTIONS?=$(IB_OPTIONS)
72
73 # Packages provided for both client and server builds
74 IOKIT_PKG=lustre-iokit
75 TESTS_PKG=lustre-tests
76 DEV_PKG=lustre-dev
77 SOURCE_PKG=lustre-source
78
79 # Packages that are only built for server OR client builds
80 # The difference is that server build contain more modules & utils
81 ifneq (,$(findstring server,$(DEB_BUILD_PROFILES)))
82         UTILS_PKG=lustre-server-utils
83         MODS_PKG=lustre-server-modules
84         RESOURCE_PKG=lustre-resource-agents
85         RESOURCE_TARGET=binary-$(RESOURCE_PKG)
86         DKMS_PKG=
87 else
88         UTILS_PKG=lustre-client-utils
89         MODS_PKG=lustre-client-modules
90         RESOURCE_TARGET=
91         RESOURCE_PKG=
92         DKMS_PKG=lustre-client-modules-dkms
93 endif
94
95 #Build dir
96 #BUILDDIR=debian/build
97 #SRCDIR=../..
98 # I'm afraid we seem to have broken the BUILDDIR concept in Lustre's
99 # autoconf macros
100 BUILDDIR=.
101 SRCDIR=.
102
103 AVAIL_CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
104 ifneq ($(AVAIL_CPUS),1)
105       PMAKEARGS := -j $(AVAIL_CPUS)
106 endif
107
108 autogen: autogen-stamp
109 autogen-stamp: patch-stamp
110         # see if any patches requires us to run autogen
111         # (for a distribution release tarball, it is expected that if
112         #  downstream adds any patches that requires autogen.sh to be
113         #  run, a patch will be added by downstream to install the
114         #  needed autogen.sh scripts
115         #  see https://bugzilla.lustre.org/attachment.cgi?id=27156
116         #  for an example)
117         if grep -e "^--- .*\/autoconf\/" \
118                 -e "^--- .*\/autoMakefile\.am" \
119                 -e "^--- .*\/Makefile\.am" \
120                 -e "^--- .*\/configure\.ac" \
121                 -e "^--- .*\/configure\.in" \
122             debian/patches/*; then \
123                 if [ ! -f build/autogen.sh ]; then \
124                         echo "You have patches which require autogen.sh to be run, but it doesn't exist"; \
125                         echo "Please see https://bugzilla.lustre.org/attachment.cgi?id=27156"; \
126                         exit 1; \
127                 fi; \
128                 cp /usr/share/misc/config.sub config.sub; \
129                 cp /usr/share/misc/config.sub ldiskfs/config.sub; \
130                 cp /usr/share/misc/config.guess config.guess; \
131                 cp /usr/share/misc/config.guess ldiskfs/config.guess; \
132                 sh build/autogen.sh; \
133         fi; \
134         touch $@
135
136 # This section configures the lustre-utilities packages.
137 #
138 # Both client and server builds are quite similar, as the utilities build
139 # must create the modules too, to produce the "osd_<fstype>.so" libraries.
140 #
141 # The main difference is that the utilities build does not archive the
142 # modules, whereas the modules build omits the utilities, to create two
143 # neatly separated debian files.
144 #
145 # Note: KERNEL_SRC, KERNEL_OBJ, ZFS_SRC and SPL_SRC need to be set from the
146 # outside. This is done by "make debs". As such, invoking "debuild" or such
147 # direct debian build tools will lead to a client-only build.
148 configure: configure-stamp
149 configure-stamp: autogen-stamp debian/control.main debian/control.modules.in
150         dh_testdir
151         # touch files to same date, to avoid auto*
152         find . -type f -print0 | xargs -0 touch -r COPYING; \
153         if [ "$(BUILDDIR)" != "." ]; then \
154                 mkdir -p $(BUILDDIR)/build $(BUILDDIR)/lustre/contrib; \
155                 cp build/Makefile $(BUILDDIR)/build/; \
156         fi
157         # Determine flags that are different between server/client module builds
158         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"
159         if echo "$${DEB_BUILD_PROFILES}" | grep -q "server"; then \
160                 export EXTRAFLAGS="--enable-server"; \
161                 if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
162                         cp debian/lustre-server-utils.install.in \
163                                 debian/lustre-server-utils.install; \
164                 else \
165                         sed /systemd/d debian/lustre-server-utils.install.in \
166                                 > debian/lustre-server-utils.install; \
167                 fi; \
168         else \
169                 export EXTRAFLAGS="--disable-server"; \
170                 if echo "$${DEB_BUILD_PROFILES}" | grep -q "systemd"; then \
171                         cp debian/lustre-client-utils.install.in \
172                                 debian/lustre-client-utils.install; \
173                 else \
174                         sed /systemd/d debian/lustre-client-utils.install.in \
175                                 > debian/lustre-client-utils.install; \
176                 fi; \
177         fi; \
178         if echo "$${DEB_BUILD_PROFILES}" | grep -q "zfs"; then \
179                 export EXTRAFLAGS="$${EXTRAFLAGS} --with-zfs=$${ZFS_SRC} --with-spl=$${SPL_SRC}"; \
180         else \
181                 export EXTRAFLAGS="$${EXTRAFLAGS} --without-zfs" ; \
182         fi; \
183         if echo "$${DEB_BUILD_PROFILES}" | grep -q "ldiskfs"; then \
184                 export EXTRAFLAGS="$${EXTRAFLAGS} \
185                         --enable-ldiskfs --enable-quilt"; \
186         else \
187                 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-ldiskfs"; \
188         fi; \
189         if echo "$${DEB_BUILD_PROFILES}" | grep -q "o2ib"; then \
190                 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
191         fi; \
192         if echo "$${DEB_BUILD_PROFILES}" | grep -qw "gss"; then \
193                 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-gss"; \
194         elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "nogss"; then \
195                 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-gss"; \
196         fi; \
197         if echo "$${DEB_BUILD_PROFILES}" | grep -qw "crypto"; then \
198                 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-crypto"; \
199         elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "nocrypto"; then \
200                 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-crypto"; \
201         fi; \
202         # remove env variables from config cache built by initial configure,
203         # and create dedicated cache in temporary build directory
204         if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
205                 export TMP_CACHE_FILE=$$(mktemp); \
206                 sed "/ac_cv_env/d" "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
207                 export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
208         fi; \
209         echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
210         ( cd $(BUILDDIR) && \
211                 $(SRCDIR)/configure --disable-dependency-tracking \
212                         --with-linux=$${KERNEL_SRC} \
213                         --with-linux-obj=$${KERNEL_OBJ} \
214                         --disable-snmp \
215                         --enable-quota \
216                         $${EXTRAFLAGS} \
217                         $(EXTRA_OPTIONS) \
218         ); \
219         touch $@
220
221 build-arch build-indep: build
222
223 build: build-stamp
224 build-stamp: patch-stamp configure-stamp
225         dh_testdir
226         $(MAKE) -C $(BUILDDIR) $(PMAKEARGS)
227         $(MAKE) -C $(BUILDDIR) DESTDIR=$(TOP_DIR)/debian/tmp install
228         # jump our lustre-[client|server]-modules into the control file if not using m-a
229         if ! $(USE_MA); then \
230                 (cat debian/control.main; sed -e '1,/^$$/d' -e "s/_KVERS_/$(KVER)/g" < debian/control.modules.in) > debian/control; \
231                 for file in debian/*_KVERS_*; do \
232                         newfile=$$(echo $$file | sed -e "s/_KVERS_/$(KVER)/g"); \
233                         cp $$file $$newfile; \
234                 done; \
235         fi
236         touch $@
237
238 # let's try and operate as close as the user would and not build modules
239 # here (for now)
240 # instead we will build the modules with m-a in the "make debs" target
241 # binary-arch: binary-$(UTILS_PKG) binary-$(TESTS_PKG) binary-$(DEV_PKG) \
242 # binary-$(MODS_PKG) binary-kern-mods
243 binary-arch: binary-$(UTILS_PKG) binary-$(DEV_PKG) \
244              binary-$(IOKIT_PKG) binary-$(TESTS_PKG) \
245              $(RESOURCE_TARGET)
246
247 binary-indep: binary-$(SOURCE_PKG) $(DKMS_TARGET)
248
249 binary: binary-indep binary-arch
250
251 binary-$(UTILS_PKG): build-stamp
252         dh_testdir
253         dh_testroot
254         dh_installdirs -p $(UTILS_PKG)
255         dh_installdocs -p  $(UTILS_PKG)
256         dh_installman -p $(UTILS_PKG)
257         dh_install -p $(UTILS_PKG)
258         rm -rf debian/$(UTILS_PKG)/usr/bin/iokit-* \
259                debian/$(UTILS_PKG)/usr/bin/*-survey \
260                debian/$(UTILS_PKG)/usr/bin/mcreate \
261                debian/$(UTILS_PKG)/usr/bin/munlink \
262                debian/$(UTILS_PKG)/usr/bin/statx \
263                debian/$(UTILS_PKG)/usr/sbin/wirecheck \
264                debian/$(UTILS_PKG)/usr/sbin/wiretest
265         dh_makeshlibs -p $(UTILS_PKG)
266         dh_installexamples -p $(UTILS_PKG)
267         dh_installchangelogs -p $(UTILS_PKG) lustre/ChangeLog
268         dh_compress -p $(UTILS_PKG)
269         dh_strip -p $(UTILS_PKG)
270         dh_installdeb -p $(UTILS_PKG)
271         dh_fixperms -p $(UTILS_PKG)
272         dh_gencontrol -p $(UTILS_PKG)
273         dh_md5sums -p $(UTILS_PKG)
274         dh_builddeb -p $(UTILS_PKG)
275
276 binary-$(RESOURCE_PKG): build-stamp
277         dh_testdir
278         dh_testroot
279         dh_installdirs -p $(RESOURCE_PKG)
280         dh_installdocs -p  $(RESOURCE_PKG)
281         dh_installman -p $(RESOURCE_PKG)
282         dh_install -p $(RESOURCE_PKG)
283         dh_makeshlibs -p $(RESOURCE_PKG)
284         dh_installexamples -p $(RESOURCE_PKG)
285         dh_installchangelogs -p $(RESOURCE_PKG) lustre/ChangeLog
286         dh_compress -p $(RESOURCE_PKG)
287         dh_strip -p $(RESOURCE_PKG)
288         dh_installdeb -p $(RESOURCE_PKG)
289         dh_fixperms -p $(RESOURCE_PKG)
290         dh_gencontrol -p $(RESOURCE_PKG)
291         dh_md5sums -p $(RESOURCE_PKG)
292         dh_builddeb -p $(RESOURCE_PKG)
293
294 binary-$(IOKIT_PKG): build-stamp
295         dh_testdir
296         dh_testroot
297         dh_installdirs -p $(IOKIT_PKG)
298         dh_installdocs -p  $(IOKIT_PKG)
299         dh_installman -p $(IOKIT_PKG)
300         dh_install -p $(IOKIT_PKG)
301         rm -rf debian/$(IOKIT_PKG)/usr/bin/lustre_req_history \
302                debian/$(IOKIT_PKG)/usr/bin/*ll*stat \
303                debian/$(IOKIT_PKG)/usr/bin/lfs-*
304         dh_makeshlibs -p $(IOKIT_PKG)
305         dh_installexamples -p $(IOKIT_PKG)
306         dh_installchangelogs -p $(IOKIT_PKG) lustre/ChangeLog
307         dh_compress -p $(IOKIT_PKG)
308         dh_strip -p $(IOKIT_PKG)
309         dh_installdeb -p $(IOKIT_PKG)
310         dh_fixperms -p $(IOKIT_PKG)
311         dh_gencontrol -p $(IOKIT_PKG)
312         dh_md5sums -p $(IOKIT_PKG)
313         dh_builddeb -p $(IOKIT_PKG)
314
315 binary-$(TESTS_PKG): build-stamp
316         dh_testdir
317         dh_testroot
318         dh_installdirs -p $(TESTS_PKG)
319         dh_installdocs -p  $(TESTS_PKG)
320         dh_installman -p $(TESTS_PKG)
321         dh_install -p $(TESTS_PKG)
322         dh_makeshlibs -p $(TESTS_PKG)
323         dh_installexamples -p $(TESTS_PKG)
324         dh_installchangelogs -p $(TESTS_PKG) lustre/ChangeLog
325         dh_compress -p $(TESTS_PKG)
326         dh_strip -p $(TESTS_PKG)
327         dh_installdeb -p $(TESTS_PKG)
328         dh_fixperms -p $(TESTS_PKG)
329         dh_gencontrol -p $(TESTS_PKG)
330         dh_md5sums -p $(TESTS_PKG)
331         dh_builddeb -p $(TESTS_PKG)
332
333 binary-$(DEV_PKG): build-stamp
334         dh_testdir
335         dh_testroot
336         dh_installdirs -p $(DEV_PKG)
337         dh_install -p $(DEV_PKG)
338         dh_installdocs -p $(DEV_PKG)
339         dh_installchangelogs -p $(DEV_PKG) lustre/ChangeLog
340         dh_compress -p $(DEV_PKG)
341         dh_installdeb -p $(DEV_PKG)
342         dh_fixperms -p $(DEV_PKG)
343         dh_gencontrol -p $(DEV_PKG)
344         dh_md5sums -p $(DEV_PKG)
345         dh_builddeb -p $(DEV_PKG)
346
347 binary-$(SOURCE_PKG): build-stamp
348         dh_testdir 
349         dh_testroot
350         # Copy everything 
351         dh_installdirs -p $(SOURCE_PKG) usr/src/modules/lustre/debian
352         rsync -av --exclude='debian/$(SOURCE_PKG)/*' \
353               --link-dest=$(PWD) \
354               . debian/$(SOURCE_PKG)/usr/src/modules/lustre
355         # Remove FULLCLEAN setting
356         rm debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
357         sed -e 's/FULLCLEAN=full-clean/FULLCLEAN=/' < debian/rules > debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/rules
358         # clean up dest
359         rm -rf debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patched \
360                debian/$(SOURCE_PKG)/usr/src/modules/lustre/debian/patches/* 
361         $(MAKE) -C debian/$(SOURCE_PKG)/usr/src/modules/lustre -f debian/rules clean
362         # Create the module-source tarball.
363         cd debian/$(SOURCE_PKG)/usr/src && tar jcf lustre.tar.bz2 modules 
364         rm -rf debian/$(SOURCE_PKG)/usr/src/modules
365         dh_install -p$(SOURCE_PKG)
366         dh_installchangelogs -p $(SOURCE_PKG) lustre/ChangeLog
367         dh_installdocs -p $(SOURCE_PKG) 
368         dh_link -p $(SOURCE_PKG) /usr/share/modass/packages/default.sh /usr/share/modass/overrides/lustre-source
369         dh_compress -p $(SOURCE_PKG)
370         dh_installdeb -p $(SOURCE_PKG)
371         dh_fixperms -p $(SOURCE_PKG)
372         dh_gencontrol -p $(SOURCE_PKG)
373         dh_md5sums -p $(SOURCE_PKG)
374         dh_builddeb -p $(SOURCE_PKG)
375
376 binary-$(DKMS_PKG): build-stamp
377         dh_testdir
378         dh_testroot
379         # Create /usr/src/lustre-client-modules-<version>
380         dh_installdirs -p $(DKMS_PKG) usr/src/lustre-client-modules-$(UPVERSION)
381         # Copy the source
382         rsync -av --exclude='debian/$(DKMS_PKG)/*' --exclude='.git/' \
383                 --link-dest=$(PWD) \
384                 . debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)
385         # Clean it up
386         $(MAKE) -C debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION) -f debian/rules clean
387
388         # Put the DKMS configuration file in place
389         sed -e 's/[@]UPVERSION[@]/$(UPVERSION)/' debian/dkms.conf.in > debian/$(DKMS_PKG)/usr/src/lustre-client-modules-$(UPVERSION)/dkms.conf
390         dh_install -p $(DKMS_PKG)
391         dh_installchangelogs -p $(DKMS_PKG) lustre/ChangeLog
392         dh_installdocs -p $(DKMS_PKG)
393         dh_compress -p $(DKMS_PKG)
394         dh_installdeb -p $(DKMS_PKG)
395         dh_strip -p $(DKMS_PKG)
396         dh_fixperms -p $(DKMS_PKG)
397         dh_gencontrol -p $(DKMS_PKG)
398         dh_md5sums -p $(DKMS_PKG)
399         dh_builddeb -p $(DKMS_PKG)
400
401 # if only we could use m-a for this, but this stupid "compliant.list"
402 # thing fouls that up
403 binary-kern-mods:
404         # Build client or server modules
405         mkdir -p debian/m-a_root/usr_src/modules
406         ln -s ../../../../ debian/m-a_root/usr_src/modules/lustre
407         m-a -t -u debian/m-a_root/ -d -v -k $(KSRC) build lustre
408         mv -f debian/m-a_root/*.deb ..
409
410 # an alternative (to module-assistant) method of building the kernel modules
411 binary-$(MODS_PKG): build-stamp
412         if ! $(USE_MA); then \
413                 cp debian/$(MODS_PKG).install debian/$(MODS_PKG)-$(KVER).install ; \
414                 dh_testdir; \
415                 dh_testroot; \
416                 dh_installdirs -p $(MODS_PKG)-$(KVER); \
417                 dh_installdocs -p $(MODS_PKG)-$(KVER); \
418                 dh_install -p $(MODS_PKG)-$(KVER); \
419                 dh_makeshlibs -p $(MODS_PKG)-$(KVER); \
420                 dh_installchangelogs -p $(MODS_PKG)-$(KVER) lustre/ChangeLog; \
421                 dh_compress -p $(MODS_PKG)-$(KVER); \
422                 dh_installdeb -p $(MODS_PKG)-$(KVER); \
423                 dh_strip -p $(MODS_PKG)-$(KVER); \
424                 dh_fixperms -p $(MODS_PKG)-$(KVER); \
425                 dh_gencontrol -p $(MODS_PKG)-$(KVER); \
426                 dh_md5sums -p $(MODS_PKG)-$(KVER); \
427                 dh_builddeb -p $(MODS_PKG)-$(KVER); \
428         fi
429
430
431 ###
432 ### For module-assistant
433 ###
434
435 # the kdist_clean target is called by make-kpkg modules_clean and from
436 # kdist* rules. It is responsible for cleaning up any changes that have
437 # been made by the other kdist_commands (except for the .deb files created)
438
439 kdist_clean: 
440         # can't dh_clean here or we remove the build artifacts for the other packages
441         # still in progress
442         #dh_clean
443         #-$(MAKE) $(MFLAGS) -f debian/rules clean
444         # put the userspace tools' control file back
445         cp debian/control.main debian/control
446
447
448 # module assistant calculates all needed things for us and sets
449 # # following variables:
450 # # KSRC (kernel source directory), KVERS (kernel version string), KDREV
451 # # (revision of the Debian kernel-image package), CC (the correct
452 # # compiler), VERSION (the final package version string), PKGNAME (full
453 # # package name with KVERS included), DEB_DESTDIR (path to store DEBs)
454 #
455 # # The kdist_configure target is called by make-kpkg modules_config and
456 # # by kdist* rules by dependency. It should configure the module so it is
457 # # ready for compilation (mostly useful for calling configure).
458 # # prep-deb-files from module-assistant creates the neccessary debian/ 
459 kdist_config: prep-deb-files patch-stamp
460         #  Check build dependencies again, needs to be done since we just
461         # replaced the control file.
462         dpkg-checkbuilddeps
463         # Prepare the kernel to lustres' liking
464         # as non-root, we won't have permission for this
465         #-$(MAKE) -C $(KSRC) prepare scripts
466         # touch files to same date, to avoid auto*
467         find . -type f -print0 | xargs -0 touch -r COPYING \;
468         # Determine flags that are different between server/client module builds
469         # Note: It doesn't seem possible to *only* build modules.
470         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"
471         if echo "$${DEB_BUILD_PROFILES}" | grep -q "server"; then \
472                 export EXTRAFLAGS="--enable-server"; \
473         else \
474                 export EXTRAFLAGS="--disable-server"; \
475         fi; \
476         if echo "$${DEB_BUILD_PROFILES}" | grep -q "zfs"; then \
477                 export EXTRAFLAGS="$${EXTRAFLAGS} --with-zfs=$${ZFS_SRC} --with-spl=$${SPL_SRC}"; \
478         else \
479                 export EXTRAFLAGS="$${EXTRAFLAGS} --without-zfs" ; \
480         fi; \
481         if echo "$${DEB_BUILD_PROFILES}" | grep -q "ldiskfs"; then \
482                 export EXTRAFLAGS="$${EXTRAFLAGS} \
483                         --enable-ldiskfs --enable-quilt"; \
484         else \
485                 export EXTRAFLAGS="$${EXTRAFLAGS} \
486                         --disable-ldiskfs --disable-quilt"; \
487         fi; \
488         if echo "$${DEB_BUILD_PROFILES}" | grep -q "o2ib"; then \
489                 export EXTRAFLAGS="$${EXTRAFLAGS} --with-o2ib=$${O2IB_SRC}"; \
490         fi; \
491         if echo "$${DEB_BUILD_PROFILES}" | grep -qw "crypto"; then \
492                 export EXTRAFLAGS="$${EXTRAFLAGS} --enable-crypto"; \
493         elif echo "$${DEB_BUILD_PROFILES}" | grep -qw "nocrypto"; then \
494                 export EXTRAFLAGS="$${EXTRAFLAGS} --disable-crypto"; \
495         fi; \
496         # remove env variables from config cache built by initial configure,
497         # and create dedicated cache in temporary build directory
498         if [ -f "$${CONFIG_CACHE_FILE}" ]; then \
499                 export TMP_CACHE_FILE=$$(mktemp --tmpdir newconfig-XXXXXXXX.cache); \
500                 sed "/ac_cv_env/d" "$${CONFIG_CACHE_FILE}" > $${TMP_CACHE_FILE}; \
501                 export EXTRAFLAGS="$${EXTRAFLAGS} --cache-file=$${TMP_CACHE_FILE}"; \
502         fi; \
503         echo "Final value of EXTRAFLAGS: $${EXTRAFLAGS}"; \
504         ./configure --with-linux=$(KSRC_TREE) \
505                 --with-linux-obj=$(KSRC) \
506                 --disable-dependency-tracking \
507                 --disable-doc  \
508                 --disable-iokit \
509                 --disable-snmp \
510                 --disable-tests \
511                 --enable-quota \
512                 --with-kmp-moddir=updates/kernel \
513                 $${EXTRAFLAGS} \
514                 $(EXTRA_OPTIONS)
515
516
517 kdist_configure: kdist_config
518
519 # the binary-modules rule is invoked by module-assistant while processing the
520 # kdist* targets. It is called by module-assistant or make-kpkg and *not*
521 # during a normal build
522 binary-modules: prep-deb-files
523         dh_testroot
524         dh_prep
525         $(MAKE) $(PMAKEARGS)
526         $(MAKE) install DESTDIR=$(CURDIR)/debian/$(PKGNAME)
527         # Remove stuff that doesn't belong (no module-only target)
528         cd $(CURDIR)/debian/$(PKGNAME) && rm -rf usr/bin usr/sbin usr/lib usr/share usr/include/lustre lib/systemd sbin etc
529         dh_installdocs -p$(PKGNAME)
530         dh_installchangelogs -p$(PKGNAME)
531         dh_installmodules -p $(PKGNAME)
532         dh_compress -p $(PKGNAME)
533         dh_fixperms -p $(PKGNAME)
534         dh_installdeb -p $(PKGNAME)
535         dh_gencontrol -- -v$(VERSION)
536         dh_md5sums -p $(PKGNAME)
537         dh_builddeb --destdir=$(DEB_DESTDIR) -p $(PKGNAME)
538         dh_prep -p $(PKGNAME)
539
540 clean:
541         dh_testdir
542         dh_testroot
543         dpatch deapply-all -v
544         -$(MAKE) distclean
545         rm -rf  debian/substvars debian/*.bak debian/*~ *~  *-stamp
546         ls -d debian/lustre-*-modules-* | grep -v _KVERS_ | grep -v dkms | xargs rm -f || true
547         # only remove this if the clean was not called from kdist_clean
548         if [ "$$MA_SOURCE_PKG" = "" ]; then \
549                 rm -rf  debian/m-a_root; \
550         fi
551         dh_clean
552         # make sure we have at least a basic control in place (see build-stamp)
553         rm -f debian/control
554         cp debian/control.main debian/control
555
556 patch: patch-stamp
557 patch-stamp:
558         dpatch apply-all -v
559         touch $@
560
561 unpatch:
562         dpatch deapply-all -v
563         rm -rf debian/patched patch-stamp
564
565 .PHONY: binary-arch clean source diff  binary binary-indep binary-arch install configure