Whamcloud - gitweb
Add export from obdfilter to hold open file handles.
[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 following 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 = ../patches/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
19 EXTNP+= ext3-2.4.18-ino_sb_macro.diff extN-misc-fixup.diff
20 EXTNC = balloc.c bitmap.c dir.c file.c fsync.c ialloc.c inode.c ioctl.c
21 EXTNC+= namei.c super.c symlink.c
22 EXTNI = extN_fs.h extN_fs_i.h extN_fs_sb.h extN_jbd.h
23 EXTN_EXTRA = include/linux/xattr.h include/linux/extN_xattr.h fs/extN/xattr.c
24 extN_SOURCES = $(EXTNC) xattr.c # punch.c
25 extN_DEPENDENCIES = patch-stamp
26 EXTRA_DIST = $(EXTNP) $(EXTN_FIXES) \
27         extN-2.4.18-ino_sb_fixup.diff extN-2.4.18-exports.diff \
28         $(wildcard extN.patch-*)
29 DISTCLEANFILES = -r $(extN_SOURCES) sed-stamp patch-stamp *.orig *.rej
30 SUB=-e "s/ext3/extN/g" -e "s/EXT3/EXTN/g"
31
32 distclean:
33         cd .. && rm -f $(EXTN_EXTRA)
34
35 include $(top_srcdir)/Rules
36
37 # Create a fresh extN patch.
38 # This is for when the patch-stamp target fails for your kernel.
39 # Just edit the files until you like them, then do `make diff', and
40 # it will create a specialized patch for your particular kernel.
41 # Check it in, and the build should work for you without disrupting
42 # the other developers.
43 # Of course, the ideal is to merge changes so that the default patch
44 # set works for nearly everybody.  This is mainly for damage control.
45 diff:
46         $(RM) extN.patchT
47         l='$(EXTNC)'; for f in $$l; do                                        \
48           echo "$$f";                                                         \
49           (cd $(top_srcdir) &&                                                \
50             diff -u extN/extN.orig/$$f extN/$$f) >> extN.patchT;              \
51           test $$? -le 1 || exit 1;                                           \
52         done
53         l='$(EXTNI)'; for f in $$l; do                                        \
54           echo "$$f";                                                         \
55           (cd $(top_srcdir) &&                                                \
56             diff -u extN/extN-include.orig/$$f include/linux/$$f)>>extN.patchT;\
57           test $$? -le 1 || exit 1;                                           \
58         done
59         l='$(EXTN_EXTRA)'; for f in $$l; do                                   \
60           f=`echo "$$f" | sed 's%^fs/%%'`;                                    \
61           echo "$$f";                                                         \
62           (cd $(top_srcdir) &&                                                \
63             diff -u /dev/null $$f) >> extN.patchT;                            \
64           test $$? -le 1 || exit 1;                                           \
65         done
66         mv -f extN.patchT $(srcdir)/extN.patch-$(RELEASE)
67         echo "Don't forget to add $(srcdir)/extN.patch-$(RELEASE) to CVS!"
68 .PHONY: diff
69
70 # Just do the SUB transformation on all our source files.
71 sed-stamp:
72         $(RM) $@
73         rm -rf extN.orig extN-include.orig
74         mkdir extN.orig extN-include.orig
75         list='$(EXTNC)'; for f in $$list; do                                  \
76           echo "creating extN.orig/$$f";                                      \
77           sed $(SUB) $(LINUX)/fs/ext3/$$f > extN.orig/$$f;                    \
78         done
79         list='$(EXTNI)'; for i in $$list; do                                  \
80           s=`echo $$i | sed "s/extN/ext3/"`;                                  \
81           echo "creating extN-include.orig/$$i";                              \
82           sed $(SUB) $(LINUX)/include/linux/$$s > extN-include.orig/$$i;      \
83         done
84         echo timestamp > $@
85
86 # Patch the kernel files with our ext3 patches.  We need to go through some
87 # extra hoops because the include files are in a different tree and because
88 # patch likes to make local copies of files with (sym)links when it is patching
89 # them.  To avoid this, we copy/patch in the source dir instead of the build
90 # dir (if they are different).
91 # We also want to preserve the pristine transformed files for the diff target.
92 patch-stamp: sed-stamp $(EXTNP)
93         cp -a extN.orig/* $(srcdir)
94         cp -a extN-include.orig/* $(top_srcdir)/include/linux
95         test -e $(top_srcdir)/fs || ln -s . $(top_srcdir)/fs
96         list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(top_srcdir)/$$f; done
97         if [ -f $(srcdir)/extN.patch-$(RELEASE) ]; then                       \
98           echo "applying patch $(srcdir)/extN.patch-$(RELEASE)";              \
99           (cd $(top_srcdir) && patch -p0) < $(srcdir)/extN.patch-$(RELEASE);  \
100         else                                                                  \
101           echo "If first patch fails, read NOTE in extN/Makefile.am";         \
102           list='$(EXTNP)'; \
103           sed '/i_version/q' $(srcdir)/extN.orig/namei.c | tail -2 |          \
104             grep extN_mark_inode_dirty >/dev/null && list="$(EXTN_FIXES) $$list"; \
105           for p in $$list; do                                                 \
106             echo "applying patch $$p";                                        \
107             sed $(SUB) $(srcdir)/$$p |                                        \
108               (cd $(top_srcdir) && patch -p1) || exit $$?;                    \
109           done;                                                               \
110           echo "It is OK if the next patch says it is already applied";       \
111           echo "applying patch $(srcdir)/extN-2.4.18-exports.diff";           \
112           (cd $(top_srcdir) &&                                                \
113             patch -N -p1) < $(srcdir)/extN-2.4.18-exports.diff;               \
114           echo "applying patch $(srcdir)/extN-2.4.18-ino_sb_fix.diff";        \
115           (cd $(top_srcdir) &&                                                \
116             patch -p1) < $(srcdir)/extN-2.4.18-ino_sb_fixup.diff || exit $$?; \
117         fi
118         echo timestamp > $@
119
120 $(extN_SOURCES) $(EXTNI) $(EXTN_EXTRA): patch-stamp
121
122 # Don't distribute any patched files.
123 dist-hook:
124         $(RM) $(top_srcdir)/fs
125         list='$(EXTNC)'; for f in $$list; do $(RM) $(distdir)/$$f; done
126         list='$(EXTNI)'; for i in $$list; do                                  \
127           $(RM) $(distdir)/../include/linux/$$i;                              \
128         done
129         list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(distdir)/../$$f; done