Whamcloud - gitweb
LU-3466 iokit: Make lustre-iokit a subpackage of lustre
[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 @BUILD_LUSTREIOKIT_TRUE@BUILD_LUSTREIOKIT = true
15 @BUILD_LUSTREIOKIT_FALSE@BUILD_LUSTREIOKIT = false
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 sources: all-sources
65
66 all-sources: module-symvers
67         $(MAKE) sources -C lustre || exit $$?
68
69 if LINUX
70 all-am: modules
71
72 modules: $(DEP) all-sources
73         $(MAKE) CC="$(CC)" $(CROSS_VARS) -C $(LINUX_OBJ)             \
74         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
75         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)' \
76         $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
77         include/config/MARKER $@
78 endif # LINUX
79
80 endif # MODULES
81
82 dist-hook:
83         find $(distdir) -name .deps -o \
84                         -name CVS -o \
85                         -name .svn -o \
86                         -name .git -o \
87                         -name .#* | xargs rm -rf
88         $(MAKE) $(AM_MAKEFLAGS) \
89           top_distdir="$(top_distdir)" distdir="$(distdir)" \
90           module-dist-hook
91
92 EXTRA_DIST = @PACKAGE_TARNAME@.spec     \
93         build/Makefile                  \
94         build/Rules.in                  \
95         build/gen_filelist.sh
96
97 rpms-real: @PACKAGE_TARNAME@.spec dist Makefile
98         @CONFIGURE_ARGS=""; \
99         for arg in $(ac_configure_args); do \
100                 case $$arg in \
101                         --with-release=* ) ;; \
102                         --enable-tests | --disable-tests ) ;; \
103                         --with-linux=* | --with-linux-obj=* ) ;; \
104                         * ) CONFIGURE_ARGS="$$CONFIGURE_ARGS '$$arg'" ;; \
105                 esac; \
106         done; \
107         RPMARGS="--define \"configure_args $$CONFIGURE_ARGS\""; \
108         if [ -n "@LINUX@" ]; then  \
109                 RPMARGS="$$RPMARGS --define \"kdir @LINUX@\""; \
110                 if [ -n "@LINUX_OBJ@" -a "@LINUX_OBJ@" != "@LINUX@" ]; then \
111                         RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \
112                 fi; \
113         fi; \
114         if [ -n "@CROSS_PATH@" ]; then \
115                 if [[ "X$(BUILD_SERVER)" = Xtrue ]]; then \
116                         echo -e "\n" \
117                         "*** Don't support cross compilation for the Intel(R) Xeon Phi(TM) card.\n"; \
118                         exit 1; \
119                 fi; \
120                 CROSS_SUFFIX="-mic"; \
121                 RPMARGS="$$RPMARGS --define \"post_script build/gen_filelist.sh\""; \
122                 RPMARGS="$$RPMARGS --define \"cross_path @CROSS_PATH@\""; \
123                 RPMARGS="$$RPMARGS --define \"rootdir %{cross_path}\""; \
124                 RPMARGS="$$RPMARGS --define \"_prefix %{cross_path}/usr\""; \
125                 RPMARGS="$$RPMARGS --define \"_mandir %{_prefix}/share/man\""; \
126                 RPMARGS="$$RPMARGS --define \"_sysconfdir %{cross_path}/etc\""; \
127                 RPMARGS="$$RPMARGS --define \"make_args @CROSS_VARS@\""; \
128                 if [ "@CC_TARGET_ARCH@" = "k1om-mpss-linux" ]; then \
129                         RPMARGS="$$RPMARGS --define \"cross_requires mpss-bootimage\""; \
130                 else \
131                         RPMARGS="$$RPMARGS --define \"cross_requires intel-mic-gpl\""; \
132                 fi; \
133         fi; \
134         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
135                 RPMARGS="$$RPMARGS --without lustre_tests"; \
136         fi; \
137         if [[ "X$(BUILD_SERVER)" = Xfalse ]]; then \
138                 RPMARGS="$$RPMARGS --without servers"; \
139                 if [ -n "$$CROSS_SUFFIX" ]; then \
140                         RPMARGS="$$RPMARGS --define \"lustre_name lustre-client$$CROSS_SUFFIX\""; \
141                 fi; \
142         fi; \
143         if [[ "X$(BUILD_OSD_LDISKFS)" = Xtrue ]]; then \
144                 RPMARGS="$$RPMARGS --with ldiskfs"; \
145         fi; \
146         if [[ "X$(BUILD_OSD_ZFS)" = Xtrue ]]; then \
147                 RPMARGS="$$RPMARGS --with zfs"; \
148         fi; \
149         if [[ "X$(BUILD_LUSTREIOKIT)" = Xfalse ]]; then \
150                 RPMARGS="$$RPMARGS --without lustre_iokit"; \
151         fi; \
152         echo "Building Lustre RPM with $$RPMARGS"; \
153         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
154
155 srpm-real: @PACKAGE_TARNAME@.spec dist Makefile
156         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
157                 RPMARGS="--without lustre_tests"; \
158         fi; \
159         if [[ "X$(BUILD_LUSTREIOKIT)" = Xfalse ]]; then \
160                 RPMARGS="$$RPMARGS --without lustre_iokit"; \
161         fi; \
162         eval rpmbuild $$RPMARGS -ts $(distdir).tar.gz
163
164 rpms:
165 if BUILD_LUSTREIOKIT
166         $(MAKE) -C @LUSTREIOKIT_SUBDIR@ $(AM_MAKEFLAGS) $@
167 endif
168         $(MAKE) $(AM_MAKEFLAGS) rpms-real
169
170 srpm:
171 if BUILD_LUSTREIOKIT
172         $(MAKE) -C @LUSTREIOKIT_SUBDIR@ $(AM_MAKEFLAGS) $@
173 endif
174         $(MAKE) $(AM_MAKEFLAGS) srpm-real
175
176 # In the debs target, first make sure what's in the changelog reflects
177 # the software version.  Here's how we could dig the version out of the
178 # autoconf version file directly:
179 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
180 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
181 #
182 # However, one cannot really run "make debs" without having done a
183 # configure first, so we could use the easier method of digging the
184 # version out of the config.h file.
185 debs:
186         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
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 -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         m-a build $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
213         popd && \
214         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog); \
215         mkdir -p debs && \
216         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/
217
218 EXTRA_DIST += config.h.in
219
220 if USES_DPKG
221 EXTRA_DIST += debian/*
222 endif
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-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 contrib/scripts/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