[RFC PATCH] rfc: make 'make distclean' always use current Makefile.config

Tomi Ollila tomi.ollila at iki.fi
Fri Jan 6 11:32:54 PST 2017

... and not recreate it (slowly) if 'configure' changed, just to
be deleteted later during 'make distclean'.

For cleaning the old Makefile.config might actually be more accurate
if configure changes what will be cleaned later...
 Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 0ef57fa..be527e9 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,13 @@ include Makefile.config
 global_deps = Makefile Makefile.config Makefile.local \
 	$(subdirs:%=%/Makefile) $(subdirs:%=%/Makefile.local)
-Makefile.config: $(srcdir)/configure
+# In case of 'make distclean' have configure as order-only prerequisite so
+# that Makefile.config is not recreated when configure is newer than it is.
+ifeq ($(MAKECMDGOALS),distclean)
+Makefile.config: | $(srcdir)/configure
+Makefile.config:   $(srcdir)/configure
 ifeq ($(configure_options),)
 	@echo ""
 	@echo "Note: Calling ./configure with no command-line arguments. This is often fine,"

More information about the notmuch mailing list