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