Whamcloud - gitweb
LU-2384 kerberos: Support for MIT-kerberos >=1.8.X is broken
[fs/lustre-release.git] / autoMakefile.am
1 SUBDIRS := @LDISKFS_SUBDIR@ @SPL_SUBDIR@ @ZFS_SUBDIR@ . @LIBSYSIO_SUBDIR@ @SNMP_SUBDIR@ @LUSTREIOKIT_SUBDIR@ @LIBCFS_SUBDIR@ lnet lustre
2 DIST_SUBDIRS := @LDISKFS_DIST_SUBDIR@ @SNMP_DIST_SUBDIR@ libsysio lustre-iokit @LIBCFS_SUBDIR@ lnet lustre config contrib
3 SOURCES_SUBDIRS := @LIBCFS_SUBDIR@ lnet lustre
4 RPM_SUBDIRS := @LDISKFS_SUBDIR@ @LUSTREIOKIT_SUBDIR@
5 MODULE_SYMVERS_DEPS = module-symvers
6
7 @TESTS_TRUE@BUILD_TESTS = true
8 @TESTS_FALSE@BUILD_TESTS = false
9 @SERVER_TRUE@BUILD_SERVER = true
10 @SERVER_FALSE@BUILD_SERVER = false
11 @CLIENT_TRUE@BUILD_CLIENT = true
12 @CLIENT_FALSE@BUILD_CLIENT = false
13 @LDISKFS_ENABLED_TRUE@BUILD_OSD_LDISKFS = true
14 @LDISKFS_ENABLED_FALSE@BUILD_OSD_LDISKFS = false
15 @ZFS_ENABLED_TRUE@BUILD_OSD_ZFS = true
16 @ZFS_ENABLED_FALSE@BUILD_OSD_ZFS = false
17
18 AUTOMAKE_OPTIONS = foreign
19
20 FIND_TAG_FILES_CMD = find $(top_srcdir) \
21                      -path $(top_srcdir)/ldiskfs/ldiskfs/linux-stage \
22                      -prune -false -o -type f -name '*.[hc]'
23
24 MAKEEACHSUBDIR =                                        \
25         for subdir in $(RPM_SUBDIRS) ; do               \
26                 echo "Making $@ in $$subdir" ;          \
27                 cd $$subdir ;                           \
28                 $(MAKE) $(AM_MAKEFLAGS) $@ ;            \
29                 cd - ;                                  \
30                 echo "Finished $@ in $$subdir" ;        \
31         done
32
33 # these empty rules are needed so that automake doesn't add its own
34 # recursive rules
35 etags-recursive:
36
37 ctags-recursive:
38
39 tags-recursive:
40
41 TAGS: etags
42
43 tags: ctags etags
44
45 etags:
46         $(RM) $(top_srcdir)/TAGS
47         ETAGSF=`etags --version | grep -iq exuberant && \
48                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
49         $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
50
51 ctags:
52         $(RM) $(top_srcdir)/tags
53         CTAGSF=`ctags --version | grep -iq exuberant && \
54                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
55         $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
56
57 cscope-recursive:
58
59 cscope:
60         $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
61         $(FIND_TAG_FILES_CMD) > cscope.files
62         cscope -bRq
63
64 mkid:
65         $(FIND_TAG_FILES_CMD) | xargs mkid
66
67
68 doxygen:  doxygen-api doxygen-ref
69
70 doxygen-%: build/doxyfile.%
71            doxygen $<
72
73 if MODULES
74 sources: all-sources
75
76 all-sources: $(MODULE_SYMVERS_DEPS)
77         for dir in $(SOURCES_SUBDIRS) ; do \
78                 $(MAKE) sources -C $$dir || exit $$? ; \
79         done
80
81 if LINUX
82 all-am: modules
83
84 modules: $(DEP) all-sources
85         $(MAKE) CC="$(CC)" -C $(LINUX_OBJ)                           \
86         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
87         LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -include $(CONFIG_INCLUDE)' \
88         $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
89         include/config/MARKER $@
90 endif # LINUX
91
92 endif # MODULES
93
94 dist-hook:
95         $(RM) $(distdir)/ldiskfs/*.spec
96         $(RM) $(distdir)/lustre-iokit/*.spec
97         find $(distdir) -name .deps -o \
98                         -name CVS -o \
99                         -name .svn -o \
100                         -name .git -o \
101                         -name .#* | xargs rm -rf
102         $(MAKE) $(AM_MAKEFLAGS) \
103           top_distdir="$(top_distdir)" distdir="$(distdir)" \
104           module-dist-hook
105
106 EXTRA_DIST = @PACKAGE_TARNAME@.spec                                     \
107         build/Makefile                                                  \
108         build/Rules.in
109
110 rpms-real: @PACKAGE_TARNAME@.spec dist Makefile
111         CONFIGURE_ARGS=$$(echo $$(eval echo $(ac_configure_args)) | \
112                 sed -re 's/--(en|dis)able-tests//'); \
113         if [ -n "@LINUX@" ]; then \
114                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
115                         sed -re 's/--with-linux=[^ ][^ ]*//'); \
116                 RPMARGS="--define \"kdir @LINUX@\""; \
117                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
118                         sed -re 's/--with-linux-obj=[^ ][^ ]*//'); \
119                 if [ -n "@LINUX_OBJ@" -a "@LINUX_OBJ@" != "@LINUX@" ]; then \
120                         RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \
121                 fi; \
122         fi; \
123         CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
124                 sed -re 's/--with-release=[^ ][^ ]*//'); \
125         RPMARGS="$$RPMARGS --define \"configure_args $$CONFIGURE_ARGS\""; \
126         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
127                 RPMARGS="$$RPMARGS --define \"build_lustre_tests 0\""; \
128         fi; \
129         if [[ "X$(BUILD_SERVER)" = Xfalse ]]; then \
130                 RPMARGS="$$RPMARGS --define \"lustre_name lustre-client\""; \
131         fi; \
132         if [[ "X$(BUILD_OSD_LDISKFS)" = Xtrue ]]; then \
133                 RPMARGS="$$RPMARGS --define \"build_lustre_osd_ldiskfs 1\""; \
134         fi; \
135         if [[ "X$(BUILD_OSD_ZFS)" = Xtrue ]]; then \
136                 RPMARGS="$$RPMARGS --define \"build_lustre_osd_zfs 1\""; \
137         fi; \
138         echo "Building Lustre RPM with $$RPMARGS"; \
139         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
140
141 srpm-real: @PACKAGE_TARNAME@.spec dist Makefile
142         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
143                 RPMARGS="--define \"build_lustre_tests 0\""; \
144         fi; \
145         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
146
147 rpms:
148         @$(MAKEEACHSUBDIR)
149         $(MAKE) $(AM_MAKEFLAGS) rpms-real
150
151 srpm:
152         @$(MAKEEACHSUBDIR)
153         $(MAKE) $(AM_MAKEFLAGS) srpm-real
154
155 # In the debs target, first make sure what's in the changelog reflects
156 # the software version.  Here's how we could dig the version out of the
157 # autoconf version file directly:
158 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
159 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
160 #
161 # However, one cannot really run "make debs" without having done a
162 # configure first, so we could use the easier method of digging the
163 # version out of the config.h file.
164 debs:
165         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
166         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
167         if [ "$$lversion" != "$$cversion" ]; then \
168                 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; \
169         fi; \
170         rm -rf debs
171         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
172                 rc=$${PIPESTATUS[0]}; \
173                 [ $${rc} -gt 1 ] && exit $${rc}; \
174                 exit 0; \
175         }
176         export KPKG_DEST_DIR="$$(pwd)/.." && \
177         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
178         rm -rf debian/tmp/modules-deb && \
179         mkdir debian/tmp/modules-deb && \
180         pushd debian/tmp/modules-deb && \
181         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
182         mkdir usr_src/ && \
183         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
184         chmod 755 usr_src/modules/lustre/debian/rules && \
185         mkdir -p usr_share_modass && \
186         ln -s /usr/share/modass/include/ usr_share_modass/ && \
187         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
188         echo "lustre" > usr_share_modass/compliant.list && \
189         export MA_DIR=$$(pwd)/usr_share_modass && \
190         KVERS=$${KVERS:-$(LINUXRELEASE)}; \
191         m-a build $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
192         popd && \
193         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog); \
194         mkdir -p debs && \
195         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/
196
197 EXTRA_DIST += config.h.in
198
199 if USES_DPKG
200 EXTRA_DIST += debian/*
201 endif
202
203 module-symvers-ldiskfs:
204 if LDISKFS_ENABLED
205         @if [ -f @LDISKFS_DIR@/@SYMVERFILE@ ]; then \
206                 cat @LDISKFS_DIR@/@SYMVERFILE@ >>@SYMVERFILE@; \
207         elif [ -f @LDISKFS_DIR@/ldiskfs/@SYMVERFILE@ ]; then \
208                 cat @LDISKFS_DIR@/ldiskfs/@SYMVERFILE@ >>@SYMVERFILE@; \
209         else \
210                 echo -e "\n" \
211                 "*** Missing ldiskfs symbols. Ensure you have built ldiskfs:\n"\
212                 "*** - @LDISKFS_OBJ@/ldiskfs/@SYMVERFILE@\n"; \
213                 exit 1; \
214         fi
215 endif # LDISKFS_ENABLED
216
217 module-symvers-zfs:
218 if ZFS_ENABLED
219         @if [ -f @SPL_OBJ@/@SPL_SYMBOLS@ ]; then \
220                 cat @SPL_OBJ@/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
221         elif [ -f @SPL_OBJ@/module/@SPL_SYMBOLS@ ]; then \
222                 cat @SPL_OBJ@/module/@SPL_SYMBOLS@ >>@SYMVERFILE@; \
223         else \
224                 echo -e "\n" \
225                 "*** Missing spl symbols. Ensure you have built spl:\n" \
226                 "*** - @SPL_OBJ@/@SYMVERFILE@\n"; \
227                 exit 1; \
228         fi
229         @if [ -f @ZFS_OBJ@/@ZFS_SYMBOLS@ ]; then \
230                 cat @ZFS_OBJ@/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
231         elif [ -f @ZFS_OBJ@/module/@ZFS_SYMBOLS@ ]; then \
232                 cat @ZFS_OBJ@/module/@ZFS_SYMBOLS@ >>@SYMVERFILE@; \
233         else \
234                 echo -e "\n" \
235                 "*** Missing zfs symbols. Ensure you have built zfs:\n" \
236                 "*** - @ZFS_OBJ@/@SYMVERFILE@\n"; \
237                 exit 1; \
238         fi
239 endif # ZFS_ENABLED
240
241 module-symvers: module-symvers-ldiskfs module-symvers-zfs
242
243 CSTK=/tmp/checkstack
244 CSTKO=/tmp/checkstack.orig
245
246 checkstack:
247         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
248         { for MOD in $$(find . -name "*.ko"); do                             \
249                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
250           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
251         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -30 ${CSTK}
252
253 checkstack-update:
254         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
255
256 checkstack-clean:
257         rm -f ${CSTK} ${CSTKO}
258
259 module-dist-hook:
260         if [ -d CVS -o -d .git ]; then \
261                 perl lustre/scripts/make_META.pl > $(distdir)/META; \
262         elif [ -f META ]; then \
263                 cp META $(distdir)/META; \
264         else \
265                 echo -e "I have no idea how to create a META file in $(distdir).\nPlease file a bug at http://bugzilla.lustre.org/"; \
266                 exit 1; \
267         fi
268 if LDISKFS_ENABLED
269         if [ -f $(distdir)/META -a -d $(distdir)/ldiskfs ]; then \
270                 cp $(distdir)/META $(distdir)/ldiskfs/META; \
271         fi
272 endif