Whamcloud - gitweb
LU-1581 ofd: learn osd to be used from lmi
[fs/lustre-release.git] / build / autoMakefile.am.toplevel
1 # -*- Makefile -*-
2 # This file is included by each package's toplevel autoMakefile[.am],
3 # which must define SUBDIRS as a minimum.
4
5 AUTOMAKE_OPTIONS = foreign
6
7 FIND_TAG_FILES_CMD = find $(top_srcdir) \
8                      -path $(top_srcdir)/ldiskfs/ldiskfs/linux-stage -prune -false -o\
9                      -type f -name '*.[hc]'
10
11 MAKEEACHSUBDIR =                                        \
12         for subdir in $(RPM_SUBDIRS) ; do               \
13                 echo "Making $@ in $$subdir" ;          \
14                 cd $$subdir ;                           \
15                 $(MAKE) $(AM_MAKEFLAGS) $@ ;            \
16                 cd - ;                                  \
17                 echo "Finished $@ in $$subdir" ;        \
18         done
19
20 # these empty rules are needed so that automake doesn't add its own
21 # recursive rules
22 etags-recursive:
23
24 ctags-recursive:
25
26 tags-recursive:
27
28 TAGS: etags
29
30 tags: ctags etags
31
32 etags:
33         $(RM) $(top_srcdir)/TAGS
34         ETAGSF=`etags --version | grep -iq exuberant && \
35                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
36         $(FIND_TAG_FILES_CMD) | xargs etags $$ETAGSF -a
37
38 ctags:
39         $(RM) $(top_srcdir)/tags
40         CTAGSF=`ctags --version | grep -iq exuberant && \
41                 echo "-I __initdata,__exitdata,EXPORT_SYMBOL"`; \
42         $(FIND_TAG_FILES_CMD) | xargs ctags $$CTAGSF -a
43
44 cscope-recursive:
45
46 cscope:
47         $(RM) $(top_srcdir)/cscope*.out $(top_srcdir)/cscope.files
48         $(FIND_TAG_FILES_CMD) > cscope.files
49         cscope -bRq
50
51 mkid:
52         $(FIND_TAG_FILES_CMD) | xargs mkid
53
54
55 doxygen:  doxygen-api doxygen-ref
56
57 doxygen-%: build/doxyfile.%
58            doxygen $<
59
60 if MODULES
61 sources: all-sources
62
63 all-sources: $(MODULE_SYMVERS_DEPS)
64         for dir in $(SOURCES_SUBDIRS) ; do \
65                 $(MAKE) sources -C $$dir || exit $$? ; \
66         done
67
68 if LINUX
69 all-am: modules
70
71 if !LINUX25
72 DEP = dep
73 dep: .depend
74
75 .depend: all-sources
76         $(MAKE) $(ARCH_UM) CC="$(CC)" -C $(LINUX_OBJ)                \
77         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
78         -o scripts -o include/config/MARKER _sfdep_$(PWD)            \
79         _FASTDEP_ALL_SUB_DIRS="$(PWD)"
80
81 CLEANFILES = .depend
82 endif # !LINUX25
83
84 modules: $(DEP) all-sources
85         $(MAKE) $(ARCH_UM) 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 -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -include include/$(AUTOCONF_HDIR)/autoconf.h' \
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 build/autoMakefile.am.toplevel build/lbuild*     \
108         build/Rules.in                                                  \
109         build/update_oldconfig                                          \
110         build/autoconf/lustre-build-linux.m4                            \
111         build/autoconf/lustre-build-darwin.m4                           \
112         build/autoconf/lustre-build-ldiskfs.m4                          \
113         build/autoconf/lustre-build.m4 build/rdac_spec                  \
114         build/mptlinux.spec.patch build/patches                         \
115         build/funcs.sh build/find_linux_rpms build/exit_traps.sh
116
117 rpms-real: @PACKAGE_TARNAME@.spec dist Makefile
118         CONFIGURE_ARGS=$$(echo $$(eval echo $(ac_configure_args)) | \
119                 sed -re 's/--(en|dis)able-tests//'); \
120         if [ -n "@LINUX@" ]; then \
121                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
122                         sed -re 's/--with-linux=[^ ][^ ]*//'); \
123                 RPMARGS="--define \"kdir @LINUX@\""; \
124                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
125                         sed -re 's/--with-linux-obj=[^ ][^ ]*//'); \
126                 if [ -n "@LINUX_OBJ@" -a "@LINUX_OBJ@" != "@LINUX@" ]; then \
127                         RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \
128                 fi; \
129         fi; \
130         CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
131                 sed -re 's/--with-release=[^ ][^ ]*//'); \
132         RPMARGS="$$RPMARGS --define \"configure_args $$CONFIGURE_ARGS\""; \
133         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
134                 RPMARGS="$$RPMARGS --define \"build_lustre_tests 0\""; \
135         fi; \
136         if [[ "X$(BUILD_SERVER)" = Xfalse ]]; then \
137                 RPMARGS="$$RPMARGS --define \"lustre_name lustre-client\""; \
138         fi; \
139         echo "Building Lustre RPM with $$RPMARGS"; \
140         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
141
142 srpm-real: @PACKAGE_TARNAME@.spec dist Makefile
143         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
144                 RPMARGS="--define \"build_lustre_tests 0\""; \
145         fi; \
146         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
147
148 rpms:
149         @$(MAKEEACHSUBDIR)
150         $(MAKE) $(AM_MAKEFLAGS) rpms-real
151
152 srpm:
153         @$(MAKEEACHSUBDIR)
154         $(MAKE) $(AM_MAKEFLAGS) srpm-real
155
156 # In the debs target, first make sure what's in the changelog reflects
157 # the software version.  Here's how we could dig the version out of the
158 # autoconf version file directly:
159 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
160 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
161 #
162 # However, one cannot really run "make debs" without having done a
163 # configure first, so we could use the easier method of digging the
164 # version out of the config.h file.
165 debs:
166         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
167         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
168         if [ "$$lversion" != "$$cversion" ]; then \
169                 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; \
170         fi; \
171         rm -rf debs
172         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
173                 rc=$${PIPESTATUS[0]}; \
174                 [ $${rc} -gt 1 ] && exit $${rc}; \
175                 exit 0; \
176         }
177         export KPKG_DEST_DIR="$$(pwd)/.." && \
178         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
179         rm -rf debian/tmp/modules-deb && \
180         mkdir debian/tmp/modules-deb && \
181         pushd debian/tmp/modules-deb && \
182         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
183         mkdir usr_src/ && \
184         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
185         chmod 755 usr_src/modules/lustre/debian/rules && \
186         mkdir -p usr_share_modass && \
187         ln -s /usr/share/modass/include/ usr_share_modass/ && \
188         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
189         echo "lustre" > usr_share_modass/compliant.list && \
190         export MA_DIR=$$(pwd)/usr_share_modass && \
191         KVERS=$${KVERS:-$(LINUXRELEASE)}; \
192         m-a build $${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 ../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/