Whamcloud - gitweb
LU-5710 all: second batch of corrected typos and grammar errors
[fs/lustre-release.git] / autoMakefile.am
1 SUBDIRS := @LDISKFS_SUBDIR@ \
2         . \
3         @SNMP_SUBDIR@ \
4         @LUSTREIOKIT_SUBDIR@ \
5         @LIBCFS_SUBDIR@ \
6         lnet \
7         lustre
8
9 DIST_SUBDIRS := ldiskfs \
10         @SNMP_DIST_SUBDIR@ \
11         lustre-iokit \
12         @LIBCFS_SUBDIR@ \
13         lnet \
14         lustre \
15         config contrib
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 -Iarch/$$(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 .#* -exec 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         rpmbuild @RPMBUILD_BINARY_ARGS@ -ta $(distdir).tar.gz
104
105 srpm: @PACKAGE_TARNAME@.spec dist Makefile
106         rpmbuild @RPMBUILD_SOURCE_ARGS@ -ts $(distdir).tar.gz
107
108 # In the debs target, first make sure what's in the changelog reflects
109 # the software version.  Here's how we could dig the version out of the
110 # autoconf version file directly:
111 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
112 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
113 #
114 # However, one cannot really run "make debs" without having done a
115 # configure first, so we could use the easier method of digging the
116 # version out of the config.h file.
117 debs:
118         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
119         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
120         if [ "$$lversion" != "$$cversion" ]; then \
121                 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; \
122         fi; \
123         rm -rf debs
124         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
125                 rc=$${PIPESTATUS[0]}; \
126                 [ $${rc} -gt 1 ] && exit $${rc}; \
127                 exit 0; \
128         }
129         export KPKG_DEST_DIR="$$(pwd)/.." && \
130         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
131         rm -rf debian/tmp/modules-deb && \
132         mkdir debian/tmp/modules-deb && \
133         pushd debian/tmp/modules-deb && \
134         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
135         mkdir usr_src/ && \
136         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
137         chmod 755 usr_src/modules/lustre/debian/rules && \
138         mkdir -p usr_share_modass && \
139         ln -s /usr/share/modass/include/ usr_share_modass/ && \
140         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
141         echo "lustre" > usr_share_modass/compliant.list && \
142         export MA_DIR=$$(pwd)/usr_share_modass && \
143         KVERS=$${KVERS:-$(LINUXRELEASE)} && \
144         export KSRC_TREE=$(LINUX) && \
145         KSRC=$${KSRC:-$(LINUX_OBJ)} && \
146         m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
147         popd && \
148         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
149         mkdir -p debs && \
150         mv ../linux-patch-lustre_$${VER}_all.deb ../lustre-dev_$${VER}_*.deb \
151            ../lustre-source_$${VER}_all.deb ../lustre-tests_$${VER}_*.deb \
152            ../lustre-utils_$${VER}_*.deb ../lustre_$${VER}.dsc \
153            ../lustre_$${VER}_*.changes ../lustre_$${VER}.tar.gz \
154            ../lustre-client-modules-$${KVERS}_$${VER}_*.deb debs/
155
156 EXTRA_DIST += config.h.in
157
158 if USES_DPKG
159 EXTRA_DIST += debian/*
160 endif
161
162 module-symvers-zfs:
163 if ZFS_ENABLED
164         @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
165                 cat @SPL_OBJ@/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
166         elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
167                 cat @SPL_OBJ@/module/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
168         else \
169                 echo -e "\n" \
170                 "*** Missing spl symbols. Ensure you have built spl:\n" \
171                 "*** - @SPL_OBJ@/@SYMVERFILE@\n"; \
172                 exit 1; \
173         fi
174         @if [ -f @ZFS_OBJ@/@ZFS_SYMBOLS@ ]; then \
175                 cat @ZFS_OBJ@/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
176         elif [ -f @ZFS_OBJ@/module/@ZFS_SYMBOLS@ ]; then \
177                 cat @ZFS_OBJ@/module/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
178         else \
179                 echo -e "\n" \
180                 "*** Missing zfs symbols. Ensure you have built zfs:\n" \
181                 "*** - @ZFS_OBJ@/@SYMVERFILE@\n"; \
182                 exit 1; \
183         fi
184 endif # ZFS_ENABLED
185
186 module-symvers: module-symvers-zfs
187
188 CSTK=/tmp/checkstack
189 CSTKO=/tmp/checkstack.orig
190
191 checkstack:
192         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
193         { for MOD in $$(find . -name "*.ko"); do                             \
194                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
195           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
196         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
197
198 checkstack-update:
199         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
200
201 checkstack-clean:
202         rm -f ${CSTK} ${CSTKO}
203
204 module-dist-hook:
205         @if [ -d .git ]; then \
206                 perl lustre/scripts/version_tag.pl \
207                         --make_META > $(distdir)/META; \
208         elif [ -f META ]; then \
209                 cp META $(distdir)/META; \
210         else \
211                 echo -e "\n" \
212                 "*** I have no idea how to create a META file in $(distdir).\n"\
213                 "*** Please file a bug at https://jira.hpdd.intel.com/\n"; \
214                 exit 1; \
215         fi