1 # Copyright (C) 2001 Cluster File Systems, Inc.
3 # This code is issued under the GNU General Public License.
4 # See the file COPYING in this distribution
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
19 EXTNP+= ext3-2.4.18-ino_sb_macro.diff extN-misc-fixup.diff extN-noread.diff
20 EXTNP+= extN-wantedi.diff
21 EXTNC = balloc.c bitmap.c dir.c file.c fsync.c ialloc.c inode.c ioctl.c
22 EXTNC+= namei.c super.c symlink.c
23 EXTNI = extN_fs.h extN_fs_i.h extN_fs_sb.h extN_jbd.h quotaops.h
24 EXTN_EXTRA = include/linux/xattr.h include/linux/extN_xattr.h fs/extN/xattr.c
25 EXTN_EXTRA += include/linux/quotaops.h
26 extN_SOURCES = $(EXTNC) xattr.c # punch.c
27 extN_DEPENDENCIES = patch-stamp
28 EXTRA_DIST = $(EXTNP) $(EXTN_FIXES) \
29 extN-2.4.18-ino_sb_fixup.diff extN-2.4.18-exports.diff \
30 $(wildcard extN.patch-*)
31 DISTCLEANFILES = -r $(extN_SOURCES) sed-stamp patch-stamp *.orig *.rej
32 SUB=-e "s/ext3/extN/g" -e "s/EXT3/EXTN/g" -e "s/extern __inline__/static inline/"
35 cd .. && rm -f $(EXTN_EXTRA)
37 include $(top_srcdir)/Rules
39 # Following 2 vars are for buildind outside the source tree.
40 extN_orig = $(top_builddir)/$(subdir)/extN.orig
41 extN_include_orig = $(top_builddir)/$(subdir)/extN-include.orig
43 # Create a fresh extN patch.
44 # This is for when the patch-stamp target fails for your kernel.
45 # Just edit the files until you like them, then do `make diff', and
46 # it will create a specialized patch for your particular kernel.
47 # Check it in, and the build should work for you without disrupting
48 # the other developers.
49 # Of course, the ideal is to merge changes so that the default patch
50 # set works for nearly everybody. This is mainly for damage control.
54 l='$(EXTNC)'; for f in $$l; do \
56 (diff -u $(extN_orig)/$$f extN/$$f) >> extN.patchT; \
57 test $$? -le 1 || exit 1; \
59 l='$(EXTNI)'; for f in $$l; do \
61 (diff -u $(extN_include_orig)/$$f $(top_srcdir)/include/linux/$$f)>>extN.patchT;\
62 test $$? -le 1 || exit 1; \
64 l='$(EXTN_EXTRA)'; for f in $$l; do \
65 f=`echo "$$f" | sed 's%^fs/%%'`; \
67 (cd $(top_srcdir) && \
68 diff -u /dev/null $$f) >> extN.patchT; \
69 test $$? -le 1 || exit 1; \
71 mv -f extN.patchT $(top_builddir)/$(subdir)/extN.patch-$(RELEASE)
72 echo "Don't forget to add $(srcdir)/extN.patch-$(RELEASE) to CVS!"
76 # Just do the SUB transformation on all our source files.
79 rm -rf $(extN_orig) $(extN_include_orig)
80 mkdir $(extN_orig) $(extN_include_orig)
81 list='$(EXTNC)'; for f in $$list; do \
82 echo "creating $(extN_orig)/$$f"; \
83 sed $(SUB) $(LINUX)/fs/ext3/$$f > $(extN_orig)/$$f; \
85 list='$(EXTNI)'; for i in $$list; do \
86 s=`echo $$i | sed "s/extN/ext3/"`; \
87 echo "creating $(extN_include_orig)/$$i"; \
88 sed $(SUB) $(LINUX)/include/linux/$$s > $(extN_include_orig)/$$i; \
93 # Patch the kernel files with our ext3 patches. We need to go through some
94 # extra hoops because the include files are in a different tree and because
95 # patch likes to make local copies of files with (sym)links when it is patching
96 # them. To avoid this, we copy/patch in the source dir instead of the build
97 # dir (if they are different).
98 # We also want to preserve the pristine transformed files for the diff target.
102 patch-stamp: sed-stamp $(EXTNP)
103 test -e $(top_builddir)/include/linux || mkdir -p $(top_builddir)/include/linux
104 cp -a $(extN_orig)/* $(top_builddir)/$(subdir)
105 cp -a $(extN_include_orig)/* $(top_builddir)/include/linux
106 test -e $(top_builddir)/fs || ln -s . $(top_builddir)/fs
107 list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(top_builddir)/$$f; done
108 if [ -f $(srcdir)/extN.patch-$(RELEASE) ]; then \
109 echo "applying patch $(srcdir)/extN.patch-$(RELEASE)"; \
110 (cd $(top_builddir) && patch -p0) < $(srcdir)/extN.patch-$(RELEASE); \
112 echo "If first patch fails, read NOTE in extN/Makefile.am"; \
114 sed '/i_version/q' $(extN_orig)/namei.c | tail -2 | \
115 grep extN_mark_inode_dirty >/dev/null && list="$(EXTN_FIXES) $$list"; \
116 for p in $$list; do \
117 echo "applying patch $$p"; \
118 sed $(SUB) $(srcdir)/$$p | \
119 (cd $(top_builddir) && patch -p1) || exit $$?; \
121 echo "It is OK if the next patch says it is already applied"; \
122 echo "applying patch $(srcdir)/extN-2.4.18-exports.diff"; \
123 (cd $(top_builddir) && \
124 patch -N -p1) < $(srcdir)/extN-2.4.18-exports.diff; \
125 echo "applying patch $(srcdir)/extN-2.4.18-ino_sb_fix.diff"; \
126 (cd $(top_builddir) && \
127 patch -p1) < $(srcdir)/extN-2.4.18-ino_sb_fixup.diff || exit $$?; \
134 $(extN_SOURCES) $(EXTNI) $(EXTN_EXTRA): patch-stamp
136 # Don't distribute any patched files.
138 $(RM) $(top_srcdir)/fs
139 list='$(EXTNC)'; for f in $$list; do $(RM) $(distdir)/$$f; done
140 list='$(EXTNI)'; for i in $$list; do \
141 $(RM) $(distdir)/../include/linux/$$i; \
143 list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(distdir)/../$$f; done