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