Whamcloud - gitweb
LU-6020 gss: add lsvcgssd init.d wrapper
[fs/lustre-release.git] / autoMakefile.am
1 SUBDIRS := @LDISKFS_SUBDIR@ \
2         . \
3         @LUSTREIOKIT_SUBDIR@ \
4         @LIBCFS_SUBDIR@ \
5         @SNMP_SUBDIR@ \
6         lnet \
7         lustre
8
9 DIST_SUBDIRS := ldiskfs \
10         lustre-iokit \
11         @LIBCFS_SUBDIR@ \
12         @SNMP_DIST_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         lustre-dkms_pre-build.sh        \
107         lustre-dkms_post-build.sh
108
109 rpm-local:
110         @(if test -z "$(RPMBUILD)"; then \
111                 echo -e "\n" \
112         "*** Required util 'rpmbuild' missing. Please install the\n" \
113         "*** package for your distribution which provides 'rpmbuild',\n" \
114         "*** re-run configure, and try again.\n"; \
115                 exit 1; \
116         fi; \
117         $(MKDIR_P) $(rpmbuilddir)/TMP   && \
118         $(MKDIR_P) $(rpmbuilddir)/BUILD && \
119         $(MKDIR_P) $(rpmbuilddir)/RPMS  && \
120         $(MKDIR_P) $(rpmbuilddir)/SRPMS && \
121         $(MKDIR_P) $(rpmbuilddir)/SPECS && \
122         $(MKDIR_P) $(rpmbuilddir)/SOURCES)
123
124 if SERVER
125 DKMS_PACKAGE=$(PACKAGE)
126 DKMS_SERVER=--with servers
127 else
128 DKMS_PACKAGE=$(PACKAGE)-client
129 DKMS_SERVER=--without servers
130 endif
131
132 # Only zfs Lustre DKMS Server is supported, so previous configure command
133 # must use related parameters for success.
134 dkms-srpm: $(PACKAGE)-dkms.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 "_sourcedir $(top_srcdir)" \
142                 $(DKMS_SERVER) \
143                 --bs $(PACKAGE)-dkms.spec || exit 1; \
144         cp $$rpmbuilddir/SRPMS/*.src.rpm $(top_srcdir) || exit 1; \
145         rm -rf $$rpmbuilddir
146
147 dkms-rpm: dkms-srpm
148         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
149         $(RPMBUILD) \
150                 --define "_tmppath $$rpmbuilddir/TMP" \
151                 --define "_topdir $$rpmbuilddir" \
152                 @RPMBUILD_BINARY_ARGS@ \
153                 --rebuild $(DKMS_PACKAGE)-dkms-*.src.rpm || exit 1; \
154         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
155         rm -rf $$rpmbuilddir
156
157 rpms: srpm
158         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
159         $(MAKE) $(AM_MAKEFLAGS) \
160                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
161         $(RPMBUILD) \
162                 --define "_tmppath $$rpmbuilddir/TMP" \
163                 --define "_topdir $$rpmbuilddir" \
164                 @RPMBUILD_BINARY_ARGS@ \
165                 --rebuild $(distdir)-*.src.rpm || exit 1; \
166         cp $$rpmbuilddir/RPMS/*/*.rpm $(top_srcdir) || exit 1; \
167         rm -rf $$rpmbuilddir
168
169 srpm: @PACKAGE_TARNAME@.spec dist Makefile
170         rpmbuilddir=`mktemp -t -d rpmbuild-@PACKAGE@-$$USER-XXXXXXXX`; \
171         $(MAKE) $(AM_MAKEFLAGS) \
172                 rpmbuilddir="$$rpmbuilddir" rpm-local || exit 1; \
173         $(RPMBUILD) \
174                 --define "_tmppath $$rpmbuilddir/TMP" \
175                 --define "_topdir $$rpmbuilddir" \
176                 --define "build_src_rpm 1" \
177                 --define "dist %{nil}" \
178                 -ts $(distdir).tar.gz || exit 1; \
179         cp $$rpmbuilddir/SRPMS/$(distdir)-*.src.rpm $(top_srcdir) || exit 1; \
180         rm -rf $$rpmbuilddir
181
182 # In the debs target, first make sure what's in the changelog reflects
183 # the software version.  Here's how we could dig the version out of the
184 # autoconf version file directly:
185 # lversion=$$(sed -ne 's/m4_define(\[LUSTRE_[A-Z][A-Z]*\],\[\([0-9][0-9]*\)\])$$/\1/p'
186 #       lustre/autoconf/lustre-version.ac | tr '\n' '.' | sed -e 's/.$//');
187 #
188 # However, one cannot really run "make debs" without having done a
189 # configure first, so we could use the easier method of digging the
190 # version out of the config.h file.
191 debs: undef.h
192         lversion=$$(sed -ne 's/^#define VERSION "\(.*\)"$$/\1/p' config.h); \
193         cversion=$$(sed -ne '1s/^lustre (\(.*\)-[0-9][0-9]*).*$$/\1/p' debian/changelog); \
194         if [ "$$lversion" != "$$cversion" ]; then \
195                 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; \
196         fi; \
197         rm -rf debs
198         dpkg-buildpackage -I.git -I\*.out[0-9]\* -I\*.swp || { \
199                 rc=$${PIPESTATUS[0]}; \
200                 [ $${rc} -gt 1 ] && exit $${rc}; \
201                 exit 0; \
202         }
203         export KPKG_DEST_DIR="$$(pwd)/.." && \
204         version=$$(sed -ne '1s/^lustre (\(.*\)).*$$/\1/p' debian/changelog) && \
205         rm -rf debian/tmp/modules-deb && \
206         mkdir debian/tmp/modules-deb && \
207         pushd debian/tmp/modules-deb && \
208         dpkg -x ../../../../lustre-source_$${version}_all.deb $$(pwd) && \
209         mkdir usr_src/ && \
210         tar -C usr_src/ -xjf usr/src/lustre.tar.bz2 && \
211         chmod 755 usr_src/modules/lustre/debian/rules && \
212         mkdir -p usr_share_modass && \
213         ln -s /usr/share/modass/include/ usr_share_modass/ && \
214         ln -s /usr/share/modass/packages/ usr_share_modass/ && \
215         echo "lustre" > usr_share_modass/compliant.list && \
216         export MA_DIR=$$(pwd)/usr_share_modass && \
217         KVERS=$${KVERS:-$(LINUXRELEASE)} && \
218         if test "x@ENABLEO2IB@" = "xno"; then \
219                 export IB_OPTIONS="--with-o2ib=no"; \
220         else \
221                 if test -n "@O2IBPATH@"; then \
222                         export IB_OPTIONS="--with-o2ib=@O2IBPATH@"; \
223                 fi; \
224         fi; \
225         export KSRC_TREE=$(LINUX) && \
226         KSRC=$${KSRC:-$(LINUX_OBJ)} && \
227         m-a build $${KSRC:+-k $$KSRC} $${KVERS:+-l $$KVERS} -i -u $$(pwd) lustre && \
228         popd && \
229         VER=$$(sed -ne '1s/^lustre (\(.*-[0-9][0-9]*\)).*$$/\1/p' debian/changelog) && \
230         mkdir -p debs && \
231         mv ../linux-patch-lustre_$${VER}_all.deb ../lustre-dev_$${VER}_*.deb \
232            ../lustre-source_$${VER}_all.deb ../lustre-tests_$${VER}_*.deb \
233            ../lustre-utils_$${VER}_*.deb ../lustre_$${VER}.dsc \
234            ../lustre_$${VER}_*.changes ../lustre_$${VER}.tar.gz \
235            ../lustre-client-modules-$${KVERS}_$${VER}_*.deb debs/
236
237 if USES_DPKG
238 EXTRA_DIST += debian/*
239 endif
240
241 CSTK=/tmp/checkstack
242 CSTKO=/tmp/checkstack.orig
243
244 checkstack:
245         [ -f ${CSTK} -a ! -s ${CSTKO} ] && mv -f ${CSTK} ${CSTKO} || true
246         { for MOD in $$(find . -name "*.ko"); do                             \
247                 objdump -d $$MOD | perl contrib/scripts/checkstack.pl;       \
248           done } | grep -v " bug " | sort -nr | uniq > ${CSTK}
249         [ -f ${CSTKO} ] && ! diff -u ${CSTKO} ${CSTK} || head -n 30 ${CSTK}
250
251 checkstack-update:
252         [ -f ${CSTK} ] && mv -f ${CSTK} ${CSTKO}
253
254 checkstack-clean:
255         rm -f ${CSTK} ${CSTKO}
256
257 module-dist-hook:
258         @if [ -d .git ]; then \
259                 perl lustre/scripts/version_tag.pl \
260                         --make_META > $(distdir)/META; \
261         elif [ -f META ]; then \
262                 cp META $(distdir)/META; \
263         else \
264                 echo -e "\n" \
265                 "*** I have no idea how to create a META file in $(distdir).\n"\
266                 "*** Please file a bug at https://jira.hpdd.intel.com/\n"; \
267                 exit 1; \
268         fi