Whamcloud - gitweb
New tag 2.3.59
[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 \
9                      -prune -false -o -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 modules: $(DEP) all-sources
72         $(MAKE) $(ARCH_UM) CC="$(CC)" -C $(LINUX_OBJ)                \
73         -f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
74         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)' \
75         $(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
76         include/config/MARKER $@
77 endif # LINUX
78
79 endif # MODULES
80
81 dist-hook:
82         $(RM) $(distdir)/ldiskfs/*.spec
83         $(RM) $(distdir)/lustre-iokit/*.spec
84         find $(distdir) -name .deps -o \
85                         -name CVS -o \
86                         -name .svn -o \
87                         -name .git -o \
88                         -name .#* | xargs rm -rf
89         $(MAKE) $(AM_MAKEFLAGS) \
90           top_distdir="$(top_distdir)" distdir="$(distdir)" \
91           module-dist-hook
92
93 EXTRA_DIST = @PACKAGE_TARNAME@.spec                                     \
94         build/Makefile build/autoMakefile.am.toplevel build/lbuild*     \
95         build/Rules.in                                                  \
96         build/update_oldconfig                                          \
97         build/autoconf/lustre-build-linux.m4                            \
98         build/autoconf/lustre-build-darwin.m4                           \
99         build/autoconf/lustre-build-ldiskfs.m4                          \
100         build/autoconf/lustre-build.m4 build/rdac_spec                  \
101         build/mptlinux.spec.patch build/patches                         \
102         build/funcs.sh build/find_linux_rpms build/exit_traps.sh
103
104 rpms-real: @PACKAGE_TARNAME@.spec dist Makefile
105         CONFIGURE_ARGS=$$(echo $$(eval echo $(ac_configure_args)) | \
106                 sed -re 's/--(en|dis)able-tests//'); \
107         if [ -n "@LINUX@" ]; then \
108                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
109                         sed -re 's/--with-linux=[^ ][^ ]*//'); \
110                 RPMARGS="--define \"kdir @LINUX@\""; \
111                 CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
112                         sed -re 's/--with-linux-obj=[^ ][^ ]*//'); \
113                 if [ -n "@LINUX_OBJ@" -a "@LINUX_OBJ@" != "@LINUX@" ]; then \
114                         RPMARGS="$$RPMARGS --define \"kobjdir @LINUX_OBJ@\""; \
115                 fi; \
116         fi; \
117         CONFIGURE_ARGS=$$(echo $$(eval echo $$CONFIGURE_ARGS) | \
118                 sed -re 's/--with-release=[^ ][^ ]*//'); \
119         RPMARGS="$$RPMARGS --define \"configure_args $$CONFIGURE_ARGS\""; \
120         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
121                 RPMARGS="$$RPMARGS --define \"build_lustre_tests 0\""; \
122         fi; \
123         if [[ "X$(BUILD_SERVER)" = Xfalse ]]; then \
124                 RPMARGS="$$RPMARGS --define \"lustre_name lustre-client\""; \
125         fi; \
126         echo "Building Lustre RPM with $$RPMARGS"; \
127         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
128
129 srpm-real: @PACKAGE_TARNAME@.spec dist Makefile
130         if [[ "X$(BUILD_TESTS)" = Xfalse ]]; then \
131                 RPMARGS="--define \"build_lustre_tests 0\""; \
132         fi; \
133         eval rpmbuild $$RPMARGS -ta $(distdir).tar.gz
134
135 rpms:
136         @$(MAKEEACHSUBDIR)
137         $(MAKE) $(AM_MAKEFLAGS) rpms-real
138
139 srpm:
140         @$(MAKEEACHSUBDIR)
141         $(MAKE) $(AM_MAKEFLAGS) srpm-real
142
143 # In the debs target, first make sure what's in the changelog reflects
144 # the software version.  Here's how we could dig the version out of the
145 # autoconf version file directly:
146 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
147 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
148 #
149 # However, one cannot really run "make debs" without having done a
150 # configure first, so we could use the easier method of digging the
151 # version out of the config.h file.
152 debs:
153         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
154         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
155         if [ "$$lversion" != "$$cversion" ]; then \
156                 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; \
157         fi; \
158         rm -rf debs
159         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
160                 rc=$${PIPESTATUS[0]}; \
161                 [ $${rc} -gt 1 ] && exit $${rc}; \
162                 exit 0; \
163         }
164         export KPKG_DEST_DIR="$$(pwd)/.." && \
165         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
166         rm -rf debian/tmp/modules-deb && \
167         mkdir debian/tmp/modules-deb && \
168         pushd debian/tmp/modules-deb && \
169         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
170         mkdir usr_src/ && \
171         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
172         chmod 755 usr_src/modules/lustre/debian/rules && \
173         mkdir -p usr_share_modass && \
174         ln -s /usr/share/modass/include/ usr_share_modass/ && \
175         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
176         echo "lustre" > usr_share_modass/compliant.list && \
177         export MA_DIR=$$(pwd)/usr_share_modass && \
178         KVERS=$${KVERS:-$(LINUXRELEASE)}; \
179         m-a build $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
180         popd && \
181         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog); \
182         mkdir -p debs && \
183         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/