1 SUBDIRS := @LDISKFS_SUBDIR@ \
9 DIST_SUBDIRS := ldiskfs \
17 AUTOMAKE_OPTIONS = foreign
19 if DEQUOTE_CC_VERSION_TEXT
23 FIND_TAG_FILES_CMD = find $(top_srcdir) \
24 -path $(top_srcdir)/ldiskfs/linux-stage \
25 -prune -false -o -type f -name '*.[hc]'
27 # these empty rules are needed so that automake doesn't add its own
40 $(RM) $(top_srcdir)/TAGS
41 ETAGSF=`etags --version | grep -iq exuberant && \
42 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
43 $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
46 $(RM) $(top_srcdir)/tags
47 CTAGSF=`ctags --version | grep -iq exuberant && \
48 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
49 $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
54 $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
55 $(FIND_TAG_FILES_CMD) > cscope.files
59 $(FIND_TAG_FILES_CMD) | xargs mkid
62 doxygen: doxygen-api doxygen-ref
64 doxygen-%: build/doxyfile.%
68 .PHONY: ldiskfs-sources
72 $(MAKE) sources -C @LDISKFS_SUBDIR@ || exit $$?
78 modules: undef.h ldiskfs-sources
79 $(MAKE) DEQUOTE_CC_VERSION_TEXT=$(DEQUOTE) \
80 LDFLAGS= CC="$(CC)" -C $(LINUX_OBJ) \
81 -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
82 LINUXINCLUDE='-I$$(srctree)/arch/$$(SRCARCH)/include -Iarch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC)$$(building_out_of_srctree),-Iinclude2 -I$$(srctree)/include) -I$$(srctree)/arch/$$(SRCARCH)/include/uapi -Iarch/$$(SRCARCH)/include/generated/uapi -I$$(srctree)/include/uapi -Iinclude/generated/uapi -include $(CONFIG_INCLUDE)' \
83 $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
84 include/config/MARKER $@
92 grep -v config.h.in config.h.in > $@
95 find $(distdir) -name .deps -o \
99 -name .#* -exec rm -rf {} \;
101 EXTRA_DIST = @PACKAGE_TARNAME@.spec \
105 lustre-dkms_pre-build.sh \
106 lustre-dkms_post-build.sh \
108 LUSTRE-VERSION-FILE \
111 config/lustre-version.m4
113 # contrib is a directory. Putting a directory in EXTRA_DIST
114 # recursively includes the entire directory contents in the
115 # distribution tarball (the tarball created with "make dist").
116 EXTRA_DIST += contrib
120 @(if test -z "$(RPMBUILD)"; then \
122 "*** Required util 'rpmbuild' missing. Please install the\n" \
123 "*** package for your distribution which provides 'rpmbuild',\n" \
124 "*** re-run configure, and try again.\n"; \
127 $(MKDIR_P) $(rpmbuilddir)/TMP && \
128 $(MKDIR_P) $(rpmbuilddir)/BUILD && \
129 $(MKDIR_P) $(rpmbuilddir)/RPMS && \
130 $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
131 $(MKDIR_P) $(rpmbuilddir)/SPECS && \
132 $(MKDIR_P) $(rpmbuilddir)/SOURCES)
135 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
136 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
137 $(MAKE) $(AM_MAKEFLAGS) \
138 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
140 --define "_tmppath $$rpmbuilddir/TMP" \
141 --define "_topdir $$rpmbuilddir" \
142 --define "_sourcedir $(top_srcdir)" \
143 --with servers --with zfs -without ldiskfs \
144 --bs $(PACKAGE)-dkms.spec || exit 1; \
146 --define "_tmppath $$rpmbuilddir/TMP" \
147 --define "_topdir $$rpmbuilddir" \
148 --define "_sourcedir $(top_srcdir)" \
149 --with servers --without zfs --with ldiskfs \
150 --bs $(PACKAGE)-dkms.spec || exit 1; \
152 --define "_tmppath $$rpmbuilddir/TMP" \
153 --define "_topdir $$rpmbuilddir" \
154 --define "_sourcedir $(top_srcdir)" \
155 --with servers --with zfs --with ldiskfs \
156 --bs $(PACKAGE)-dkms.spec || exit 1; \
157 cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
161 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
163 --define "_tmppath $$rpmbuilddir/TMP" \
164 --define "_topdir $$rpmbuilddir" \
165 @RPMBUILD_BINARY_ARGS@ \
166 --with servers --with zfs --without ldiskfs \
167 --rebuild $(PACKAGE)-zfs-dkms-*.src.rpm || exit 1; \
169 --define "_tmppath $$rpmbuilddir/TMP" \
170 --define "_topdir $$rpmbuilddir" \
171 @RPMBUILD_BINARY_ARGS@ \
172 --with servers --without zfs --with ldiskfs \
173 --rebuild $(PACKAGE)-ldiskfs-dkms-*.src.rpm || exit 1; \
175 --define "_tmppath $$rpmbuilddir/TMP" \
176 --define "_topdir $$rpmbuilddir" \
177 @RPMBUILD_BINARY_ARGS@ \
178 --with servers --with zfs --with ldiskfs \
179 --rebuild $(PACKAGE)-all-dkms-*.src.rpm || exit 1; \
180 cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
184 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
185 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
186 $(MAKE) $(AM_MAKEFLAGS) \
187 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
189 --define "_tmppath $$rpmbuilddir/TMP" \
190 --define "_topdir $$rpmbuilddir" \
191 --define "_sourcedir $(top_srcdir)" \
193 --bs $(PACKAGE)-dkms.spec || exit 1; \
194 cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
198 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
200 --define "_tmppath $$rpmbuilddir/TMP" \
201 --define "_topdir $$rpmbuilddir" \
202 @RPMBUILD_BINARY_ARGS@ \
204 --rebuild $(PACKAGE)-client-dkms-*.src.rpm || exit 1; \
205 cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
210 dkms-srpms: dkms-srpm
215 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
216 if test "x@CONFIG_CACHE_FILE@" != "x"; then \
217 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
219 $(MAKE) $(AM_MAKEFLAGS) \
220 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
222 --define "_tmppath $$rpmbuilddir/TMP" \
223 --define "_topdir $$rpmbuilddir" \
224 @RPMBUILD_BINARY_ARGS@ \
225 --rebuild $(distdir)-*.src.rpm || exit 1; \
226 cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
229 srpm: @PACKAGE_TARNAME@.spec dist Makefile
230 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
231 $(MAKE) $(AM_MAKEFLAGS) \
232 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
233 cp $(top_srcdir)/rpm/* $(top_srcdir); \
235 --define "_tmppath $$rpmbuilddir/TMP" \
236 --define "_topdir $$rpmbuilddir" \
237 --define "dist %{nil}" \
238 -ts $(distdir).tar.gz || exit 1; \
239 cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
243 export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
244 rm -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; \
245 if test -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; then \
246 echo "************************************************************" ; \
247 echo "WARNING: move or remove /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2" ; \
248 echo "************************************************************" ; \
251 # In the debs target, first make sure what's in the changelog reflects
252 # the software version.
253 debs: undef.h debs_common
254 cp -v debian/changelog.in debian/changelog ; \
255 export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
256 lversion=$$(echo @VERSION@ | tr '_' '-'); \
257 cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
258 if [ "$$lversion" != "$$cversion" ]; then \
259 echo -e "1i\nlustre ($$lversion-1) unstable; urgency=low\n\n * Automated changelog entry update\n\n -- Andreas Dilger <adilger@whamcloud.com> $$(date -R)\n\n.\nwq" | ed debian/changelog; \
262 if test "x@ENABLE_SERVER@" = "xyes"; then \
263 DEB_BUILD_PROFILES="server"; \
265 DEB_BUILD_PROFILES="client"; \
267 if test "x@ENABLE_LDISKFS@" = "xyes"; then \
268 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} ldiskfs"; \
270 if test "x@ENABLE_ZFS@" = "xyes"; then \
271 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} zfs"; \
272 export SPL_SRC="@SPL@"; \
273 export ZFS_SRC="@ZFS@"; \
274 echo "ZFS support is enabled. Will expect pre-compiled SPL and ZFS sources in:"; \
275 echo "SPL: $${SPL_SRC}"; \
276 echo "ZFS: $${ZFS_SRC}"; \
278 if test "x@ENABLEO2IB@" != "xno"; then \
279 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} o2ib"; \
280 export O2IB_SRC="@O2IBPATH@"; \
282 if test "x@CONFIG_CACHE_FILE@" != "x"; then \
283 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
285 if test "x@ENABLE_GSS@" = "xyes"; then \
286 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} gss"; \
287 debiantmp=$$(mktemp -t -d debbuild-$$USER-XXXXXXXX) ; \
288 cp debian/control $$debiantmp/control.bkp ; \
289 cp debian/control.main $$debiantmp/control.main.bkp ; \
290 cp debian/control.modules.in $$debiantmp/control.modules.in.bkp ; \
291 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.main ; \
292 awk 'BEGIN{change=0} $$1 == "Package:" {if (($$2 == "lustre-client-utils") || ($$2 == "lustre-server-utils")) change=1; else change=0; fi } {if (($$1 == "Depends:") && change) print $$0 ", libgssapi-krb5-2, libkrb5-3, libssl1.1|libssl3"; else print; fi}' debian/control.main > $$debiantmp/control.main && mv $$debiantmp/control.main debian/control.main ; \
293 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.modules.in ; \
294 elif test "x@ENABLE_GSS@" = "xno"; then \
295 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nogss"; \
297 if test "x@ENABLE_CRYPTO@" = "xyes"; then \
298 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} crypto"; \
299 elif test "x@ENABLE_CRYPTO@" = "xno"; then \
300 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nocrypto"; \
302 if test "x@systemdsystemunitdir@" != "x"; then \
303 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} systemd"; \
305 export KERNEL_OBJ="$(LINUX_OBJ)"; \
306 export KERNEL_SRC="$(LINUX)"; \
307 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
308 echo "Kernel Source: $${KERNEL_SRC}"; \
309 echo "Kernel Object: $${KERNEL_OBJ}"; \
310 if test "x@ENABLEO2IB@" = "xno"; then \
311 export IB_OPTIONS="--with-o2ib=no"; \
313 if test "x@ENABLEO2IB@" != "xyes" && \
314 test -n "@O2IBPATH@"; then \
315 export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
317 export IB_OPTIONS="--with-o2ib=yes"; \
320 dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
321 rc=$${PIPESTATUS[0]}; \
322 cp $$debiantmp/control.bkp debian/control || true && \
323 cp $$debiantmp/control.main.bkp debian/control.main || true && \
324 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
325 [ $${rc} -gt 1 ] && exit $${rc}; \
328 cp $$debiantmp/control.bkp debian/control || true && \
329 cp $$debiantmp/control.main.bkp debian/control.main || true && \
330 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
331 export KPKG_DEST_DIR="$$(pwd)/.." && \
332 version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
333 rm -rf debian/tmp/modules-deb && \
334 mkdir debian/tmp/modules-deb && \
335 pushd debian/tmp/modules-deb && \
336 dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
338 tar -C usr_src/ -xjf usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2 && \
339 chmod 755 usr_src/modules/lustre/debian/rules && \
340 mkdir -p usr_share_modass && \
341 ln -s /usr/share/modass/include/ usr_share_modass/ && \
342 ln -s /usr/share/modass/packages/ usr_share_modass/ && \
343 echo "lustre" > usr_share_modass/compliant.list && \
344 export MA_DIR=$$(pwd)/usr_share_modass && \
345 KVERS=$${KVERS:-$(LINUXRELEASE)} && \
346 export KSRC_TREE=$(LINUX) && \
347 KSRC=$${KSRC:-$(LINUX_OBJ)} && \
348 TARBALL=$$(realpath usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2) \
349 m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
351 VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
352 if test "x@ENABLE_SERVER@" = "xyes"; then \
353 DEB_SERVER_PKG="../lustre-resource-agents_$${VER}_*.deb"; \
356 mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
357 ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
358 ../lustre-*-utils_$${VER}_*.deb $${DEB_SERVER_PKG} \
359 ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
360 ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \
363 dkms-debs: undef.h debs_common
364 cp -v debian/changelog.in debian/changelog ; \
365 export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
366 lversion=$$(echo @VERSION@ | tr '_' '-'); \
367 cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
368 if [ "$$lversion" != "$$cversion" ]; then \
369 echo -e "1i\nlustre ($$lversion-1) unstable; urgency=low\n\n * Automated changelog entry update\n\n -- Brian J. Murrell <brian@interlinx.bc.ca> $$(date -R)\n\n.\nwq" | ed debian/changelog; \
372 export DEB_BUILD_PROFILES="client"; \
373 export KERNEL_OBJ="$(LINUX_OBJ)"; \
374 export KERNEL_SRC="$(LINUX)"; \
375 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
376 echo "Kernel Source: $${KERNEL_SRC}"; \
377 echo "Kernel Object: $${KERNEL_OBJ}"; \
378 export BUILD_DKMS="true" && \
379 dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
380 rc=$${PIPESTATUS[0]}; \
381 [ $${rc} -gt 1 ] && exit $${rc}; \
384 VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
386 mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
387 ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
388 ../lustre-*-utils_$${VER}_*.deb \
389 ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
390 ../lustre_$${VER}.tar.gz ../lustre-*-modules-dkms_$${VER}_*.deb \
393 EXTRA_DIST += debian/*
396 CSTKO=/tmp/checkstack.orig
399 [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
400 { for MOD in $$(find . -name "*.ko"); do \
401 objdump -d $$MOD | perl contrib/scripts/checkstack.pl; \
402 done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
403 [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
406 [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
409 rm -f ${CSTK} ${CSTKO}