make sure that the perl -v/-V output corresponds to the latest commit
Yves Orton [Sun, 21 Dec 2008 15:34:56 +0000 (16:34 +0100)]
.gitignore
Makefile.SH
cflags.SH
make_patchnun.sh [new file with mode: 0644]

index 5a760a1..81f4486 100644 (file)
@@ -1,6 +1,9 @@
+# ignore .patch from rsync, and any generated patch files from git-am
 *.patch
+# ignore local .config files
 .config
-
+# ignore generated .patchnum file
+.patchnum
 
 
 # files produced by './configure.gnu' on a Linux machine
index 2a902c3..755e600 100644 (file)
@@ -535,7 +535,12 @@ sperl$(OBJ_EXT): perl.c $(h)
 sperl.i: perl.c $(h)
        $(CCCMDSRC) -DIAMSUID -E perl.c > sperl.i
 
-.PHONY: all translators utilities
+.PHONY: all translators utilities make_patchnum
+
+make_patchnum:
+        sh $(shellflags) make_patchnum.sh
+
+perl$(OBJ_EXT): make_patchnum .patchnum
 
 translators:   miniperl$(EXE_EXT) $(CONFIGPM) FORCE
        @echo " "; echo "       Making x2p stuff"; cd x2p; $(LDLIBPTH) $(MAKE) all
index 9e0494e..b11966b 100755 (executable)
--- a/cflags.SH
+++ b/cflags.SH
@@ -354,12 +354,8 @@ case "$cc" in
   ;;
 esac
 
-if test -d .git; then
-  ccflags="-DPERL_PATCHNUM=`git describe` $ccflags"
-else
-  if test -f .patch; then
-    ccflags="-DPERL_PATCHNUM=`awk '{print $4}' .patch` $ccflags"
-  fi
+if [ -f .patchnum -a -n "$(cat .patchnum)"]; then
+    ccflags="-DPERL_PATCHNUM=`cat .patchnum`"
 fi
 
     : Can we perhaps use $ansi2knr here
diff --git a/make_patchnun.sh b/make_patchnun.sh
new file mode 100644 (file)
index 0000000..2306fa8
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+Existing=`cat .patchnum 2>/dev/null`
+Current=`git describe`
+
+if [ "$Existing" != "$Current" ]; then
+       echo "Updating .patchnum"
+       echo $Current > .patchnum
+else
+       echo "Reusing .patchnum" 
+fi