Whamcloud - gitweb
LU-14428 libcfs: separate daemon_list from cfs_trace_data
[fs/lustre-release.git] / autoMakefile.am
1 SUBDIRS := @LDISKFS_SUBDIR@ \
2         . \
3         @LUSTREIOKIT_SUBDIR@ \
4         libcfs \
5         @SNMP_SUBDIR@ \
6         lnet \
7         lustre
8
9 DIST_SUBDIRS := ldiskfs \
10         lustre-iokit \
11         libcfs \
12         @SNMP_DIST_SUBDIR@ \
13         lnet \
14         lustre \
15         config
16
17 AUTOMAKE_OPTIONS = foreign
18
19 FIND_TAG_FILES_CMD = find $(top_srcdir) \
20                      -path $(top_srcdir)/ldiskfs/linux-stage \
21                      -prune -false -o -type f -name '*.[hc]'
22
23 # these empty rules are needed so that automake doesn't add its own
24 # recursive rules
25 etags-recursive:
26
27 ctags-recursive:
28
29 tags-recursive:
30
31 TAGS: etags
32
33 tags: ctags etags
34
35 etags:
36         $(RM) $(top_srcdir)/TAGS
37         ETAGSF=`etags --version | grep -iq exuberant && \
38                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
39         $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
40
41 ctags:
42         $(RM) $(top_srcdir)/tags
43         CTAGSF=`ctags --version | grep -iq exuberant && \
44                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
45         $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
46
47 cscope-recursive:
48
49 cscope:
50         $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
51         $(FIND_TAG_FILES_CMD) > cscope.files
52         cscope -bRq
53
54 mkid:
55         $(FIND_TAG_FILES_CMD) | xargs mkid
56
57
58 doxygen:  doxygen-api doxygen-ref
59
60 doxygen-%: build/doxyfile.%
61         doxygen $<
62
63 if MODULES
64 .PHONY: ldiskfs-sources
65
66 ldiskfs-sources:
67 if LDISKFS_ENABLED
68         $(MAKE) sources -C @LDISKFS_SUBDIR@ || exit $$?
69 endif
70
71 if LINUX
72 all-am: modules
73
74 modules: undef.h ldiskfs-sources
75         $(MAKE) LDFLAGS= CC="$(CC)" -C $(LINUX_OBJ) \
76         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
77         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)' \
78         $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
79         include/config/MARKER $@
80 endif # LINUX
81
82 endif # MODULES
83
84 all: undef.h
85
86 undef.h: config.h.in
87         grep -v config.h.in config.h.in > $@
88
89 dist-hook: undef.h
90         find $(distdir) -name .deps -o \
91                         -name CVS -o \
92                         -name .svn -o \
93                         -name .git -o \
94                         -name .#* -exec rm -rf {} \;
95
96 EXTRA_DIST = @PACKAGE_TARNAME@.spec     \
97         build/Makefile                  \
98         build/Rules.in                  \
99         config.h.in                     \
100         lustre-dkms_pre-build.sh        \
101         lustre-dkms_post-build.sh       \
102         LUSTRE-VERSION-GEN              \
103         LUSTRE-VERSION-FILE             \
104         undef.h                         \
105         autogen.sh                      \
106         config/lustre-version.m4
107
108 # contrib is a directory.  Putting a directory in EXTRA_DIST
109 # recursively includes the entire directory contents in the
110 # distribution tarball (the tarball created with "make dist").
111 EXTRA_DIST += contrib
112 EXTRA_DIST += rpm
113
114 rpm-local:
115         @(if test -z "$(RPMBUILD)"; then \
116                 echo -e "\n" \
117         "*** Required util 'rpmbuild' missing. Please install the\n" \
118         "*** package for your distribution which provides 'rpmbuild',\n" \
119         "*** re-run configure, and try again.\n"; \
120                 exit 1; \
121         fi; \
122         $(MKDIR_P) $(rpmbuilddir)/TMP   && \
123         $(MKDIR_P) $(rpmbuilddir)/BUILD && \
124         $(MKDIR_P) $(rpmbuilddir)/RPMS  && \
125         $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
126         $(MKDIR_P) $(rpmbuilddir)/SPECS && \
127         $(MKDIR_P) $(rpmbuilddir)/SOURCES)
128
129 if SERVER
130 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
131         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
132         $(MAKE) $(AM_MAKEFLAGS) \
133                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
134         $(RPMBUILD) \
135                 --define "_tmppath $$rpmbuilddir/TMP" \
136                 --define "_topdir $$rpmbuilddir" \
137                 --define "_sourcedir $(top_srcdir)" \
138                 --with servers --with zfs -without ldiskfs \
139                 --bs $(PACKAGE)-dkms.spec || exit 1; \
140         $(RPMBUILD) \
141                 --define "_tmppath $$rpmbuilddir/TMP" \
142                 --define "_topdir $$rpmbuilddir" \
143                 --define "_sourcedir $(top_srcdir)" \
144                 --with servers --without zfs --with ldiskfs \
145                 --bs $(PACKAGE)-dkms.spec || exit 1; \
146         $(RPMBUILD) \
147                 --define "_tmppath $$rpmbuilddir/TMP" \
148                 --define "_topdir $$rpmbuilddir" \
149                 --define "_sourcedir $(top_srcdir)" \
150                 --with servers --with zfs --with ldiskfs \
151                 --bs $(PACKAGE)-dkms.spec || exit 1; \
152         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
153         rm -rf $$rpmbuilddir
154
155 dkms-rpm: dkms-srpm
156         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
157         $(RPMBUILD) \
158                 --define "_tmppath $$rpmbuilddir/TMP" \
159                 --define "_topdir $$rpmbuilddir" \
160                 @RPMBUILD_BINARY_ARGS@ \
161                 --with servers --with zfs --without ldiskfs \
162                 --rebuild $(PACKAGE)-zfs-dkms-*.src.rpm || exit 1; \
163         $(RPMBUILD) \
164                 --define "_tmppath $$rpmbuilddir/TMP" \
165                 --define "_topdir $$rpmbuilddir" \
166                 @RPMBUILD_BINARY_ARGS@ \
167                 --with servers --without zfs --with ldiskfs \
168                 --rebuild $(PACKAGE)-ldiskfs-dkms-*.src.rpm || exit 1; \
169         $(RPMBUILD) \
170                 --define "_tmppath $$rpmbuilddir/TMP" \
171                 --define "_topdir $$rpmbuilddir" \
172                 @RPMBUILD_BINARY_ARGS@ \
173                 --with servers --with zfs --with ldiskfs \
174                 --rebuild $(PACKAGE)-all-dkms-*.src.rpm || exit 1; \
175         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
176         rm -rf $$rpmbuilddir
177 else
178
179 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
180         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
181         $(MAKE) $(AM_MAKEFLAGS) \
182                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
183         $(RPMBUILD) \
184                 --define "_tmppath $$rpmbuilddir/TMP" \
185                 --define "_topdir $$rpmbuilddir" \
186                 --define "_sourcedir $(top_srcdir)" \
187                 --without servers \
188                 --bs $(PACKAGE)-dkms.spec || exit 1; \
189         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
190         rm -rf $$rpmbuilddir
191
192 dkms-rpm: dkms-srpm
193         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
194         $(RPMBUILD) \
195                 --define "_tmppath $$rpmbuilddir/TMP" \
196                 --define "_topdir $$rpmbuilddir" \
197                 @RPMBUILD_BINARY_ARGS@ \
198                 --without servers \
199                 --rebuild $(PACKAGE)-client-dkms-*.src.rpm || exit 1; \
200         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
201         rm -rf $$rpmbuilddir
202
203 endif
204
205 dkms-srpms: dkms-srpm
206
207 dkms-rpms: dkms-rpm
208
209 rpms: srpm
210         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
211         if test "x@CONFIG_CACHE_FILE@" != "x"; then \
212                 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
213         fi; \
214         $(MAKE) $(AM_MAKEFLAGS) \
215                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
216         $(RPMBUILD) \
217                 --define "_tmppath $$rpmbuilddir/TMP" \
218                 --define "_topdir $$rpmbuilddir" \
219                 @RPMBUILD_BINARY_ARGS@ \
220                 --rebuild $(distdir)-*.src.rpm || exit 1; \
221         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
222         rm -rf $$rpmbuilddir
223
224 srpm: @PACKAGE_TARNAME@.spec dist Makefile
225         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
226         $(MAKE) $(AM_MAKEFLAGS) \
227                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
228         cp $(top_srcdir)/rpm/* $(top_srcdir); \
229         $(RPMBUILD) \
230                 --define "_tmppath $$rpmbuilddir/TMP" \
231                 --define "_topdir $$rpmbuilddir" \
232                 --define "dist %{nil}" \
233                 -ts $(distdir).tar.gz || exit 1; \
234         cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
235         rm -rf $$rpmbuilddir
236
237 # In the debs target, first make sure what's in the changelog reflects
238 # the software version.
239 debs: undef.h
240         cp -v debian/changelog.in debian/changelog ; \
241         lversion=$$(echo @VERSION@ | tr '_' '-'); \
242         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
243         if [ "$$lversion" != "$$cversion" ]; then \
244                 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; \
245         fi; \
246         rm -rf debs; \
247         if test "x@ENABLE_SERVER@" = "xyes"; then \
248                 DEB_BUILD_PROFILES="server"; \
249         else \
250                 DEB_BUILD_PROFILES="client"; \
251         fi; \
252         if test "x@ENABLE_LDISKFS@" = "xyes"; then \
253                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} ldiskfs"; \
254         fi; \
255         if test "x@ENABLE_ZFS@" = "xyes"; then \
256                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} zfs"; \
257                 export SPL_SRC="@SPL@"; \
258                 export ZFS_SRC="@ZFS@"; \
259                 echo "ZFS support is enabled. Will expect pre-compiled SPL and ZFS sources in:"; \
260                 echo "SPL: $${SPL_SRC}"; \
261                 echo "ZFS: $${ZFS_SRC}"; \
262         fi; \
263         if test "x@ENABLEO2IB@" != "xno"; then \
264                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} o2ib"; \
265                 export O2IB_SRC="@O2IBPATH@"; \
266         fi; \
267         if test "x@CONFIG_CACHE_FILE@" != "x"; then \
268                 export CONFIG_CACHE_FILE="@CONFIG_CACHE_FILE@"; \
269         fi; \
270         if test "x@ENABLE_GSS@" = "xyes"; then \
271                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} gss"; \
272                 debiantmp=$$(mktemp -t -d debbuild-$$USER-XXXXXXXX) ; \
273                 cp debian/control $$debiantmp/control.bkp ; \
274                 cp debian/control.main $$debiantmp/control.main.bkp ; \
275                 cp debian/control.modules.in $$debiantmp/control.modules.in.bkp ; \
276                 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.main ; \
277                 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"; else print; fi}' debian/control.main > $$debiantmp/control.main && mv $$debiantmp/control.main debian/control.main ; \
278                 sed -i "s+^\(Build-Depends: .*\)$$+\1, libkrb5-dev, libssl-dev+" debian/control.modules.in ; \
279         elif test "x@ENABLE_GSS@" = "xno"; then \
280                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nogss"; \
281         fi; \
282         if test "x@ENABLE_CRYPTO@" = "xyes"; then \
283                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} crypto"; \
284         elif test "x@ENABLE_CRYPTO@" = "xno"; then \
285                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nocrypto"; \
286         fi; \
287         if test "x@systemdsystemunitdir@" != "x"; then \
288                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} systemd"; \
289         fi; \
290         export KERNEL_OBJ="$(LINUX_OBJ)"; \
291         export KERNEL_SRC="$(LINUX)"; \
292         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
293         echo "Kernel Source: $${KERNEL_SRC}"; \
294         echo "Kernel Object: $${KERNEL_OBJ}"; \
295         if test "x@ENABLEO2IB@" = "xno"; then \
296                 export IB_OPTIONS="--with-o2ib=no"; \
297         else \
298                 if test "x@ENABLEO2IB@" != "xyes" && \
299                    test -n "@O2IBPATH@"; then \
300                         export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
301                 else \
302                         export IB_OPTIONS="--with-o2ib=yes"; \
303                 fi; \
304         fi; \
305         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
306                 rc=$${PIPESTATUS[0]}; \
307                 cp $$debiantmp/control.bkp debian/control || true && \
308                 cp $$debiantmp/control.main.bkp debian/control.main || true && \
309                 cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
310                 [ $${rc} -gt 1 ] && exit $${rc}; \
311                 exit 0; \
312         }; \
313         cp $$debiantmp/control.bkp debian/control || true && \
314         cp $$debiantmp/control.main.bkp debian/control.main || true && \
315         cp $$debiantmp/control.modules.in.bkp debian/control.modules.in || true && \
316         export KPKG_DEST_DIR="$$(pwd)/.." && \
317         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
318         rm -rf debian/tmp/modules-deb && \
319         mkdir debian/tmp/modules-deb && \
320         pushd debian/tmp/modules-deb && \
321         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
322         mkdir usr_src/ && \
323         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
324         chmod 755 usr_src/modules/lustre/debian/rules && \
325         mkdir -p usr_share_modass && \
326         ln -s /usr/share/modass/include/ usr_share_modass/ && \
327         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
328         echo "lustre" > usr_share_modass/compliant.list && \
329         export MA_DIR=$$(pwd)/usr_share_modass && \
330         KVERS=$${KVERS:-$(LINUXRELEASE)} && \
331         export KSRC_TREE=$(LINUX) && \
332         KSRC=$${KSRC:-$(LINUX_OBJ)} && \
333         m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
334         popd && \
335         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
336         if test "x@ENABLE_SERVER@" = "xyes"; then \
337                 DEB_SERVER_PKG="../lustre-resource-agents_$${VER}_*.deb"; \
338         fi; \
339         mkdir -p debs && \
340         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
341            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
342            ../lustre-*-utils_$${VER}_*.deb $${DEB_SERVER_PKG} \
343            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
344            ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \
345            debs/
346
347 dkms-debs: undef.h
348         cp -v debian/changelog.in debian/changelog ; \
349         lversion=$$(echo @VERSION@ | tr '_' '-'); \
350         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
351         if [ "$$lversion" != "$$cversion" ]; then \
352                 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; \
353         fi; \
354         rm -rf debs; \
355         export DEB_BUILD_PROFILES="client"; \
356         export KERNEL_OBJ="$(LINUX_OBJ)"; \
357         export KERNEL_SRC="$(LINUX)"; \
358         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
359         echo "Kernel Source: $${KERNEL_SRC}"; \
360         echo "Kernel Object: $${KERNEL_OBJ}"; \
361         export BUILD_DKMS="true" && \
362         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
363                 rc=$${PIPESTATUS[0]}; \
364                 [ $${rc} -gt 1 ] && exit $${rc}; \
365                 exit 0; \
366         }; \
367         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
368         mkdir -p debs && \
369         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
370            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
371            ../lustre-*-utils_$${VER}_*.deb \
372            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
373            ../lustre_$${VER}.tar.gz ../lustre-*-modules-dkms_$${VER}_*.deb \
374            debs/
375
376 EXTRA_DIST += debian/*
377
378 CSTK=/tmp/checkstack
379 CSTKO=/tmp/checkstack.orig
380
381 checkstack:
382         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
383         { for MOD in $$(find . -name "*.ko"); do                             \
384                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
385           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
386         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
387
388 checkstack-update:
389         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
390
391 checkstack-clean:
392         rm -f ${CSTK} ${CSTKO}