Whamcloud - gitweb
LU-4955 lfsck: reset param when the LFSCK is reset
[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 AUTOMAKE_OPTIONS = foreign
5
6 FIND_TAG_FILES_CMD = find $(top_srcdir) \
7                      -path $(top_srcdir)/ldiskfs/linux-stage \
8                      -prune -false -o -type f -name '*.[hc]'
9
10 # these empty rules are needed so that automake doesn't add its own
11 # recursive rules
12 etags-recursive:
13
14 ctags-recursive:
15
16 tags-recursive:
17
18 TAGS: etags
19
20 tags: ctags etags
21
22 etags:
23         $(RM) $(top_srcdir)/TAGS
24         ETAGSF=`etags --version | grep -iq exuberant && \
25                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
26         $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
27
28 ctags:
29         $(RM) $(top_srcdir)/tags
30         CTAGSF=`ctags --version | grep -iq exuberant && \
31                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
32         $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
33
34 cscope-recursive:
35
36 cscope:
37         $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
38         $(FIND_TAG_FILES_CMD) > cscope.files
39         cscope -bRq
40
41 mkid:
42         $(FIND_TAG_FILES_CMD) | xargs mkid
43
44
45 doxygen:  doxygen-api doxygen-ref
46
47 doxygen-%: build/doxyfile.%
48         doxygen $<
49
50 if MODULES
51 .PHONY: ldiskfs-sources lustre-sources
52
53 ldiskfs-sources:
54 if LDISKFS_ENABLED
55         $(MAKE) sources -C @LDISKFS_SUBDIR@ || exit $$?
56 endif
57
58 lustre-sources:
59         $(MAKE) sources -C lustre || exit $$?
60
61 if LINUX
62 all-am: modules
63
64 modules: ldiskfs-sources lustre-sources module-symvers
65         $(MAKE) CC="$(CC)" $(CROSS_VARS) -C $(LINUX_OBJ)             \
66         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
67         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)' \
68         $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
69         include/config/MARKER $@
70 endif # LINUX
71
72 endif # MODULES
73
74 dist-hook:
75         find $(distdir) -name .deps -o \
76                         -name CVS -o \
77                         -name .svn -o \
78                         -name .git -o \
79                         -name .#* | xargs rm -rf
80         $(MAKE) $(AM_MAKEFLAGS) \
81           top_distdir="$(top_distdir)" distdir="$(distdir)" \
82           module-dist-hook
83
84 EXTRA_DIST = @PACKAGE_TARNAME@.spec     \
85         build/Makefile                  \
86         build/Rules.in                  \
87         build/gen_filelist.sh
88
89 rpms: @PACKAGE_TARNAME@.spec dist Makefile
90         rpmbuild @RPMBUILD_BINARY_ARGS@ -ta $(distdir).tar.gz
91
92 srpm: @PACKAGE_TARNAME@.spec dist Makefile
93         rpmbuild @RPMBUILD_SOURCE_ARGS@ -ts $(distdir).tar.gz
94
95 # In the debs target, first make sure what's in the changelog reflects
96 # the software version.  Here's how we could dig the version out of the
97 # autoconf version file directly:
98 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
99 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
100 #
101 # However, one cannot really run "make debs" without having done a
102 # configure first, so we could use the easier method of digging the
103 # version out of the config.h file.
104 debs:
105         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
106         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
107         if [ "$$lversion" != "$$cversion" ]; then \
108                 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; \
109         fi; \
110         rm -rf debs
111         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
112                 rc=$${PIPESTATUS[0]}; \
113                 [ $${rc} -gt 1 ] && exit $${rc}; \
114                 exit 0; \
115         }
116         export KPKG_DEST_DIR="$$(pwd)/.." && \
117         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
118         rm -rf debian/tmp/modules-deb && \
119         mkdir debian/tmp/modules-deb && \
120         pushd debian/tmp/modules-deb && \
121         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
122         mkdir usr_src/ && \
123         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
124         chmod 755 usr_src/modules/lustre/debian/rules && \
125         mkdir -p usr_share_modass && \
126         ln -s /usr/share/modass/include/ usr_share_modass/ && \
127         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
128         echo "lustre" > usr_share_modass/compliant.list && \
129         export MA_DIR=$$(pwd)/usr_share_modass && \
130         KVERS=$${KVERS:-$(LINUXRELEASE)}; \
131         m-a build $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
132         popd && \
133         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog); \
134         mkdir -p debs && \
135         mv ../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/
136
137 EXTRA_DIST += config.h.in
138
139 if USES_DPKG
140 EXTRA_DIST += debian/*
141 endif
142
143 module-symvers-zfs:
144 if ZFS_ENABLED
145         @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
146                 cat @SPL_OBJ@/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
147         elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
148                 cat @SPL_OBJ@/module/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
149         else \
150                 echo -e "\n" \
151                 "*** Missing spl symbols. Ensure you have built spl:\n" \
152                 "*** - @SPL_OBJ@/@SYMVERFILE@\n"; \
153                 exit 1; \
154         fi
155         @if [ -f @ZFS_OBJ@/@ZFS_SYMBOLS@ ]; then \
156                 cat @ZFS_OBJ@/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
157         elif [ -f @ZFS_OBJ@/module/@ZFS_SYMBOLS@ ]; then \
158                 cat @ZFS_OBJ@/module/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
159         else \
160                 echo -e "\n" \
161                 "*** Missing zfs symbols. Ensure you have built zfs:\n" \
162                 "*** - @ZFS_OBJ@/@SYMVERFILE@\n"; \
163                 exit 1; \
164         fi
165 endif # ZFS_ENABLED
166
167 module-symvers: module-symvers-zfs
168
169 CSTK=/tmp/checkstack
170 CSTKO=/tmp/checkstack.orig
171
172 checkstack:
173         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
174         { for MOD in $$(find . -name "*.ko"); do                             \
175                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
176           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
177         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -30 ${CSTK}
178
179 checkstack-update:
180         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
181
182 checkstack-clean:
183         rm -f ${CSTK} ${CSTKO}
184
185 module-dist-hook:
186         if [ -d .git ]; then \
187                 perl lustre/scripts/version_tag.pl --make_META > $(distdir)/META; \
188         elif [ -f META ]; then \
189                 cp META $(distdir)/META; \
190         else \
191                 echo -e "I have no idea how to create a META file in $(distdir).\nPlease file a bug at http://bugzilla.lustre.org/"; \
192                 exit 1; \
193         fi