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

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

Date: Fri, 6 Jan 2017 21:32:54 +0200

To: notmuch@notmuchmail.org

Cc: tomi.ollila@iki.fi

From: Tomi Ollila


... 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
+else
+Makefile.config:   $(srcdir)/configure
+endif
 ifeq ($(configure_options),)
 	@echo ""
 	@echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
-- 
2.7.4


Thread: