Currently, in a project that uses the 'configmake' module, modifying
lib/Makefile can cause an avalanche of rebuilds during the next "make".
In my case, it's because we have dependencies
    configmake.h            from Makefile,
    config.h                from $(BUILT_SOURCES), which contains configmake.h,
    all *.o files           from config.h

It's actually unnecessary to rebuild all this if the contents of configmake.h
actually did not change. I'm committing this optimization:

2009-04-19  Bruno Haible  <br...@clisp.org>

        * modules/configmake (Makefile.am): When the contents of configmake.h
        does not change, arrange to preserve its modification time.

*** modules/configmake.orig     2009-04-19 22:05:35.000000000 +0200
--- modules/configmake  2009-04-19 21:56:12.000000000 +0200
***************
*** 26,32 ****
  # The Automake-defined pkg* macros are appended, in the order
  # listed in the Automake 1.10a+ documentation.
  configmake.h: Makefile
!       rm -f $...@-t $@
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          echo '#define PREFIX "$(prefix)"'; \
          echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
--- 26,32 ----
  # The Automake-defined pkg* macros are appended, in the order
  # listed in the Automake 1.10a+ documentation.
  configmake.h: Makefile
!       rm -f $...@-t
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          echo '#define PREFIX "$(prefix)"'; \
          echo '#define EXEC_PREFIX "$(exec_prefix)"'; \
***************
*** 56,62 ****
          echo '#define PKGLIBDIR "$(pkglibdir)"'; \
          echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
        } | sed '/""/d' > $...@-t
!       mv $...@-t $@
  BUILT_SOURCES += configmake.h
  CLEANFILES += configmake.h configmake.h-t
  
--- 56,67 ----
          echo '#define PKGLIBDIR "$(pkglibdir)"'; \
          echo '#define PKGLIBEXECDIR "$(pkglibexecdir)"'; \
        } | sed '/""/d' > $...@-t
!       if test -f $@ && cmp $...@-t $@ > /dev/null; then \
!         rm -f $...@-t; \
!       else \
!         rm -f $@; mv $...@-t $@; \
!       fi
! 
  BUILT_SOURCES += configmake.h
  CLEANFILES += configmake.h configmake.h-t
  


Reply via email to