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
75 .PHONY: ldiskfs-sources
79 $(MAKE) sources -C @LDISKFS_SUBDIR@ || exit $$?
85 modules: undef.h ldiskfs-sources
86 $(MAKE) DEQUOTE_CC_VERSION_TEXT=$(DEQUOTE) \
87 LDFLAGS= CC="$(CC)" -C $(LINUX_OBJ) \
88 -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
89 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)' \
90 $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
91 include/config/MARKER $@
99 grep -v config.h.in config.h.in > $@
102 find $(distdir) -name .deps -o \
106 -name .#* -exec rm -rf {} \;
108 EXTRA_DIST = @PACKAGE_TARNAME@.spec \
112 lustre-dkms_pre-build.sh \
113 lustre-dkms_post-build.sh \
115 LUSTRE-VERSION-FILE \
118 config/lustre-version.m4
120 # contrib is a directory. Putting a directory in EXTRA_DIST
121 # recursively includes the entire directory contents in the
122 # distribution tarball (the tarball created with "make dist").
123 EXTRA_DIST += contrib
127 @(if test -z "$(RPMBUILD)"; then \
129 "*** Required util 'rpmbuild' missing. Please install the\n" \
130 "*** package for your distribution which provides 'rpmbuild',\n" \
131 "*** re-run configure, and try again.\n"; \
134 $(MKDIR_P) $(rpmbuilddir)/TMP && \
135 $(MKDIR_P) $(rpmbuilddir)/BUILD && \
136 $(MKDIR_P) $(rpmbuilddir)/RPMS && \
137 $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
138 $(MKDIR_P) $(rpmbuilddir)/SPECS && \
139 $(MKDIR_P) $(rpmbuilddir)/SOURCES)
142 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
143 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
144 $(MAKE) $(AM_MAKEFLAGS) \
145 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
147 --define "_tmppath $$rpmbuilddir/TMP" \
148 --define "_topdir $$rpmbuilddir" \
149 --define "_sourcedir $(top_srcdir)" \
150 --with servers --with zfs -without ldiskfs \
151 --bs $(PACKAGE)-dkms.spec || exit 1; \
153 --define "_tmppath $$rpmbuilddir/TMP" \
154 --define "_topdir $$rpmbuilddir" \
155 --define "_sourcedir $(top_srcdir)" \
156 --with servers --without zfs --with ldiskfs \
157 --bs $(PACKAGE)-dkms.spec || exit 1; \
159 --define "_tmppath $$rpmbuilddir/TMP" \
160 --define "_topdir $$rpmbuilddir" \
161 --define "_sourcedir $(top_srcdir)" \
162 --with servers --with zfs --with ldiskfs \
163 --bs $(PACKAGE)-dkms.spec || exit 1; \
164 cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
168 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
170 --define "_tmppath $$rpmbuilddir/TMP" \
171 --define "_topdir $$rpmbuilddir" \
172 @RPMBUILD_BINARY_ARGS@ \
173 --with servers --with zfs --without ldiskfs \
174 --rebuild $(PACKAGE)-zfs-dkms-*.src.rpm || exit 1; \
176 --define "_tmppath $$rpmbuilddir/TMP" \
177 --define "_topdir $$rpmbuilddir" \
178 @RPMBUILD_BINARY_ARGS@ \
179 --with servers --without zfs --with ldiskfs \
180 --rebuild $(PACKAGE)-ldiskfs-dkms-*.src.rpm || exit 1; \
182 --define "_tmppath $$rpmbuilddir/TMP" \
183 --define "_topdir $$rpmbuilddir" \
184 @RPMBUILD_BINARY_ARGS@ \
185 --with servers --with zfs --with ldiskfs \
186 --rebuild $(PACKAGE)-all-dkms-*.src.rpm || exit 1; \
187 cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
191 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
192 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
193 $(MAKE) $(AM_MAKEFLAGS) \
194 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
196 --define "_tmppath $$rpmbuilddir/TMP" \
197 --define "_topdir $$rpmbuilddir" \
198 --define "_sourcedir $(top_srcdir)" \
200 --bs $(PACKAGE)-dkms.spec || exit 1; \
201 cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
205 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
207 --define "_tmppath $$rpmbuilddir/TMP" \
208 --define "_topdir $$rpmbuilddir" \
209 @RPMBUILD_BINARY_ARGS@ \
211 --rebuild $(PACKAGE)-client-dkms-*.src.rpm || exit 1; \
212 cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
217 dkms-srpms: dkms-srpm
222 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
223 if test "x@CONFIG_CACHE_FILE@" != "x"; then \
224 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
226 $(MAKE) $(AM_MAKEFLAGS) \
227 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
229 --define "_tmppath $$rpmbuilddir/TMP" \
230 --define "_topdir $$rpmbuilddir" \
231 @RPMBUILD_BINARY_ARGS@ \
232 --rebuild $(distdir)-*.src.rpm || exit 1; \
233 cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
236 srpm: @PACKAGE_TARNAME@.spec dist Makefile
237 rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
238 $(MAKE) $(AM_MAKEFLAGS) \
239 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
240 cp $(top_srcdir)/rpm/* $(top_srcdir); \
242 --define "_tmppath $$rpmbuilddir/TMP" \
243 --define "_topdir $$rpmbuilddir" \
244 --define "dist %{nil}" \
245 -ts $(distdir).tar.gz || exit 1; \
246 cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
250 export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
251 rm -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; \
252 if test -f /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2; then \
253 echo "************************************************************" ; \
254 echo "WARNING: move or remove /usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2" ; \
255 echo "************************************************************" ; \
258 # In the debs target, first make sure what's in the changelog reflects
259 # the software version.
260 debs: undef.h debs_common
261 cp -v debian/changelog.in debian/changelog ; \
262 export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
263 lversion=$$(echo @VERSION@ | tr '_' '-'); \
264 cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
265 if [ "$$lversion" != "$$cversion" ]; then \
266 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; \
269 if test "x@ENABLE_SERVER@" = "xyes"; then \
270 DEB_BUILD_PROFILES="server"; \
272 DEB_BUILD_PROFILES="client"; \
274 if test "x@ENABLE_LDISKFS@" = "xyes"; then \
275 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} ldiskfs"; \
277 if test "x@ENABLE_ZFS@" = "xyes"; then \
278 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} zfs"; \
279 export SPL_SRC="@SPL@"; \
280 export ZFS_SRC="@ZFS@"; \
281 echo "ZFS support is enabled. Will expect pre-compiled SPL and ZFS sources in:"; \
282 echo "SPL: $${SPL_SRC}"; \
283 echo "ZFS: $${ZFS_SRC}"; \
285 if test "x@ENABLEO2IB@" != "xno"; then \
286 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} o2ib"; \
287 export O2IB_SRC="@O2IBPATH@"; \
289 if test "x@CONFIG_CACHE_FILE@" != "x"; then \
290 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
292 if test "x@ENABLE_GSS@" = "xyes"; then \
293 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} gss"; \
294 debiantmp=$$(mktemp -t -d debbuild-$$USER-XXXXXXXX) ; \
295 cp debian/control $$debiantmp/control.bkp ; \
296 cp debian/control.main $$debiantmp/control.main.bkp ; \
297 cp debian/control.modules.in $$debiantmp/control.modules.in.bkp ; \
298 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.main ; \
299 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 ; \
300 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.modules.in ; \
301 elif test "x@ENABLE_GSS@" = "xno"; then \
302 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nogss"; \
304 if test "x@ENABLE_CRYPTO@" = "xyes"; then \
305 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} crypto"; \
306 elif test "x@ENABLE_CRYPTO@" = "xno"; then \
307 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nocrypto"; \
309 if test "x@systemdsystemunitdir@" != "x"; then \
310 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} systemd"; \
312 export KERNEL_OBJ="$(LINUX_OBJ)"; \
313 export KERNEL_SRC="$(LINUX)"; \
314 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
315 echo "Kernel Source: $${KERNEL_SRC}"; \
316 echo "Kernel Object: $${KERNEL_OBJ}"; \
317 if test "x@ENABLEO2IB@" = "xno"; then \
318 export IB_OPTIONS="--with-o2ib=no"; \
320 if test "x@ENABLEO2IB@" != "xyes" && \
321 test -n "@O2IBPATH@"; then \
322 export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
324 export IB_OPTIONS="--with-o2ib=yes"; \
327 dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
328 rc=$${PIPESTATUS[0]}; \
329 cp $$debiantmp/control.bkp debian/control || true && \
330 cp $$debiantmp/control.main.bkp debian/control.main || true && \
331 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
332 [ $${rc} -gt 1 ] && exit $${rc}; \
335 cp $$debiantmp/control.bkp debian/control || true && \
336 cp $$debiantmp/control.main.bkp debian/control.main || true && \
337 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
338 export KPKG_DEST_DIR="$$(pwd)/.." && \
339 version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
340 rm -rf debian/tmp/modules-deb && \
341 mkdir debian/tmp/modules-deb && \
342 pushd debian/tmp/modules-deb && \
343 dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
345 tar -C usr_src/ -xjf usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2 && \
346 chmod 755 usr_src/modules/lustre/debian/rules && \
347 mkdir -p usr_share_modass && \
348 ln -s /usr/share/modass/include/ usr_share_modass/ && \
349 ln -s /usr/share/modass/packages/ usr_share_modass/ && \
350 echo "lustre" > usr_share_modass/compliant.list && \
351 export MA_DIR=$$(pwd)/usr_share_modass && \
352 KVERS=$${KVERS:-$(LINUXRELEASE)} && \
353 export KSRC_TREE=$(LINUX) && \
354 KSRC=$${KSRC:-$(LINUX_OBJ)} && \
355 TARBALL=$$(realpath usr/src/lustre-$${SRC_GIT_HASH}.tar.bz2) \
356 m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
358 VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
359 if test "x@ENABLE_SERVER@" = "xyes"; then \
360 DEB_SERVER_PKG="../lustre-resource-agents_$${VER}_*.deb"; \
363 mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
364 ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
365 ../lustre-*-utils_$${VER}_*.deb $${DEB_SERVER_PKG} \
366 ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
367 ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \
370 dkms-debs: undef.h debs_common
371 cp -v debian/changelog.in debian/changelog ; \
372 export SRC_GIT_HASH=$$(git log --oneline | head -1 | cut -d' ' -f1); \
373 lversion=$$(echo @VERSION@ | tr '_' '-'); \
374 cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
375 if [ "$$lversion" != "$$cversion" ]; then \
376 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; \
379 export DEB_BUILD_PROFILES="client"; \
380 export KERNEL_OBJ="$(LINUX_OBJ)"; \
381 export KERNEL_SRC="$(LINUX)"; \
382 echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
383 echo "Kernel Source: $${KERNEL_SRC}"; \
384 echo "Kernel Object: $${KERNEL_OBJ}"; \
385 export BUILD_DKMS="true" && \
386 dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
387 rc=$${PIPESTATUS[0]}; \
388 [ $${rc} -gt 1 ] && exit $${rc}; \
391 VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
393 mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
394 ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
395 ../lustre-*-utils_$${VER}_*.deb \
396 ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
397 ../lustre_$${VER}.tar.gz ../lustre-*-modules-dkms_$${VER}_*.deb \
400 EXTRA_DIST += debian/*
403 CSTKO=/tmp/checkstack.orig
406 [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
407 { for MOD in $$(find . -name "*.ko"); do \
408 objdump -d $$MOD | perl contrib/scripts/checkstack.pl; \
409 done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
410 [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
413 [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
416 rm -f ${CSTK} ${CSTKO}