Whamcloud - gitweb
3a60114c26517cea504f38960a2730706a2b0c43
[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 # EXTNP = ext3-2.4.18-fixes.diff
14 EXTNP+= htree-ext3-2.4.18.diff linux-2.4.18ea-0.8.26.diff
15 EXTNP+= ext3-2.4.18-ino_sb_macro.diff extN-misc-fixup.diff
16 EXTNC = balloc.c bitmap.c dir.c file.c fsync.c ialloc.c inode.c ioctl.c
17 EXTNC+= namei.c super.c symlink.c
18 EXTNI = extN_fs.h extN_fs_i.h extN_fs_sb.h extN_jbd.h
19 EXTN_EXTRA = include/linux/xattr.h include/linux/extN_xattr.h fs/extN/xattr.c fs/extN/hash.c include/linux/extN_fs.h
20 extN_SOURCES = $(EXTNC) xattr.c # punch.c
21 extN_DEPENDENCIES = patch-stamp
22 EXTRA_DIST = $(EXTNP) extN-2.4.18-ino_sb_fixup.diff extN-2.4.18-exports.diff
23 DISTCLEANFILES = $(extN_SOURCES) patch-stamp *.orig *.rej
24 SUB=-e "s/ext3/extN/g" -e "s/EXT3/EXTN/g"
25
26 include $(top_srcdir)/Rules
27
28 # Create a fresh ext2 patch.
29 diff:
30         $(RM) extN.patchT
31         for f in $(EXTNC); do diff -u $(top_srcdir)/fs/extN/$$f $$f >> extN.patchT ; done
32         mv -f ext2.patchT $(srcdir)/ext2.patch-$(RELEASE)
33 .PHONY: diff
34
35 # Patch the kernel files with our ext3 patches.  We need to go through some
36 # extra hoops because the include files are in a different tree and because
37 # patch likes to make local copies of files with (sym)links when it is patching
38 # them.  To avoid this, we copy/patch in the source dir instead of the build
39 # dir (if they are different).
40 patch-stamp: $(EXTNP)
41         $(RM) $@
42         test -e $(top_srcdir)/fs || ln -sf . $(top_srcdir)/fs
43         set -vx;\
44         list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(top_srcdir)/$$f; done
45         set -vx;\
46         list='$(EXTNC)'; for f in $$list; do                                  \
47         sed $(SUB) $(LINUX)/fs/ext3/$$f > $(top_srcdir)/fs/extN/$$f;          \
48         done
49         set -vx;\
50         list='$(EXTNI)'; for i in $$list; do                                  \
51         s=`echo $$i | sed "s/extN/ext3/"`;                                    \
52         sed $(SUB) $(LINUX)/include/linux/$$s >                               \
53                 $(top_srcdir)/include/linux/$$i;                              \
54         done
55         set -vx;\
56         if [ -f $(srcdir)/extN.patch-$(RELEASE) ]; then \
57                 patch -p0 < $(srcdir)/extN.patch-$(RELEASE); \
58         else \
59                 list='$(EXTNP)'; for p in $$list; do                        \
60                 sed $(SUB) $(srcdir)/$$p|(cd $(top_srcdir);patch -p1)||exit -1;\
61                 done;  \
62                 echo "It is OK if the following patch fails";               \
63                 (cd $(top_srcdir); patch -N -p1) < $(srcdir)/extN-2.4.18-exports.diff; \
64                 (cd $(top_srcdir); patch -p1) < $(srcdir)/extN-2.4.18-ino_sb_fixup.diff; \
65         fi
66         echo timestamp > $@
67
68 $(extN_SOURCES) $(EXTNI) $(EXTN_EXTRA): patch-stamp
69
70 # Don't distribute any patched files.
71 dist-hook:
72         $(RM) $(top_srcdir)/fs
73         list='$(EXTNC)'; for f in $$list; do $(RM) $(distdir)/$$f; done
74         list='$(EXTNI)'; for i in $$list; do                                  \
75                 $(RM) $(distdir)/../include/linux/$$i;                        \
76         done
77         list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(distdir)/../$$f; done