avoid unneeded rebuilds due to component version
[openafs.git] / src / config / Makefile.version-NOCML.in
index 7aba6ea..18dcbc6 100644 (file)
@@ -10,9 +10,12 @@ PACKAGE=@PACKAGE@
 AFS_component_version_number.o: AFS_component_version_number.c
 
 AFS_component_version_number.c: @TOP_OBJDIR@/src/config/Makefile.version
-       VERSION=`@abs_top_srcdir@/build-tools/git-version @abs_top_srcdir@ "@VERSION@"` && \
-       echo 'char cml_version_number[]="@(#) OpenAFS '$$VERSION' built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c && \
-       echo 'char* AFSVersion = "${PACKAGE} '$$VERSION'";' >>AFS_component_version_number.c
+       ( VERSION=`@abs_top_srcdir@/build-tools/git-version @abs_top_srcdir@ "@VERSION@"` && \
+       echo 'char cml_version_number[]="@(#) OpenAFS '$$VERSION' built ' `date +"%Y-%m-%d"` '";' >AFS_component_version_number.c.NEW && \
+       echo 'char* AFSVersion = "${PACKAGE} '$$VERSION'";' >>AFS_component_version_number.c.NEW && \
+       if cmp AFS_component_version_number.c.NEW AFS_component_version_number.c > /dev/null ; then : ; else \
+       mv AFS_component_version_number.c.NEW AFS_component_version_number.c ; fi )
+       rm -f AFS_component_version_number.c.NEW
 
 version.xml:
        VERSION=`@abs_top_srcdir@/build-tools/git-version @abs_top_srcdir@ "@VERSION@"` && \