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