Whamcloud - gitweb
LU-3543 quota: minor fix in s-q test_7c
[fs/lustre-release.git] / autoMakefile.am
1 SUBDIRS := @LDISKFS_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 config contrib
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)" $(CROSS_VARS) -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                                                  \
108         build/Rules.in
109
110 if ARCH_MIC
111 EXTRA_DIST += build/gen_filelist.sh
112 endif
113
114 rpms-real: @PACKAGE_TARNAME@.spec dist Makefile
115         CONFIGURE_ARGS=$$(echo $$(eval echo $(ac_configure_args)) | \
116                 sed -re 's/--(en|dis)able-tests//'); \
117         if [ -n "@LINUX@" ]; then \
118                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
119                         sed -re 's/--with-linux=[^ ][^ ]*//'); \
120                 RPMARGS="--define \"kdir @LINUX@\""; \
121                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
122                         sed -re 's/--with-linux-obj=[^ ][^ ]*//'); \
123                 if [ -n "@LINUX_OBJ@" -a "@LINUX_OBJ@" != "@LINUX@" ]; then \
124                         RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \
125                 fi; \
126         fi; \
127         if [ -n "@CROSS_PATH@" ]; then \
128                 if [[ "X$(BUILD_SERVER)" = Xtrue ]]; then \
129                         echo -e "\n" \
130                         "*** Don't support cross compilation for the Intel(R) Xeon Phi(TM) card.\n"; \
131                         exit 1; \
132                 fi; \
133                 CROSS_SUFFIX="-mic"; \
134                 RPMARGS="$$RPMARGS --define \"post_script build/gen_filelist.sh\""; \
135                 RPMARGS="$$RPMARGS --define \"cross_path @CROSS_PATH@\""; \
136                 RPMARGS="$$RPMARGS --define \"rootdir %{cross_path}\""; \
137                 RPMARGS="$$RPMARGS --define \"_prefix %{cross_path}/usr\""; \
138                 RPMARGS="$$RPMARGS --define \"_mandir %{_prefix}/share/man\""; \
139                 RPMARGS="$$RPMARGS --define \"_sysconfdir %{cross_path}/etc\""; \
140                 RPMARGS="$$RPMARGS --define \"make_args @CROSS_VARS@\""; \
141                 if [ -s @LINUX@/../../.ver.build ]; then \
142                         MPSS_VERSION=$$(sed -ne 's/DRIVERS_\(.*\)-.*/\1/p' @LINUX@/../../.ver.build); \
143                         if [ -n "$$MPSS_VERSION" ]; then \
144                                 RPMARGS="$$RPMARGS --define \"cross_requires intel-mic-gpl = 2.1.$$MPSS_VERSION\""; \
145                         fi; \
146                 fi; \
147         fi; \
148         CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
149                 sed -re 's/--with-release=[^ ][^ ]*//'); \
150         RPMARGS="$$RPMARGS --define \"configure_args $$CONFIGURE_ARGS\""; \
151         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
152                 RPMARGS="$$RPMARGS --define \"build_lustre_tests 0\""; \
153         fi; \
154         if [[ "X$(BUILD_SERVER)" = Xfalse ]]; then \
155                 RPMARGS="$$RPMARGS --define \"lustre_name lustre-client$$CROSS_SUFFIX\""; \
156         fi; \
157         if [[ "X$(BUILD_OSD_LDISKFS)" = Xtrue ]]; then \
158                 RPMARGS="$$RPMARGS --define \"build_lustre_osd_ldiskfs 1\""; \
159         fi; \
160         if [[ "X$(BUILD_OSD_ZFS)" = Xtrue ]]; then \
161                 RPMARGS="$$RPMARGS --define \"build_lustre_osd_zfs 1\""; \
162         fi; \
163         echo "Building Lustre RPM with $$RPMARGS"; \
164         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
165
166 srpm-real: @PACKAGE_TARNAME@.spec dist Makefile
167         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
168                 RPMARGS="--define \"build_lustre_tests 0\""; \
169         fi; \
170         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
171
172 rpms:
173         @$(MAKEEACHSUBDIR)
174         $(MAKE) $(AM_MAKEFLAGS) rpms-real
175
176 srpm:
177         @$(MAKEEACHSUBDIR)
178         $(MAKE) $(AM_MAKEFLAGS) srpm-real
179
180 # In the debs target, first make sure what's in the changelog reflects
181 # the software version.  Here's how we could dig the version out of the
182 # autoconf version file directly:
183 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
184 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
185 #
186 # However, one cannot really run "make debs" without having done a
187 # configure first, so we could use the easier method of digging the
188 # version out of the config.h file.
189 debs:
190         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
191         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
192         if [ "$$lversion" != "$$cversion" ]; then \
193                 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; \
194         fi; \
195         rm -rf debs
196         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
197                 rc=$${PIPESTATUS[0]}; \
198                 [ $${rc} -gt 1 ] && exit $${rc}; \
199                 exit 0; \
200         }
201         export KPKG_DEST_DIR="$$(pwd)/.." && \
202         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
203         rm -rf debian/tmp/modules-deb && \
204         mkdir debian/tmp/modules-deb && \
205         pushd debian/tmp/modules-deb && \
206         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
207         mkdir usr_src/ && \
208         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
209         chmod 755 usr_src/modules/lustre/debian/rules && \
210         mkdir -p usr_share_modass && \
211         ln -s /usr/share/modass/include/ usr_share_modass/ && \
212         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
213         echo "lustre" > usr_share_modass/compliant.list && \
214         export MA_DIR=$$(pwd)/usr_share_modass && \
215         KVERS=$${KVERS:-$(LINUXRELEASE)}; \
216         m-a build $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
217         popd && \
218         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog); \
219         mkdir -p debs && \
220         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/
221
222 EXTRA_DIST += config.h.in
223
224 if USES_DPKG
225 EXTRA_DIST += debian/*
226 endif
227
228 module-symvers-ldiskfs:
229 if LDISKFS_ENABLED
230         @if [ -f @LDISKFS_DIR@/@SYMVERFILE@ ]; then \
231                 cat @LDISKFS_DIR@/@SYMVERFILE@ >>@SYMVERFILE@; \
232         elif [ -f @LDISKFS_DIR@/ldiskfs/@SYMVERFILE@ ]; then \
233                 cat @LDISKFS_DIR@/ldiskfs/@SYMVERFILE@ >>@SYMVERFILE@; \
234         else \
235                 echo -e "\n" \
236                 "*** Missing ldiskfs symbols. Ensure you have built ldiskfs:\n"\
237                 "*** - @LDISKFS_OBJ@/ldiskfs/@SYMVERFILE@\n"; \
238                 exit 1; \
239         fi
240 endif # LDISKFS_ENABLED
241
242 module-symvers-zfs:
243 if ZFS_ENABLED
244         @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
245                 cat @SPL_OBJ@/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
246         elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
247                 cat @SPL_OBJ@/module/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
248         else \
249                 echo -e "\n" \
250                 "*** Missing spl symbols. Ensure you have built spl:\n" \
251                 "*** - @SPL_OBJ@/@SYMVERFILE@\n"; \
252                 exit 1; \
253         fi
254         @if [ -f @ZFS_OBJ@/@ZFS_SYMBOLS@ ]; then \
255                 cat @ZFS_OBJ@/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
256         elif [ -f @ZFS_OBJ@/module/@ZFS_SYMBOLS@ ]; then \
257                 cat @ZFS_OBJ@/module/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
258         else \
259                 echo -e "\n" \
260                 "*** Missing zfs symbols. Ensure you have built zfs:\n" \
261                 "*** - @ZFS_OBJ@/@SYMVERFILE@\n"; \
262                 exit 1; \
263         fi
264 endif # ZFS_ENABLED
265
266 module-symvers: module-symvers-ldiskfs module-symvers-zfs
267
268 CSTK=/tmp/checkstack
269 CSTKO=/tmp/checkstack.orig
270
271 checkstack:
272         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
273         { for MOD in $$(find . -name "*.ko"); do                             \
274                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
275           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
276         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -30 ${CSTK}
277
278 checkstack-update:
279         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
280
281 checkstack-clean:
282         rm -f ${CSTK} ${CSTKO}
283
284 module-dist-hook:
285         if [ -d CVS -o -d .git ]; then \
286                 perl lustre/scripts/make_META.pl > $(distdir)/META; \
287         elif [ -f META ]; then \
288                 cp META $(distdir)/META; \
289         else \
290                 echo -e "I have no idea how to create a META file in $(distdir).\nPlease file a bug at http://bugzilla.lustre.org/"; \
291                 exit 1; \
292         fi
293 if LDISKFS_ENABLED
294         if [ -f $(distdir)/META -a -d $(distdir)/ldiskfs ]; then \
295                 cp $(distdir)/META $(distdir)/ldiskfs/META; \
296         fi
297 endif