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