Whamcloud - gitweb
First cut at uml40 extN patch.
[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 fs/extN/hash.c include/linux/extN_fs.h
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 = $(extN_SOURCES) sed-stamp patch-stamp *.orig *.rej
28 SUB=-e "s/ext3/extN/g" -e "s/EXT3/EXTN/g"
29
30 include $(top_srcdir)/Rules
31
32 # Create a fresh extN patch.
33 # This is for when the patch-stamp target fails for your kernel.
34 # Just edit the files until you like them, then do `make diff', and
35 # it will create a specialized patch for your particular kernel.
36 # Check it in, and the build should work for you without disrupting
37 # the other developers.
38 # Of course, the ideal is to merge changes so that the default patch
39 # set works for nearly everybody.  This is mainly for damage control.
40 diff:
41         $(RM) extN.patchT
42         -for f in $(EXTNC); do (cd $(top_srcdir) && diff -u extN/extN.orig/$$f extN/$$f) >> extN.patchT; done
43         -for f in $(EXTNI); do (cd $(top_srcdir) && diff -u extN/extN.orig-include/$$f include/linux/$$f) >> extN.patchT; done
44         mv -f extN.patchT $(srcdir)/extN.patch-$(RELEASE)
45         f=extN.patch-$(RELEASE); if cvs update $$f 2>&1 | grep 'cvs add' >/dev/null; then \
46           cvs add $$f; \
47         fi
48 .PHONY: diff
49
50 # Just do the SUB transformation on all our source files.
51 sed-stamp:
52         $(RM) $@
53         rm -rf extN.orig extN.orig-include
54         mkdir extN.orig extN.orig-include
55         set -vx;                                                              \
56         list='$(EXTNC)'; for f in $$list; do                                  \
57         sed $(SUB) $(LINUX)/fs/ext3/$$f > extN.orig/$$f;                  \
58         done
59         set -vx;                                                              \
60         list='$(EXTNI)'; for i in $$list; do                                  \
61         s=`echo $$i | sed "s/extN/ext3/"`;                                    \
62         sed $(SUB) $(LINUX)/include/linux/$$s >                               \
63                 extN.orig-include/$$i;                              \
64         done
65         echo timestamp > $@
66
67 # Patch the kernel files with our ext3 patches.  We need to go through some
68 # extra hoops because the include files are in a different tree and because
69 # patch likes to make local copies of files with (sym)links when it is patching
70 # them.  To avoid this, we copy/patch in the source dir instead of the build
71 # dir (if they are different).
72 # We also want to preserve the pristine transformed files for the diff target.
73 patch-stamp: sed-stamp $(EXTNP)
74         cp -a extN.orig/* $(srcdir)
75         cp -a extN.orig-include/* $(top_srcdir)/include/linux
76         test -e $(top_srcdir)/fs || ln -s . $(top_srcdir)/fs
77         set -vx;                                                              \
78         if [ -f $(srcdir)/extN.patch-$(RELEASE) ]; then                       \
79                 (cd $(top_srcdir) && patch -p0) < $(srcdir)/extN.patch-$(RELEASE);                  \
80         else                                                                  \
81                 echo "If first patch fails, read NOTE in extN/Makefile.am";   \
82                 list='$(EXTNP)'; for p in $$list; do                          \
83                 sed $(SUB) $(srcdir)/$$p | (cd $(top_srcdir) && patch -p1) || exit $$?;\
84                 done;                                                         \
85                 echo "It is OK if the following patch fails";                 \
86                 (cd $(top_srcdir) && patch -N -p1) < $(srcdir)/extN-2.4.18-exports.diff; \
87                 (cd $(top_srcdir) && patch -p1) < $(srcdir)/extN-2.4.18-ino_sb_fixup.diff || exit $$?; \
88         fi
89         echo timestamp > $@
90
91 $(extN_SOURCES) $(EXTNI) $(EXTN_EXTRA): patch-stamp
92
93 # Don't distribute any patched files.
94 dist-hook:
95         $(RM) $(top_srcdir)/fs
96         list='$(EXTNC)'; for f in $$list; do $(RM) $(distdir)/$$f; done
97         list='$(EXTNI)'; for i in $$list; do                                  \
98                 $(RM) $(distdir)/../include/linux/$$i;                        \
99         done
100         list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(distdir)/../$$f; done