1 # SPDX-License-Identifier: GPL-2.0
4 # This file is part of Lustre, http://www.lustre.org/
8 # Used by automake to create the top-level autoMakefile.in,
9 # which is used by config.status to create the top-level
13 SUBDIRS := @LDISKFS_SUBDIR@ \
15 @LUSTREIOKIT_SUBDIR@ \
21 DIST_SUBDIRS := ldiskfs \
29 AUTOMAKE_OPTIONS = foreign
31 if DEQUOTE_CC_VERSION_TEXT
35 FIND_TAG_FILES_CMD = find $(top_srcdir) \
36 -path $(top_srcdir)/ldiskfs/linux-stage \
37 -prune -false -o -type f -name '*.[hc]'
39 # these empty rules are needed so that automake doesn't add its own
52 $(RM) $(top_srcdir)/TAGS
53 ETAGSF=`etags --version | grep -iq exuberant && \
54 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
55 $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
58 $(RM) $(top_srcdir)/tags
59 CTAGSF=`ctags --version | grep -iq exuberant && \
60 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
61 $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
66 $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
67 $(FIND_TAG_FILES_CMD) > cscope.files
71 $(FIND_TAG_FILES_CMD) | xargs mkid
74 doxygen: doxygen-api doxygen-ref
76 doxygen-%: build/doxyfile.%
80 .PHONY: ldiskfs-sources
84 $(MAKE) sources -C @LDISKFS_SUBDIR@ || exit $$?
90 modules: undef.h ldiskfs-sources
91 $(MAKE) DEQUOTE_CC_VERSION_TEXT=$(DEQUOTE) \
92 LDFLAGS= CC="$(CC)" -C $(LINUX_OBJ) \
93 -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
94 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)' \
95 $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
96 include/config/MARKER $@
104 grep -v config.h.in config.h.in > $@
107 find $(distdir) -name .deps -o \
111 -name .#* -exec rm -rf {} \;
113 EXTRA_DIST = @PACKAGE_TARNAME@.spec \
117 lustre-dkms_pre-build.sh \
118 lustre-dkms_post-build.sh \
120 LUSTRE-VERSION-FILE \
123 config/lustre-version.m4
125 # contrib is a directory. Putting a directory in EXTRA_DIST
126 # recursively includes the entire directory contents in the
127 # distribution tarball (the tarball created with "make dist").
128 EXTRA_DIST += contrib
132 @(if test -z "$(RPMBUILD)"; then \
134 "*** Required util 'rpmbuild' missing. Please install the\n" \
135 "*** package for your distribution which provides 'rpmbuild',\n" \
136 "*** re-run configure, and try again.\n"; \
139 $(MKDIR_P) $(rpmbuilddir)/TMP && \
140 $(MKDIR_P) $(rpmbuilddir)/BUILD && \
141 $(MKDIR_P) $(rpmbuilddir)/RPMS && \
142 $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
143 $(MKDIR_P) $(rpmbuilddir)/SPECS && \
144 $(MKDIR_P) $(rpmbuilddir)/SOURCES)
147 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
148 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
149 $(MAKE) $(AM_MAKEFLAGS) \
150 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
152 --define "_tmppath $$rpmbuilddir/TMP" \
153 --define "_topdir $$rpmbuilddir" \
154 --define "_sourcedir $(top_srcdir)" \
155 --with servers --with zfs -without ldiskfs \
156 --bs $(PACKAGE)-dkms.spec || exit 1; \
158 --define "_tmppath $$rpmbuilddir/TMP" \
159 --define "_topdir $$rpmbuilddir" \
160 --define "_sourcedir $(top_srcdir)" \
161 --with servers --without zfs --with ldiskfs \
162 --bs $(PACKAGE)-dkms.spec || exit 1; \
164 --define "_tmppath $$rpmbuilddir/TMP" \
165 --define "_topdir $$rpmbuilddir" \
166 --define "_sourcedir $(top_srcdir)" \
167 --with servers --with zfs --with ldiskfs \
168 --bs $(PACKAGE)-dkms.spec || exit 1; \
169 cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
173 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
175 --define "_tmppath $$rpmbuilddir/TMP" \
176 --define "_topdir $$rpmbuilddir" \
177 @RPMBUILD_BINARY_ARGS@ \
178 --with servers --with zfs --without ldiskfs \
179 --rebuild $(PACKAGE)-zfs-dkms-*.src.rpm || exit 1; \
181 --define "_tmppath $$rpmbuilddir/TMP" \
182 --define "_topdir $$rpmbuilddir" \
183 @RPMBUILD_BINARY_ARGS@ \
184 --with servers --without zfs --with ldiskfs \
185 --rebuild $(PACKAGE)-ldiskfs-dkms-*.src.rpm || exit 1; \
187 --define "_tmppath $$rpmbuilddir/TMP" \
188 --define "_topdir $$rpmbuilddir" \
189 @RPMBUILD_BINARY_ARGS@ \
190 --with servers --with zfs --with ldiskfs \
191 --rebuild $(PACKAGE)-all-dkms-*.src.rpm || exit 1; \
192 cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
196 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
197 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
198 $(MAKE) $(AM_MAKEFLAGS) \
199 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
201 --define "_tmppath $$rpmbuilddir/TMP" \
202 --define "_topdir $$rpmbuilddir" \
203 --define "_sourcedir $(top_srcdir)" \
205 --bs $(PACKAGE)-dkms.spec || exit 1; \
206 cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
210 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
212 --define "_tmppath $$rpmbuilddir/TMP" \
213 --define "_topdir $$rpmbuilddir" \
214 @RPMBUILD_BINARY_ARGS@ \
216 --rebuild $(PACKAGE)-client-dkms-*.src.rpm || exit 1; \
217 cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
222 dkms-srpms: dkms-srpm
227 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
228 if test "x@CONFIG_CACHE_FILE@" != "x"; then \
229 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
231 $(MAKE) $(AM_MAKEFLAGS) \
232 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
234 --define "_tmppath $$rpmbuilddir/TMP" \
235 --define "_topdir $$rpmbuilddir" \
236 @RPMBUILD_BINARY_ARGS@ \
237 --rebuild $(distdir)-*.src.rpm || exit 1; \
238 cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
241 srpm: @PACKAGE_TARNAME@.spec dist Makefile
242 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
243 $(MAKE) $(AM_MAKEFLAGS) \
244 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
245 cp $(top_srcdir)/rpm/* $(top_srcdir); \
247 --define "_tmppath $$rpmbuilddir/TMP" \
248 --define "_topdir $$rpmbuilddir" \
249 --define "dist %{nil}" \
250 -ts $(distdir).tar.gz || exit 1; \
251 cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
255 export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
256 rm -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; \
257 if test -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; then \
258 echo "************************************************************" ; \
259 echo "WARNING: move or remove /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2" ; \
260 echo "************************************************************" ; \
263 # In the debs target, first make sure what's in the changelog reflects
264 # the software version.
265 debs: undef.h debs_common
266 cp -v debian/changelog.in debian/changelog ; \
267 export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
268 lversion=$$(echo @VERSION@ | tr '_' '-'); \
269 cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
270 if [ "$$lversion" != "$$cversion" ]; then \
271 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; \
274 if test "x@ENABLE_SERVER@" = "xyes"; then \
275 DEB_BUILD_PROFILES="server"; \
277 DEB_BUILD_PROFILES="client"; \
279 if test "x@ENABLE_LDISKFS@" = "xyes"; then \
280 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} ldiskfs"; \
282 if test "x@ENABLE_ZFS@" = "xyes"; then \
283 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} zfs"; \
284 export SPL_SRC="@SPL@"; \
285 export ZFS_SRC="@ZFS@"; \
286 echo "ZFS support is enabled. Will expect pre-compiled SPL and ZFS sources in:"; \
287 echo "SPL: $${SPL_SRC}"; \
288 echo "ZFS: $${ZFS_SRC}"; \
290 if test "x@ENABLEO2IB@" != "xno"; then \
291 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} o2ib"; \
292 export O2IB_SRC="@O2IBPATH@"; \
294 if test "x@CONFIG_CACHE_FILE@" != "x"; then \
295 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
297 if test "x@ENABLE_GSS@" = "xyes"; then \
298 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} gss"; \
299 debiantmp=$$(mktemp -t -d debbuild-$$USER-XXXXXXXX) ; \
300 cp debian/control $$debiantmp/control.bkp ; \
301 cp debian/control.main $$debiantmp/control.main.bkp ; \
302 cp debian/control.modules.in $$debiantmp/control.modules.in.bkp ; \
303 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.main ; \
304 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 ; \
305 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.modules.in ; \
306 elif test "x@ENABLE_GSS@" = "xno"; then \
307 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nogss"; \
309 if test "x@ENABLE_CRYPTO@" = "xyes"; then \
310 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} crypto"; \
311 elif test "x@ENABLE_CRYPTO@" = "xno"; then \
312 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nocrypto"; \
314 if test "x@systemdsystemunitdir@" != "x"; then \
315 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} systemd"; \
317 export KERNEL_OBJ="$(LINUX_OBJ)"; \
318 export KERNEL_SRC="$(LINUX)"; \
319 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
320 echo "Kernel Source: $${KERNEL_SRC}"; \
321 echo "Kernel Object: $${KERNEL_OBJ}"; \
322 if test "x@ENABLEO2IB@" = "xno"; then \
323 export IB_OPTIONS="--with-o2ib=no"; \
325 if test "x@ENABLEO2IB@" != "xyes" && \
326 test -n "@O2IBPATH@"; then \
327 export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
329 export IB_OPTIONS="--with-o2ib=yes"; \
332 dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
333 rc=$${PIPESTATUS[0]}; \
334 cp $$debiantmp/control.bkp debian/control || true && \
335 cp $$debiantmp/control.main.bkp debian/control.main || true && \
336 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
337 [ $${rc} -gt 1 ] && exit $${rc}; \
340 cp $$debiantmp/control.bkp debian/control || true && \
341 cp $$debiantmp/control.main.bkp debian/control.main || true && \
342 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
343 export KPKG_DEST_DIR="$$(pwd)/.." && \
344 version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
345 rm -rf debian/tmp/modules-deb && \
346 mkdir debian/tmp/modules-deb && \
347 pushd debian/tmp/modules-deb && \
348 dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
350 tar -C usr_src/ -xjf usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2 && \
351 chmod 755 usr_src/modules/lustre/debian/rules && \
352 mkdir -p usr_share_modass && \
353 ln -s /usr/share/modass/include/ usr_share_modass/ && \
354 ln -s /usr/share/modass/packages/ usr_share_modass/ && \
355 echo "lustre" > usr_share_modass/compliant.list && \
356 export MA_DIR=$$(pwd)/usr_share_modass && \
357 KVERS=$${KVERS:-$(LINUXRELEASE)} && \
358 export KSRC_TREE=$(LINUX) && \
359 KSRC=$${KSRC:-$(LINUX_OBJ)} && \
360 TARBALL=$$(realpath usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2) \
361 m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
363 VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
364 if test "x@ENABLE_SERVER@" = "xyes"; then \
365 DEB_SERVER_PKG="../lustre-resource-agents_$${VER}_*.deb"; \
368 mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
369 ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
370 ../lustre-*-utils_$${VER}_*.deb $${DEB_SERVER_PKG} \
371 ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
372 ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \
375 dkms-debs: undef.h debs_common
376 cp -v debian/changelog.in debian/changelog ; \
377 export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
378 lversion=$$(echo @VERSION@ | tr '_' '-'); \
379 cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
380 if [ "$$lversion" != "$$cversion" ]; then \
381 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; \
384 export DEB_BUILD_PROFILES="client"; \
385 export KERNEL_OBJ="$(LINUX_OBJ)"; \
386 export KERNEL_SRC="$(LINUX)"; \
387 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
388 echo "Kernel Source: $${KERNEL_SRC}"; \
389 echo "Kernel Object: $${KERNEL_OBJ}"; \
390 export BUILD_DKMS="true" && \
391 dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
392 rc=$${PIPESTATUS[0]}; \
393 [ $${rc} -gt 1 ] && exit $${rc}; \
396 VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
398 mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
399 ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
400 ../lustre-*-utils_$${VER}_*.deb \
401 ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
402 ../lustre_$${VER}.tar.gz ../lustre-*-modules-dkms_$${VER}_*.deb \
405 EXTRA_DIST += debian/*
408 CSTKO=/tmp/checkstack.orig
411 [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
412 { for MOD in $$(find . -name "*.ko"); do \
413 objdump -d $$MOD | perl contrib/scripts/checkstack.pl; \
414 done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
415 [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
418 [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
421 rm -f ${CSTK} ${CSTKO}