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