Whamcloud - gitweb
LU-4431 lnet: 1/3/2014 update for Cray interconnects
[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 .PHONY: ldiskfs-sources lustre-sources
65
66 ldiskfs-sources:
67 if LDISKFS_ENABLED
68         $(MAKE) sources -C @LDISKFS_SUBDIR@ || exit $$?
69 endif
70
71 lustre-sources:
72         $(MAKE) sources -C lustre || exit $$?
73
74 if LINUX
75 all-am: modules
76
77 modules: ldiskfs-sources lustre-sources module-symvers
78         $(MAKE) CC="$(CC)" $(CROSS_VARS) -C $(LINUX_OBJ)             \
79         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
80         LINUXINCLUDE='-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)' \
81         $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
82         include/config/MARKER $@
83 endif # LINUX
84
85 endif # MODULES
86
87 dist-hook:
88         find $(distdir) -name .deps -o \
89                         -name CVS -o \
90                         -name .svn -o \
91                         -name .git -o \
92                         -name .#* | xargs rm -rf
93         $(MAKE) $(AM_MAKEFLAGS) \
94           top_distdir="$(top_distdir)" distdir="$(distdir)" \
95           module-dist-hook
96
97 EXTRA_DIST = @PACKAGE_TARNAME@.spec     \
98         build/Makefile                  \
99         build/Rules.in                  \
100         build/gen_filelist.sh
101
102 rpms: @PACKAGE_TARNAME@.spec dist Makefile
103         @CONFIGURE_ARGS=""; \
104         for arg in $(ac_configure_args); do \
105                 case $$arg in \
106                         --with-release=* ) ;; \
107                         --with-kmp-moddir=* ) ;; \
108                         --enable-tests | --disable-tests ) ;; \
109                         --with-linux=* | --with-linux-obj=* ) ;; \
110                         * ) CONFIGURE_ARGS="$$CONFIGURE_ARGS '$$arg'" ;; \
111                 esac; \
112         done; \
113         RPMARGS="--define \"configure_args $$CONFIGURE_ARGS\""; \
114         if [ -n "@LINUX@" ]; then  \
115                 RPMARGS="$$RPMARGS --define \"kdir @LINUX@\""; \
116                 if [ -n "@LINUX_OBJ@" -a "@LINUX_OBJ@" != "@LINUX@" ]; then \
117                         RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \
118                 fi; \
119         fi; \
120         if [ -n "@KMP_MODDIR@" ]; then \
121                 RPMARGS="$$RPMARGS --define \"kmoddir @KMP_MODDIR@\""; \
122         fi; \
123         if [ -n "@CROSS_PATH@" ]; then \
124                 if [[ "X$(BUILD_SERVER)" = Xtrue ]]; then \
125                         echo -e "\n" \
126                         "*** Don't support cross compilation for the Intel(R) Xeon Phi(TM) card.\n"; \
127                         exit 1; \
128                 fi; \
129                 CROSS_SUFFIX="-mic"; \
130                 RPMARGS="$$RPMARGS --define \"post_script build/gen_filelist.sh\""; \
131                 RPMARGS="$$RPMARGS --define \"cross_path @CROSS_PATH@\""; \
132                 RPMARGS="$$RPMARGS --define \"rootdir %{cross_path}\""; \
133                 RPMARGS="$$RPMARGS --define \"_prefix %{cross_path}/usr\""; \
134                 RPMARGS="$$RPMARGS --define \"_mandir %{_prefix}/share/man\""; \
135                 RPMARGS="$$RPMARGS --define \"_sysconfdir %{cross_path}/etc\""; \
136                 RPMARGS="$$RPMARGS --define \"make_args @CROSS_VARS@\""; \
137                 if [ "@CC_TARGET_ARCH@" = "x86_64-k1om-linux" ]; then \
138                         RPMARGS="$$RPMARGS --define \"cross_requires intel-mic-gpl\""; \
139                 fi; \
140         fi; \
141         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
142                 RPMARGS="$$RPMARGS --without lustre_tests"; \
143         fi; \
144         if [[ "X$(BUILD_SERVER)" = Xfalse ]]; then \
145                 RPMARGS="$$RPMARGS --without servers"; \
146                 if [ -n "$$CROSS_SUFFIX" ]; then \
147                         RPMARGS="$$RPMARGS --define \"lustre_name lustre-client$$CROSS_SUFFIX\""; \
148                 fi; \
149         fi; \
150         if [[ "X$(BUILD_OSD_LDISKFS)" = Xtrue ]]; then \
151                 RPMARGS="$$RPMARGS --with ldiskfs"; \
152         fi; \
153         if [[ "X$(BUILD_OSD_ZFS)" = Xtrue ]]; then \
154                 RPMARGS="$$RPMARGS --with zfs"; \
155         fi; \
156         if [[ "X$(BUILD_LUSTREIOKIT)" = Xfalse ]]; then \
157                 RPMARGS="$$RPMARGS --without lustre_iokit"; \
158         fi; \
159         echo "Building Lustre RPM with $$RPMARGS"; \
160         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
161
162 srpm: @PACKAGE_TARNAME@.spec dist Makefile
163         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
164                 RPMARGS="--without lustre_tests"; \
165         fi; \
166         if [[ "X$(BUILD_LUSTREIOKIT)" = Xfalse ]]; then \
167                 RPMARGS="$$RPMARGS --without lustre_iokit"; \
168         fi; \
169         eval rpmbuild $$RPMARGS -ts $(distdir).tar.gz
170
171 # In the debs target, first make sure what's in the changelog reflects
172 # the software version.  Here's how we could dig the version out of the
173 # autoconf version file directly:
174 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
175 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
176 #
177 # However, one cannot really run "make debs" without having done a
178 # configure first, so we could use the easier method of digging the
179 # version out of the config.h file.
180 debs:
181         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
182         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
183         if [ "$$lversion" != "$$cversion" ]; then \
184                 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; \
185         fi; \
186         rm -rf debs
187         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
188                 rc=$${PIPESTATUS[0]}; \
189                 [ $${rc} -gt 1 ] && exit $${rc}; \
190                 exit 0; \
191         }
192         export KPKG_DEST_DIR="$$(pwd)/.." && \
193         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
194         rm -rf debian/tmp/modules-deb && \
195         mkdir debian/tmp/modules-deb && \
196         pushd debian/tmp/modules-deb && \
197         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
198         mkdir usr_src/ && \
199         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
200         chmod 755 usr_src/modules/lustre/debian/rules && \
201         mkdir -p usr_share_modass && \
202         ln -s /usr/share/modass/include/ usr_share_modass/ && \
203         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
204         echo "lustre" > usr_share_modass/compliant.list && \
205         export MA_DIR=$$(pwd)/usr_share_modass && \
206         KVERS=$${KVERS:-$(LINUXRELEASE)}; \
207         m-a build $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
208         popd && \
209         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog); \
210         mkdir -p debs && \
211         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/
212
213 EXTRA_DIST += config.h.in
214
215 if USES_DPKG
216 EXTRA_DIST += debian/*
217 endif
218
219 module-symvers-zfs:
220 if ZFS_ENABLED
221         @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
222                 cat @SPL_OBJ@/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
223         elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
224                 cat @SPL_OBJ@/module/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
225         else \
226                 echo -e "\n" \
227                 "*** Missing spl symbols. Ensure you have built spl:\n" \
228                 "*** - @SPL_OBJ@/@SYMVERFILE@\n"; \
229                 exit 1; \
230         fi
231         @if [ -f @ZFS_OBJ@/@ZFS_SYMBOLS@ ]; then \
232                 cat @ZFS_OBJ@/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
233         elif [ -f @ZFS_OBJ@/module/@ZFS_SYMBOLS@ ]; then \
234                 cat @ZFS_OBJ@/module/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
235         else \
236                 echo -e "\n" \
237                 "*** Missing zfs symbols. Ensure you have built zfs:\n" \
238                 "*** - @ZFS_OBJ@/@SYMVERFILE@\n"; \
239                 exit 1; \
240         fi
241 endif # ZFS_ENABLED
242
243 module-symvers: module-symvers-zfs
244
245 CSTK=/tmp/checkstack
246 CSTKO=/tmp/checkstack.orig
247
248 checkstack:
249         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
250         { for MOD in $$(find . -name "*.ko"); do                             \
251                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
252           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
253         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -30 ${CSTK}
254
255 checkstack-update:
256         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
257
258 checkstack-clean:
259         rm -f ${CSTK} ${CSTKO}
260
261 module-dist-hook:
262         if [ -d .git ]; then \
263                 perl lustre/scripts/version_tag.pl --make_META > $(distdir)/META; \
264         elif [ -f META ]; then \
265                 cp META $(distdir)/META; \
266         else \
267                 echo -e "I have no idea how to create a META file in $(distdir).\nPlease file a bug at http://bugzilla.lustre.org/"; \
268                 exit 1; \
269         fi