Whamcloud - gitweb
LU-12705 build: fix building fail against Power9 little endian
[fs/lustre-release.git] / autoMakefile.am
1 SUBDIRS := @LDISKFS_SUBDIR@ \
2         . \
3         @LUSTREIOKIT_SUBDIR@ \
4         @LIBCFS_SUBDIR@ \
5         @SNMP_SUBDIR@ \
6         lnet \
7         lustre
8
9 DIST_SUBDIRS := ldiskfs \
10         lustre-iokit \
11         @LIBCFS_SUBDIR@ \
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),-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
106 # contrib is a directory.  Putting a directory in EXTRA_DIST
107 # recursively includes the entire directory contents in the
108 # distribution tarball (the tarball created with "make dist").
109 EXTRA_DIST += contrib
110 EXTRA_DIST += rpm
111
112 rpm-local:
113         @(if test -z "$(RPMBUILD)"; then \
114                 echo -e "\n" \
115         "*** Required util 'rpmbuild' missing. Please install the\n" \
116         "*** package for your distribution which provides 'rpmbuild',\n" \
117         "*** re-run configure, and try again.\n"; \
118                 exit 1; \
119         fi; \
120         $(MKDIR_P) $(rpmbuilddir)/TMP   && \
121         $(MKDIR_P) $(rpmbuilddir)/BUILD && \
122         $(MKDIR_P) $(rpmbuilddir)/RPMS  && \
123         $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
124         $(MKDIR_P) $(rpmbuilddir)/SPECS && \
125         $(MKDIR_P) $(rpmbuilddir)/SOURCES)
126
127 if SERVER
128 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
129         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
130         $(MAKE) $(AM_MAKEFLAGS) \
131                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
132         $(RPMBUILD) \
133                 --define "_tmppath $$rpmbuilddir/TMP" \
134                 --define "_topdir $$rpmbuilddir" \
135                 --define "_sourcedir $(top_srcdir)" \
136                 --with servers --with zfs -without ldiskfs \
137                 --bs $(PACKAGE)-dkms.spec || exit 1; \
138         $(RPMBUILD) \
139                 --define "_tmppath $$rpmbuilddir/TMP" \
140                 --define "_topdir $$rpmbuilddir" \
141                 --define "_sourcedir $(top_srcdir)" \
142                 --with servers --without zfs --with ldiskfs \
143                 --bs $(PACKAGE)-dkms.spec || exit 1; \
144         $(RPMBUILD) \
145                 --define "_tmppath $$rpmbuilddir/TMP" \
146                 --define "_topdir $$rpmbuilddir" \
147                 --define "_sourcedir $(top_srcdir)" \
148                 --with servers --with zfs --with ldiskfs \
149                 --bs $(PACKAGE)-dkms.spec || exit 1; \
150         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
151         rm -rf $$rpmbuilddir
152
153 dkms-rpm: dkms-srpm
154         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
155         $(RPMBUILD) \
156                 --define "_tmppath $$rpmbuilddir/TMP" \
157                 --define "_topdir $$rpmbuilddir" \
158                 @RPMBUILD_BINARY_ARGS@ \
159                 --with servers --with zfs --without ldiskfs \
160                 --rebuild $(PACKAGE)-zfs-dkms-*.src.rpm || exit 1; \
161         $(RPMBUILD) \
162                 --define "_tmppath $$rpmbuilddir/TMP" \
163                 --define "_topdir $$rpmbuilddir" \
164                 @RPMBUILD_BINARY_ARGS@ \
165                 --with servers --without zfs --with ldiskfs \
166                 --rebuild $(PACKAGE)-ldiskfs-dkms-*.src.rpm || exit 1; \
167         $(RPMBUILD) \
168                 --define "_tmppath $$rpmbuilddir/TMP" \
169                 --define "_topdir $$rpmbuilddir" \
170                 @RPMBUILD_BINARY_ARGS@ \
171                 --with servers --with zfs --with ldiskfs \
172                 --rebuild $(PACKAGE)-all-dkms-*.src.rpm || exit 1; \
173         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
174         rm -rf $$rpmbuilddir
175 else
176
177 dkms-srpm: $(PACKAGE)-dkms.spec dist Makefile
178         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
179         $(MAKE) $(AM_MAKEFLAGS) \
180                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
181         $(RPMBUILD) \
182                 --define "_tmppath $$rpmbuilddir/TMP" \
183                 --define "_topdir $$rpmbuilddir" \
184                 --define "_sourcedir $(top_srcdir)" \
185                 --without servers \
186                 --bs $(PACKAGE)-dkms.spec || exit 1; \
187         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
188         rm -rf $$rpmbuilddir
189
190 dkms-rpm: dkms-srpm
191         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
192         $(RPMBUILD) \
193                 --define "_tmppath $$rpmbuilddir/TMP" \
194                 --define "_topdir $$rpmbuilddir" \
195                 @RPMBUILD_BINARY_ARGS@ \
196                 --without servers \
197                 --rebuild $(PACKAGE)-client-dkms-*.src.rpm || exit 1; \
198         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
199         rm -rf $$rpmbuilddir
200
201 endif
202
203 dkms-srpms: dkms-srpm
204
205 dkms-rpms: dkms-rpm
206
207 rpms: srpm
208         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
209         $(MAKE) $(AM_MAKEFLAGS) \
210                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
211         $(RPMBUILD) \
212                 --define "_tmppath $$rpmbuilddir/TMP" \
213                 --define "_topdir $$rpmbuilddir" \
214                 @RPMBUILD_BINARY_ARGS@ \
215                 --rebuild $(distdir)-*.src.rpm || exit 1; \
216         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
217         rm -rf $$rpmbuilddir
218
219 srpm: @PACKAGE_TARNAME@.spec dist Makefile
220         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
221         $(MAKE) $(AM_MAKEFLAGS) \
222                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
223         cp $(top_srcdir)/rpm/* $(top_srcdir); \
224         $(RPMBUILD) \
225                 --define "_tmppath $$rpmbuilddir/TMP" \
226                 --define "_topdir $$rpmbuilddir" \
227                 --define "dist %{nil}" \
228                 -ts $(distdir).tar.gz || exit 1; \
229         cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
230         rm -rf $$rpmbuilddir
231
232 # In the debs target, first make sure what's in the changelog reflects
233 # the software version.
234 debs: undef.h
235         lversion=$$(echo @VERSION@ | tr '_' '-'); \
236         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
237         if [ "$$lversion" != "$$cversion" ]; then \
238                 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; \
239         fi; \
240         rm -rf debs; \
241         if test "x@ENABLE_SERVER@" = "xyes"; then \
242                 DEB_BUILD_PROFILES="server"; \
243         else \
244                 DEB_BUILD_PROFILES="client"; \
245         fi; \
246         if test "x@ENABLE_LDISKFS@" = "xyes"; then \
247                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} ldiskfs"; \
248         fi; \
249         if test "x@ENABLE_ZFS@" = "xyes"; then \
250                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} zfs"; \
251                 export SPL_SRC="@SPL@"; \
252                 export ZFS_SRC="@ZFS@"; \
253                 echo "ZFS support is enabled. Will expect pre-compiled SPL and ZFS sources in:"; \
254                 echo "SPL: $${SPL_SRC}"; \
255                 echo "ZFS: $${ZFS_SRC}"; \
256         fi; \
257         if test "x@ENABLEO2IB@" != "xno"; then \
258                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} o2ib"; \
259                 export O2IB_SRC="@O2IBPATH@"; \
260         fi; \
261         if test "x@ENABLE_GSS@" = "xyes"; then \
262                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} gss"; \
263         elif test "x@ENABLE_GSS@" = "xno"; then \
264                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} nogss"; \
265         fi; \
266         if test "x@systemdsystemunitdir@" != "x"; then \
267                 export DEB_BUILD_PROFILES="$${DEB_BUILD_PROFILES} systemd"; \
268         fi; \
269         export KERNEL_OBJ="$(LINUX_OBJ)"; \
270         export KERNEL_SRC="$(LINUX)"; \
271         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
272         echo "Kernel Source: $${KERNEL_SRC}"; \
273         echo "Kernel Object: $${KERNEL_OBJ}"; \
274         if test "x@ENABLEO2IB@" = "xno"; then \
275                 export IB_OPTIONS="--with-o2ib=no"; \
276         else \
277                 if test "x@ENABLEO2IB@" != "xyes" && \
278                    test -n "@O2IBPATH@"; then \
279                         export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
280                 else \
281                         export IB_OPTIONS="--with-o2ib=yes"; \
282                 fi; \
283         fi; \
284         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
285                 rc=$${PIPESTATUS[0]}; \
286                 [ $${rc} -gt 1 ] && exit $${rc}; \
287                 exit 0; \
288         }; \
289         export KPKG_DEST_DIR="$$(pwd)/.." && \
290         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
291         rm -rf debian/tmp/modules-deb && \
292         mkdir debian/tmp/modules-deb && \
293         pushd debian/tmp/modules-deb && \
294         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
295         mkdir usr_src/ && \
296         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
297         chmod 755 usr_src/modules/lustre/debian/rules && \
298         mkdir -p usr_share_modass && \
299         ln -s /usr/share/modass/include/ usr_share_modass/ && \
300         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
301         echo "lustre" > usr_share_modass/compliant.list && \
302         export MA_DIR=$$(pwd)/usr_share_modass && \
303         KVERS=$${KVERS:-$(LINUXRELEASE)} && \
304         export KSRC_TREE=$(LINUX) && \
305         KSRC=$${KSRC:-$(LINUX_OBJ)} && \
306         m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
307         popd && \
308         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
309         if test "x@ENABLE_SERVER@" = "xyes"; then \
310                 DEB_SERVER_PKG="../lustre-resource-agents_$${VER}_*.deb"; \
311         fi; \
312         mkdir -p debs && \
313         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
314            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
315            ../lustre-*-utils_$${VER}_*.deb $${DEB_SERVER_PKG} \
316            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
317            ../lustre_$${VER}.tar.gz ../lustre-*-modules-$${KVERS}_$${VER}_*.deb \
318            debs/
319
320 dkms-debs: undef.h
321         lversion=$$(echo @VERSION@ | tr '_' '-'); \
322         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
323         if [ "$$lversion" != "$$cversion" ]; then \
324                 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; \
325         fi; \
326         rm -rf debs; \
327         export DEB_BUILD_PROFILES="client"; \
328         export KERNEL_OBJ="$(LINUX_OBJ)"; \
329         export KERNEL_SRC="$(LINUX)"; \
330         echo "Enabled Build Profiles: $${DEB_BUILD_PROFILES}"; \
331         echo "Kernel Source: $${KERNEL_SRC}"; \
332         echo "Kernel Object: $${KERNEL_OBJ}"; \
333         export BUILD_DKMS="true" && \
334         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
335                 rc=$${PIPESTATUS[0]}; \
336                 [ $${rc} -gt 1 ] && exit $${rc}; \
337                 exit 0; \
338         }; \
339         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
340         mkdir -p debs && \
341         mv ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb \
342            ../lustre-iokit_$${VER}_*.deb ../lustre-tests_$${VER}_*.deb \
343            ../lustre-*-utils_$${VER}_*.deb \
344            ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes \
345            ../lustre_$${VER}.tar.gz ../lustre-*-modules-dkms_$${VER}_*.deb \
346            debs/
347
348 EXTRA_DIST += debian/*
349
350 CSTK=/tmp/checkstack
351 CSTKO=/tmp/checkstack.orig
352
353 checkstack:
354         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
355         { for MOD in $$(find . -name "*.ko"); do                             \
356                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
357           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
358         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
359
360 checkstack-update:
361         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
362
363 checkstack-clean:
364         rm -f ${CSTK} ${CSTKO}