Whamcloud - gitweb
LU-2730 mdt: fix erroneous LASSERT in mdt_reint_opcode
[fs/lustre-release.git] / autoMakefile.am
1 SUBDIRS := @LDISKFS_SUBDIR@ @SPL_SUBDIR@ @ZFS_SUBDIR@ . @LIBSYSIO_SUBDIR@ @SNMP_SUBDIR@ @LUSTREIOKIT_SUBDIR@ @LIBCFS_SUBDIR@ lnet lustre
2 DIST_SUBDIRS := @LDISKFS_DIST_SUBDIR@ @SNMP_DIST_SUBDIR@ libsysio lustre-iokit @LIBCFS_SUBDIR@ lnet lustre
3 SOURCES_SUBDIRS := @LIBCFS_SUBDIR@ lnet lustre
4 RPM_SUBDIRS := @LDISKFS_SUBDIR@ @LUSTREIOKIT_SUBDIR@
5 MODULE_SYMVERS_DEPS = module-symvers
6
7 @TESTS_TRUE@BUILD_TESTS = true
8 @TESTS_FALSE@BUILD_TESTS = false
9 @SERVER_TRUE@BUILD_SERVER = true
10 @SERVER_FALSE@BUILD_SERVER = false
11 @CLIENT_TRUE@BUILD_CLIENT = true
12 @CLIENT_FALSE@BUILD_CLIENT = false
13 @LDISKFS_ENABLED_TRUE@BUILD_OSD_LDISKFS = true
14 @LDISKFS_ENABLED_FALSE@BUILD_OSD_LDISKFS = false
15 @ZFS_ENABLED_TRUE@BUILD_OSD_ZFS = true
16 @ZFS_ENABLED_FALSE@BUILD_OSD_ZFS = false
17
18 AUTOMAKE_OPTIONS = foreign
19
20 FIND_TAG_FILES_CMD = find $(top_srcdir) \
21                      -path $(top_srcdir)/ldiskfs/ldiskfs/linux-stage \
22                      -prune -false -o -type f -name '*.[hc]'
23
24 MAKEEACHSUBDIR =                                        \
25         for subdir in $(RPM_SUBDIRS) ; do               \
26                 echo "Making $@ in $$subdir" ;          \
27                 cd $$subdir ;                           \
28                 $(MAKE) $(AM_MAKEFLAGS) $@ ;            \
29                 cd - ;                                  \
30                 echo "Finished $@ in $$subdir" ;        \
31         done
32
33 # these empty rules are needed so that automake doesn't add its own
34 # recursive rules
35 etags-recursive:
36
37 ctags-recursive:
38
39 tags-recursive:
40
41 TAGS: etags
42
43 tags: ctags etags
44
45 etags:
46         $(RM) $(top_srcdir)/TAGS
47         ETAGSF=`etags --version | grep -iq exuberant && \
48                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
49         $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
50
51 ctags:
52         $(RM) $(top_srcdir)/tags
53         CTAGSF=`ctags --version | grep -iq exuberant && \
54                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
55         $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
56
57 cscope-recursive:
58
59 cscope:
60         $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
61         $(FIND_TAG_FILES_CMD) > cscope.files
62         cscope -bRq
63
64 mkid:
65         $(FIND_TAG_FILES_CMD) | xargs mkid
66
67
68 doxygen:  doxygen-api doxygen-ref
69
70 doxygen-%: build/doxyfile.%
71            doxygen $<
72
73 if MODULES
74 sources: all-sources
75
76 all-sources: $(MODULE_SYMVERS_DEPS)
77         for dir in $(SOURCES_SUBDIRS) ; do \
78                 $(MAKE) sources -C $$dir || exit $$? ; \
79         done
80
81 if LINUX
82 all-am: modules
83
84 modules: $(DEP) all-sources
85         $(MAKE) CC="$(CC)" -C $(LINUX_OBJ)                           \
86         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
87         LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -include $(CONFIG_INCLUDE)' \
88         $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
89         include/config/MARKER $@
90 endif # LINUX
91
92 endif # MODULES
93
94 dist-hook:
95         $(RM) $(distdir)/ldiskfs/*.spec
96         $(RM) $(distdir)/lustre-iokit/*.spec
97         find $(distdir) -name .deps -o \
98                         -name CVS -o \
99                         -name .svn -o \
100                         -name .git -o \
101                         -name .#* | xargs rm -rf
102         $(MAKE) $(AM_MAKEFLAGS) \
103           top_distdir="$(top_distdir)" distdir="$(distdir)" \
104           module-dist-hook
105
106 EXTRA_DIST = @PACKAGE_TARNAME@.spec                                     \
107         build/Makefile build/lbuild*                                    \
108         build/Rules.in                                                  \
109         build/update_oldconfig                                          \
110         build/autoconf/lustre-build-linux.m4                            \
111         build/autoconf/lustre-build-darwin.m4                           \
112         build/autoconf/lustre-build-ldiskfs.m4                          \
113         build/autoconf/lustre-build.m4 build/rdac_spec                  \
114         build/mptlinux.spec.patch build/patches                         \
115         build/funcs.sh build/find_linux_rpms build/exit_traps.sh
116
117 rpms-real: @PACKAGE_TARNAME@.spec dist Makefile
118         CONFIGURE_ARGS=$$(echo $$(eval echo $(ac_configure_args)) | \
119                 sed -re 's/--(en|dis)able-tests//'); \
120         if [ -n "@LINUX@" ]; then \
121                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
122                         sed -re 's/--with-linux=[^ ][^ ]*//'); \
123                 RPMARGS="--define \"kdir @LINUX@\""; \
124                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
125                         sed -re 's/--with-linux-obj=[^ ][^ ]*//'); \
126                 if [ -n "@LINUX_OBJ@" -a "@LINUX_OBJ@" != "@LINUX@" ]; then \
127                         RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \
128                 fi; \
129         fi; \
130         CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
131                 sed -re 's/--with-release=[^ ][^ ]*//'); \
132         RPMARGS="$$RPMARGS --define \"configure_args $$CONFIGURE_ARGS\""; \
133         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
134                 RPMARGS="$$RPMARGS --define \"build_lustre_tests 0\""; \
135         fi; \
136         if [[ "X$(BUILD_SERVER)" = Xfalse ]]; then \
137                 RPMARGS="$$RPMARGS --define \"lustre_name lustre-client\""; \
138         fi; \
139         if [[ "X$(BUILD_OSD_LDISKFS)" = Xfalse ]]; then \
140                 RPMARGS="$$RPMARGS --define \"build_lustre_osd_ldiskfs 0\""; \
141         fi; \
142         if [[ "X$(BUILD_OSD_ZFS)" = Xfalse ]]; then \
143                 RPMARGS="$$RPMARGS --define \"build_lustre_osd_zfs 0\""; \
144         fi; \
145         echo "Building Lustre RPM with $$RPMARGS"; \
146         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
147
148 srpm-real: @PACKAGE_TARNAME@.spec dist Makefile
149         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
150                 RPMARGS="--define \"build_lustre_tests 0\""; \
151         fi; \
152         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
153
154 rpms:
155         @$(MAKEEACHSUBDIR)
156         $(MAKE) $(AM_MAKEFLAGS) rpms-real
157
158 srpm:
159         @$(MAKEEACHSUBDIR)
160         $(MAKE) $(AM_MAKEFLAGS) srpm-real
161
162 # In the debs target, first make sure what's in the changelog reflects
163 # the software version.  Here's how we could dig the version out of the
164 # autoconf version file directly:
165 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
166 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
167 #
168 # However, one cannot really run "make debs" without having done a
169 # configure first, so we could use the easier method of digging the
170 # version out of the config.h file.
171 debs:
172         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
173         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
174         if [ "$$lversion" != "$$cversion" ]; then \
175                 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; \
176         fi; \
177         rm -rf debs
178         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
179                 rc=$${PIPESTATUS[0]}; \
180                 [ $${rc} -gt 1 ] && exit $${rc}; \
181                 exit 0; \
182         }
183         export KPKG_DEST_DIR="$$(pwd)/.." && \
184         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
185         rm -rf debian/tmp/modules-deb && \
186         mkdir debian/tmp/modules-deb && \
187         pushd debian/tmp/modules-deb && \
188         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
189         mkdir usr_src/ && \
190         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
191         chmod 755 usr_src/modules/lustre/debian/rules && \
192         mkdir -p usr_share_modass && \
193         ln -s /usr/share/modass/include/ usr_share_modass/ && \
194         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
195         echo "lustre" > usr_share_modass/compliant.list && \
196         export MA_DIR=$$(pwd)/usr_share_modass && \
197         KVERS=$${KVERS:-$(LINUXRELEASE)}; \
198         m-a build $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
199         popd && \
200         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog); \
201         mkdir -p debs && \
202         mv ../liblustre_$${VER}_*.deb ../linux-patch-lustre_$${VER}_all.deb ../lustre-dev_$${VER}_*.deb ../lustre-source_$${VER}_all.deb ../lustre-tests_$${VER}_*.deb ../lustre-utils_$${VER}_*.deb ../lustre_$${VER}.dsc ../lustre_$${VER}_*.changes ../lustre_$${VER%-[0-9]*}.orig.tar.gz ../lustre_$${VER}.diff.gz ../lustre-client-modules-$${KVERS}_$${VER}_*.deb debs/
203
204 EXTRA_DIST += config.h.in
205
206 if USES_DPKG
207 EXTRA_DIST += debian/*
208 endif
209
210 module-symvers-ldiskfs:
211 if LDISKFS_ENABLED
212         @if [ -f @LDISKFS_DIR@/@SYMVERFILE@ ]; then \
213                 cat @LDISKFS_DIR@/@SYMVERFILE@ >>@SYMVERFILE@; \
214         elif [ -f @LDISKFS_DIR@/ldiskfs/@SYMVERFILE@ ]; then \
215                 cat @LDISKFS_DIR@/ldiskfs/@SYMVERFILE@ >>@SYMVERFILE@; \
216         else \
217                 echo -e "\n" \
218                 "*** Missing ldiskfs symbols. Ensure you have built ldiskfs:\n"\
219                 "*** - @LDISKFS_OBJ@/ldiskfs/@SYMVERFILE@\n"; \
220                 exit 1; \
221         fi
222 endif # LDISKFS_ENABLED
223
224 module-symvers-zfs:
225 if ZFS_ENABLED
226         @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
227                 cat @SPL_OBJ@/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
228         elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
229                 cat @SPL_OBJ@/module/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
230         else \
231                 echo -e "\n" \
232                 "*** Missing spl symbols. Ensure you have built spl:\n" \
233                 "*** - @SPL_OBJ@/@SYMVERFILE@\n"; \
234                 exit 1; \
235         fi
236         @if [ -f @ZFS_OBJ@/@ZFS_SYMBOLS@ ]; then \
237                 cat @ZFS_OBJ@/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
238         elif [ -f @ZFS_OBJ@/module/@ZFS_SYMBOLS@ ]; then \
239                 cat @ZFS_OBJ@/module/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
240         else \
241                 echo -e "\n" \
242                 "*** Missing zfs symbols. Ensure you have built zfs:\n" \
243                 "*** - @ZFS_OBJ@/@SYMVERFILE@\n"; \
244                 exit 1; \
245         fi
246 endif # ZFS_ENABLED
247
248 module-symvers: module-symvers-ldiskfs module-symvers-zfs
249
250 CSTK=/tmp/checkstack
251 CSTKO=/tmp/checkstack.orig
252
253 checkstack:
254         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
255         { for MOD in $$(find . -name "*.ko"); do                             \
256                 objdump -d $$MOD | perl build/checkstack.pl;                 \
257           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
258         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -30 ${CSTK}
259
260 checkstack-update:
261         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
262
263 checkstack-clean:
264         rm -f ${CSTK} ${CSTKO}
265
266 module-dist-hook:
267         if [ -d CVS -o -d .git ]; then \
268                 perl lustre/scripts/make_META.pl > $(distdir)/META; \
269         elif [ -f META ]; then \
270                 cp META $(distdir)/META; \
271         else \
272                 echo -e "I have no idea how to create a META file in $(distdir).\nPlease file a bug at http://bugzilla.lustre.org/"; \
273                 exit 1; \
274         fi
275 if LDISKFS_ENABLED
276         if [ -f $(distdir)/META -a -d $(distdir)/ldiskfs ]; then \
277                 cp $(distdir)/META $(distdir)/ldiskfs/META; \
278         fi
279 endif