Whamcloud - gitweb
Chaos patch is now good.
[fs/lustre-release.git] / lustre / extN / Makefile.am
index 4e4785b..c34c1cb 100644 (file)
@@ -17,17 +17,25 @@ EXTN_EXTRA = include/linux/xattr.h include/linux/extN_xattr.h fs/extN/xattr.c
 extN_SOURCES = $(EXTNC) $(EXTNI) xattr.c # punch.c
 extN_DEPENDENCIES = patch-stamp
 EXTRA_DIST = $(EXTNP) extN-2.4.18-ino_sb_fixup.diff extN-2.4.18-exports.diff
-DISTCLEANFILES = $(EXTNC) $(EXTNI) patch-stamp *.orig *.rej
+DISTCLEANFILES = $(extN_SOURCES) patch-stamp *.orig *.rej
 SUB=-e "s/ext3/extN/g" -e "s/EXT3/EXTN/g"
 
 include $(top_srcdir)/Rules
 
+# Create a fresh ext2 patch.
+diff:
+       $(RM) extN.patchT
+       for f in $(EXTNC); do diff -u $(top_srcdir)/fs/extN/$$f $$f >> extN.patchT ; done
+       mv -f ext2.patchT $(srcdir)/ext2.patch-$(RELEASE)
+.PHONY: diff
+
 # Patch the kernel files with our ext3 patches.  We need to go through some
 # extra hoops because the include files are in a different tree and because
 # patch likes to make local copies of files with (sym)links when it is patching
 # them.  To avoid this, we copy/patch in the source dir instead of the build
 # dir (if they are different).
 patch-stamp: $(EXTNP)
+       $(RM) $@
        test -e $(top_srcdir)/fs || ln -sf . $(top_srcdir)/fs
        set -vx;\
        list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(top_srcdir)/$$f; done
@@ -42,19 +50,25 @@ patch-stamp: $(EXTNP)
                $(top_srcdir)/include/linux/$$i;                              \
        done
        set -vx;\
-       list='$(EXTNP)'; for p in $$list; do                                  \
-       sed $(SUB) $(srcdir)/$$p | (cd $(top_srcdir); patch -p1);             \
-       done
-       (cd $(top_srcdir); patch -p1) < $(srcdir)/extN-2.4.18-ino_sb_fixup.diff
-       -(cd $(top_srcdir); patch -p1) < $(srcdir)/extN-2.4.18-exports.diff
-       echo timestamp > patch-stamp
+       if [ -f $(srcdir)/extN.patch-$(RELEASE) ]; then \
+               patch -p0 < $(srcdir)/extN.patch-$(RELEASE); \
+       else \
+               list='$(EXTNP)'; for p in $$list; do                        \
+               sed $(SUB) $(srcdir)/$$p|(cd $(top_srcdir);patch -p1)||exit -1;\
+               done;  \
+               echo "It is OK if the following patch fails";               \
+               (cd $(top_srcdir); patch -N -p1) < $(srcdir)/extN-2.4.18-exports.diff; \
+               (cd $(top_srcdir); patch -p1) < $(srcdir)/extN-2.4.18-ino_sb_fixup.diff; \
+       fi
+       echo timestamp > $@
 
-$(EXTNC) $(EXTNI): patch-stamp
+$(EXTNC) $(EXTNI) $(EXTN_EXTRA) xattr.c: patch-stamp
 
 # Don't distribute any patched files.
 dist-hook:
-       rm -f $(top_srcdir)/fs
-       list='$(EXTNC)'; for f in $$list; do rm -f $(distdir)/$$f; done
+       $(RM) $(top_srcdir)/fs
+       list='$(EXTNC)'; for f in $$list; do $(RM) $(distdir)/$$f; done
        list='$(EXTNI)'; for i in $$list; do                                  \
-               rm -f $(distdir)/../include/linux/$$i;                        \
+               $(RM) $(distdir)/../include/linux/$$i;                        \
        done
+       list='$(EXTN_EXTRA)'; for f in $$list; do $(RM) $(distdir)/../$$f; done