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