Whamcloud - gitweb
New tag 2.7.61
[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: undef.h ldiskfs-sources lustre-sources
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 undef.h: config.h.in
88         grep -v config.h.in config.h.in > $@
89
90 dist-hook: undef.h
91         find $(distdir) -name .deps -o \
92                         -name CVS -o \
93                         -name .svn -o \
94                         -name .git -o \
95                         -name .#* -exec rm -rf {} \;
96         $(MAKE) $(AM_MAKEFLAGS) \
97                 top_distdir="$(top_distdir)" distdir="$(distdir)" \
98                 module-dist-hook
99
100 EXTRA_DIST = @PACKAGE_TARNAME@.spec     \
101         build/Makefile                  \
102         build/Rules.in                  \
103         build/gen_filelist.sh           \
104         config.h.in                     \
105         undef.h
106
107 rpm-local:
108         @(if test -z "$(RPMBUILD)"; then \
109                 echo -e "\n" \
110         "*** Required util 'rpmbuild' missing. Please install the\n" \
111         "*** package for your distribution which provides 'rpmbuild',\n" \
112         "*** re-run configure, and try again.\n"; \
113                 exit 1; \
114         fi; \
115         $(MKDIR_P) $(rpmbuilddir)/TMP   && \
116         $(MKDIR_P) $(rpmbuilddir)/BUILD && \
117         $(MKDIR_P) $(rpmbuilddir)/RPMS  && \
118         $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
119         $(MKDIR_P) $(rpmbuilddir)/SPECS && \
120         $(MKDIR_P) $(rpmbuilddir)/SOURCES)
121
122 rpms: srpm
123         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
124         $(MAKE) $(AM_MAKEFLAGS) \
125                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
126         $(RPMBUILD) \
127                 --define "_tmppath $$rpmbuilddir/TMP" \
128                 --define "_topdir $$rpmbuilddir" \
129                 @RPMBUILD_BINARY_ARGS@ \
130                 --rebuild $(distdir)-*.src.rpm || exit 1; \
131         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
132         rm -rf $$rpmbuilddir
133
134 srpm: @PACKAGE_TARNAME@.spec dist Makefile
135         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
136         $(MAKE) $(AM_MAKEFLAGS) \
137                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
138         $(RPMBUILD) \
139                 --define "_tmppath $$rpmbuilddir/TMP" \
140                 --define "_topdir $$rpmbuilddir" \
141                 --define "build_src_rpm 1" \
142                 --define "dist %{nil}" \
143                 -ts $(distdir).tar.gz || exit 1; \
144         cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
145         rm -rf $$rpmbuilddir
146
147 # In the debs target, first make sure what's in the changelog reflects
148 # the software version.  Here's how we could dig the version out of the
149 # autoconf version file directly:
150 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
151 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
152 #
153 # However, one cannot really run "make debs" without having done a
154 # configure first, so we could use the easier method of digging the
155 # version out of the config.h file.
156 debs: undef.h
157         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
158         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
159         if [ "$$lversion" != "$$cversion" ]; then \
160                 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; \
161         fi; \
162         rm -rf debs
163         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
164                 rc=$${PIPESTATUS[0]}; \
165                 [ $${rc} -gt 1 ] && exit $${rc}; \
166                 exit 0; \
167         }
168         export KPKG_DEST_DIR="$$(pwd)/.." && \
169         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
170         rm -rf debian/tmp/modules-deb && \
171         mkdir debian/tmp/modules-deb && \
172         pushd debian/tmp/modules-deb && \
173         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
174         mkdir usr_src/ && \
175         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
176         chmod 755 usr_src/modules/lustre/debian/rules && \
177         mkdir -p usr_share_modass && \
178         ln -s /usr/share/modass/include/ usr_share_modass/ && \
179         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
180         echo "lustre" > usr_share_modass/compliant.list && \
181         export MA_DIR=$$(pwd)/usr_share_modass && \
182         KVERS=$${KVERS:-$(LINUXRELEASE)} && \
183         if test "x@ENABLEO2IB@" = "xno"; then \
184                 export IB_OPTIONS="--with-o2ib=no"; \
185         else \
186                 if test -n "@O2IBPATH@"; then \
187                         export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
188                 fi; \
189         fi; \
190         export KSRC_TREE=$(LINUX) && \
191         KSRC=$${KSRC:-$(LINUX_OBJ)} && \
192         m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
193         popd && \
194         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
195         mkdir -p debs && \
196         mv ../linux-patch-lustre_$${VER}_all.deb ../lustre-dev_$${VER}_*.deb \
197            ../lustre-source_$${VER}_all.deb ../lustre-tests_$${VER}_*.deb \
198            ../lustre-utils_$${VER}_*.deb ../lustre_$${VER}.dsc \
199            ../lustre_$${VER}_*.changes ../lustre_$${VER}.tar.gz \
200            ../lustre-client-modules-$${KVERS}_$${VER}_*.deb debs/
201
202 if USES_DPKG
203 EXTRA_DIST += debian/*
204 endif
205
206 CSTK=/tmp/checkstack
207 CSTKO=/tmp/checkstack.orig
208
209 checkstack:
210         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
211         { for MOD in $$(find . -name "*.ko"); do                             \
212                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
213           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
214         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
215
216 checkstack-update:
217         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
218
219 checkstack-clean:
220         rm -f ${CSTK} ${CSTKO}
221
222 module-dist-hook:
223         @if [ -d .git ]; then \
224                 perl lustre/scripts/version_tag.pl \
225                         --make_META > $(distdir)/META; \
226         elif [ -f META ]; then \
227                 cp META $(distdir)/META; \
228         else \
229                 echo -e "\n" \
230                 "*** I have no idea how to create a META file in $(distdir).\n"\
231                 "*** Please file a bug at https://jira.hpdd.intel.com/\n"; \
232                 exit 1; \
233         fi