diff --git a/gen_OPALrevision b/gen_OPALrevision
index 78bd94b8f711d417c525d7fac0fd3e5e43576da7..9f298fa7937a190611be31e9944591faf263e8e7 100755
--- a/gen_OPALrevision
+++ b/gen_OPALrevision
@@ -4,7 +4,12 @@
 #
 
 print () {
-    echo '#define GIT_VERSION '\"$1\" > src/OPALrevision.h
+    echo '#define GIT_VERSION '\"$1\" > src/OPALrevision-new.h
+    if [[ -e  src/OPALrevision.h ]] && cmp -s src/OPALrevision.h src/OPALrevision-new.h; then
+        rm src/OPALrevision-new.h
+    else
+        mv src/OPALrevision-new.h src/OPALrevision.h
+    fi
 }
 
 # if git(1) is not in $PATH