Whamcloud - gitweb
file llobdstat.pl was initially added on branch b_devel.
[fs/lustre-release.git] / lustre / extN / Makefile.am
1 # Copyright (C) 2001  Cluster File Systems, Inc.
2 #
3 # This code is issued under the GNU General Public License.
4 # See the file COPYING in this distribution
5
6 DEFS=-DEXPORT_SYMTAB
7 MODULE = extN
8 modulefs_DATA = extN.o
9 EXTRA_PROGRAMS = extN
10
11 # NOTE: If you are not using a RedHat 12.5 or later kernel, then you need to
12 #       apply the "fixes" patch first, as it fixes a number of bugs in ext3.
13 #       It will be applied automatically by the extN build process, or you
14 #       can apply it to the source kernel tree and fix ext3 also.  For chaos22
15 #       (or other RH < 12.5 kernels) use the "chaos22" patch instead.
16 EXTN_FIXES = patch-2.4.18-chaos22
17 #EXTN_FIXES = ext3-2.4.18-fixes.diff
18 EXTNP = htree-ext3-2.4.18.diff linux-2.4.18ea-0.8.26.diff ext3-2.4-ino_t.diff
19 EXTNP+= ext3-2.4.18-ino_sb_macro.diff extN-misc-fixup.diff extN-noread.diff
20 EXTNP+= extN-wantedi.diff extN-san.diff extN-2.4.18-ino_sb_fixup.diff
21 #EXTNP+= extN-iget-debug.diff
22 EXTNC = balloc.c bitmap.c dir.c file.c fsync.c ialloc.c inode.c ioctl.c
23 EXTNC+= namei.c super.c symlink.c
24 EXTNI = extN_fs.h extN_fs_i.h extN_fs_sb.h extN_jbd.h quotaops.h
25 EXTN_EXTRA = include/linux/xattr.h include/linux/extN_xattr.h fs/extN/xattr.c
26 EXTN_EXTRA += include/linux/quotaops.h
27 extN_SOURCES = $(EXTNC) xattr.c # punch.c
28 extN_DEPENDENCIES = patch-stamp
29 EXTRA_DIST = $(EXTNP) $(EXTN_FIXES) \
30         ext3-largefile.diff extN-2.4.18-exports.diff \
31         ext3-use-after-free.diff ext3-unmount_sync.diff $(wildcard extN.patch-*)
32 DISTCLEANFILES = -r $(extN_SOURCES) sed-stamp patch-stamp *.orig *.rej
33 SUB=-e "s/ext3/extN/g" -e "s/EXT3/EXTN/g" -e "s/extern __inline__/static inline/"
34
35 distclean:
36         cd .. && rm -f $(EXTN_EXTRA)
37
38 include $(top_srcdir)/Rules
39
40 # Following 2 vars are for buildind outside the source tree.
41 extN_orig = $(top_builddir)/$(subdir)/extN.orig
42 extN_include_orig = $(top_builddir)/$(subdir)/extN-include.orig
43
44 # Create a fresh extN patch.
45 # This is for when the patch-stamp target fails for your kernel.
46 # Just edit the files until you like them, then do `make diff', and
47 # it will create a specialized patch for your particular kernel.
48 # Check it in, and the build should work for you without disrupting
49 # the other developers.
50 # Of course, the ideal is to merge changes so that the default patch
51 # set works for nearly everybody.  This is mainly for damage control.
52
53 diff:
54         $(RM) extN.patchT
55         l='$(EXTNC)'; for f in $$l; do                                        \
56           echo "$$f";                                                         \
57           (diff -u $(extN_orig)/$$f extN/$$f) >> extN.patchT;                 \
58           test $$? -le 1 || exit 1;                                           \
59         done
60         l='$(EXTNI)'; for f in $$l; do                                        \
61           echo "$$f";                                                         \
62           (diff -u $(extN_include_orig)/$$f $(top_srcdir)/include/linux/$$f)>>extN.patchT;\
63           test $$? -le 1 || exit 1;                                           \
64         done
65         l='$(EXTN_EXTRA)'; for f in $$l; do                                   \
66           f=`echo "$$f" | sed 's%^fs/%%'`;                                    \
67           echo "$$f";                                                         \
68           (cd $(top_srcdir) &&                                                \
69             diff -u /dev/null $$f) >> extN.patchT;                            \
70           test $$? -le 1 || exit 1;                                           \
71         done
72         mv -f extN.patchT $(top_builddir)/$(subdir)/extN.patch-$(RELEASE)
73         echo "Don't forget to add $(srcdir)/extN.patch-$(RELEASE) to CVS!"
74
75 .PHONY: diff
76
77 # Just do the SUB transformation on all our source files.
78 sed-stamp:
79         $(RM) $@
80         rm -rf $(extN_orig) $(extN_include_orig)
81         mkdir $(extN_orig) $(extN_include_orig)
82         list='$(EXTNC)'; for f in $$list; do                                  \
83           echo "creating $(extN_orig)/$$f";                                   \
84           sed $(SUB) $(LINUX)/fs/ext3/$$f > $(extN_orig)/$$f;                 \
85         done
86         list='$(EXTNI)'; for i in $$list; do                                  \
87           s=`echo $$i | sed "s/extN/ext3/"`;                                  \
88           echo "creating $(extN_include_orig)/$$i";                           \
89           sed $(SUB) $(LINUX)/include/linux/$$s > $(extN_include_orig)/$$i;   \
90         done
91         echo timestamp > $@
92
93
94 # Patch the kernel files with our ext3 patches.  We need to go through some
95 # extra hoops because the include files are in a different tree and because
96 # patch likes to make local copies of files with (sym)links when it is patching
97 # them.  To avoid this, we copy/patch in the source dir instead of the build
98 # dir (if they are different).
99 # We also want to preserve the pristine transformed files for the diff target.
100
101
102
103 patch-stamp: sed-stamp $(EXTNP)
104         test -e $(top_builddir)/include/linux || mkdir -p $(top_builddir)/include/linux 
105         cp -a $(extN_orig)/* $(top_builddir)/$(subdir)
106         cp -a $(extN_include_orig)/* $(top_builddir)/include/linux
107         test -e $(top_builddir)/fs || ln -s . $(top_builddir)/fs
108         list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(top_builddir)/$$f; done
109         if [ -f $(srcdir)/extN.patch-$(RELEASE) ]; then                       \
110           echo "applying patch $(srcdir)/extN.patch-$(RELEASE)";              \
111           (cd $(top_builddir) && patch -p0) < $(srcdir)/extN.patch-$(RELEASE);\
112         else                                                                  \
113           list='$(EXTNP)'; \
114           grep -q "err = extN_mark_inode_dirty" $(extN_orig)/namei.c ||       \
115             list="ext3-use-after-free.diff $$list";                           \
116           sed '/i_version/q' $(extN_orig)/namei.c | tail -2 |                 \
117             grep -q extN_mark_inode_dirty && list="$(EXTN_FIXES) $$list";     \
118           grep -q "if (do_sync_supers)" $(extN_orig)/super.c &&               \
119             list="ext3-unmount_sync.diff $$list";                             \
120           grep -q "ext3_journal_start(inode, 2)" $(extN_orig)/inode.c ||      \
121             list="ext3-largefile.diff $$list";                                \
122           grep -q "EXPORT_SYMBOL(extN_bread)" $(extN_orig)/super.c ||         \
123             list="$$list extN-2.4.18-exports.diff";                           \
124           for p in $$list; do                                                 \
125             echo "applying patch $$p";                                        \
126             sed $(SUB) $(srcdir)/$$p |                                        \
127               (cd $(top_builddir) && patch -p1) || exit $$?;                  \
128           done;                                                               \
129         fi
130         echo timestamp > $@
131
132
133
134
135 $(extN_SOURCES) $(EXTNI) $(EXTN_EXTRA): patch-stamp
136
137 # Don't distribute any patched files.
138 dist-hook:
139         $(RM) $(top_srcdir)/fs
140         list='$(EXTNC)'; for f in $$list; do $(RM) $(distdir)/$$f; done
141         list='$(EXTNI)'; for i in $$list; do                                  \
142           $(RM) $(distdir)/../include/linux/$$i;                              \
143         done
144         list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(distdir)/../$$f; done