Whamcloud - gitweb
LU-9116 libcfs: avoid overflow of crypto bandwidth caculation
[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 undef.h: config.h.in
85         grep -v config.h.in config.h.in > $@
86
87 dist-hook: undef.h
88         find $(distdir) -name .deps -o \
89                         -name CVS -o \
90                         -name .svn -o \
91                         -name .git -o \
92                         -name .#* -exec rm -rf {} \;
93
94 EXTRA_DIST = @PACKAGE_TARNAME@.spec     \
95         build/Makefile                  \
96         build/Rules.in                  \
97         config.h.in                     \
98         lustre-dkms_pre-build.sh        \
99         lustre-dkms_post-build.sh       \
100         LUSTRE-VERSION-GEN              \
101         LUSTRE-VERSION-FILE             \
102         undef.h
103
104 # contrib is a directory.  Putting a directory in EXTRA_DIST
105 # recursively includes the entire directory contents in the
106 # distribution tarball (the tarball created with "make dist").
107 EXTRA_DIST += contrib
108 EXTRA_DIST += rpm
109
110 rpm-local:
111         @(if test -z "$(RPMBUILD)"; then \
112                 echo -e "\n" \
113         "*** Required util 'rpmbuild' missing. Please install the\n" \
114         "*** package for your distribution which provides 'rpmbuild',\n" \
115         "*** re-run configure, and try again.\n"; \
116                 exit 1; \
117         fi; \
118         $(MKDIR_P) $(rpmbuilddir)/TMP   && \
119         $(MKDIR_P) $(rpmbuilddir)/BUILD && \
120         $(MKDIR_P) $(rpmbuilddir)/RPMS  && \
121         $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
122         $(MKDIR_P) $(rpmbuilddir)/SPECS && \
123         $(MKDIR_P) $(rpmbuilddir)/SOURCES)
124
125 if SERVER
126 DKMS_PACKAGE=$(PACKAGE)
127 DKMS_SERVER=--with servers
128 else
129 DKMS_PACKAGE=$(PACKAGE)-client
130 DKMS_SERVER=--without servers
131 endif
132
133 # Only zfs Lustre DKMS Server is supported, so previous configure command
134 # must use related parameters for success.
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; \
139         $(RPMBUILD) \
140                 --define "_tmppath $$rpmbuilddir/TMP" \
141                 --define "_topdir $$rpmbuilddir" \
142                 --define "_sourcedir $(top_srcdir)" \
143                 $(DKMS_SERVER) \
144                 --bs $(PACKAGE)-dkms.spec || exit 1; \
145         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
146         rm -rf $$rpmbuilddir
147
148 dkms-rpm: dkms-srpm
149         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
150         $(RPMBUILD) \
151                 --define "_tmppath $$rpmbuilddir/TMP" \
152                 --define "_topdir $$rpmbuilddir" \
153                 @RPMBUILD_BINARY_ARGS@ \
154                 --rebuild $(DKMS_PACKAGE)-dkms-*.src.rpm || exit 1; \
155         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
156         rm -rf $$rpmbuilddir
157
158 rpms: srpm
159         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
160         $(MAKE) $(AM_MAKEFLAGS) \
161                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
162         $(RPMBUILD) \
163                 --define "_tmppath $$rpmbuilddir/TMP" \
164                 --define "_topdir $$rpmbuilddir" \
165                 @RPMBUILD_BINARY_ARGS@ \
166                 --rebuild $(distdir)-*.src.rpm || exit 1; \
167         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
168         rm -rf $$rpmbuilddir
169
170 srpm: @PACKAGE_TARNAME@.spec dist Makefile
171         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
172         $(MAKE) $(AM_MAKEFLAGS) \
173                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
174         cp $(top_srcdir)/rpm/* $(top_srcdir); \
175         $(RPMBUILD) \
176                 --define "_tmppath $$rpmbuilddir/TMP" \
177                 --define "_topdir $$rpmbuilddir" \
178                 --define "dist %{nil}" \
179                 -ts $(distdir).tar.gz || exit 1; \
180         cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
181         rm -rf $$rpmbuilddir
182
183 # In the debs target, first make sure what's in the changelog reflects
184 # the software version.
185 debs: undef.h
186         lversion=$$(echo @VERSION@ | tr '_' '-'); \
187         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
188         if [ "$$lversion" != "$$cversion" ]; then \
189                 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; \
190         fi; \
191         rm -rf debs
192         dpkg-buildpackage -us -uc -I.git -I\*.out[0-9]\* -I\*.swp || { \
193                 rc=$${PIPESTATUS[0]}; \
194                 [ $${rc} -gt 1 ] && exit $${rc}; \
195                 exit 0; \
196         }
197         export KPKG_DEST_DIR="$$(pwd)/.." && \
198         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
199         rm -rf debian/tmp/modules-deb && \
200         mkdir debian/tmp/modules-deb && \
201         pushd debian/tmp/modules-deb && \
202         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
203         mkdir usr_src/ && \
204         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
205         chmod 755 usr_src/modules/lustre/debian/rules && \
206         mkdir -p usr_share_modass && \
207         ln -s /usr/share/modass/include/ usr_share_modass/ && \
208         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
209         echo "lustre" > usr_share_modass/compliant.list && \
210         export MA_DIR=$$(pwd)/usr_share_modass && \
211         KVERS=$${KVERS:-$(LINUXRELEASE)} && \
212         if test "x@ENABLEO2IB@" = "xno"; then \
213                 export IB_OPTIONS="--with-o2ib=no"; \
214         else \
215                 if test -n "@O2IBPATH@"; then \
216                         export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
217                 fi; \
218         fi; \
219         export KSRC_TREE=$(LINUX) && \
220         KSRC=$${KSRC:-$(LINUX_OBJ)} && \
221         m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
222         popd && \
223         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
224         mkdir -p debs && \
225         mv ../linux-patch-lustre_$${VER}_all.deb ../lustre-dev_$${VER}_*.deb \
226            ../lustre-source_$${VER}_all.deb ../lustre-tests_$${VER}_*.deb \
227            ../lustre-utils_$${VER}_*.deb ../lustre_$${VER}.dsc \
228            ../lustre_$${VER}_*.changes ../lustre_$${VER}.tar.gz \
229            ../lustre-client-modules-$${KVERS}_$${VER}_*.deb debs/
230
231 if USES_DPKG
232 EXTRA_DIST += debian/*
233 endif
234
235 CSTK=/tmp/checkstack
236 CSTKO=/tmp/checkstack.orig
237
238 checkstack:
239         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
240         { for MOD in $$(find . -name "*.ko"); do                             \
241                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
242           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
243         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
244
245 checkstack-update:
246         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
247
248 checkstack-clean:
249         rm -f ${CSTK} ${CSTKO}