From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Cc: tomi.ollila@iki.fi
Subject: [RFC PATCH 3] support goals after make *clean, *clean with current Makefile.config
Date: Thu, 12 Jan 2017 00:07:05 +0200 [thread overview]
Message-ID: <20170111220705.9756-1-tomi.ollila@iki.fi> (raw)
In-Reply-To: <m2lgul432f.fsf@guru.guru-group.fi>
Makes make clean, make distclean and make dataclean faster if
Makefile.config exists but configure is newer.
After 1st target being *clean, any non-*clean targets may follow
it -- these are built in sub-make -- and when control returns
to main make, it just recognizes targers already made.
---
smoke-tested.
goal vs. target terminology is hard always
Makefile | 15 +++++++++++++++
Makefile.local | 27 ++++++++++++++++++++-------
2 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 0ef57fa..7540903 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,22 @@ include Makefile.config
global_deps = Makefile Makefile.config Makefile.local \
$(subdirs:%=%/Makefile) $(subdirs:%=%/Makefile.local)
+ifneq ($(filter clean distclean dataclean, $(word 1, $(MAKECMDGOALS))),)
+ifneq ($(filter clean distclean dataclean, $(wordlist 2, 99, $(MAKECMDGOALS))),)
+$(error With "$(word 1, $(MAKECMDGOALS))" no further *clean targets works)
+endif
+WITH_CLEAN := yes
+else
+WITH_CLEAN := no
+endif
+
+# Potentially speedup make clean, distclean and dataclean ; avoid
+# re-creation of Makefile.config if it exists but configure is newer.
+ifeq ($(WITH_CLEAN),yes)
+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,"
diff --git a/Makefile.local b/Makefile.local
index 3548ed9..e33af45 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -198,18 +198,31 @@ quiet ?= $($(shell echo $1 | sed -e s'/ .*//'))
@mkdir -p $(patsubst %/.,%,.deps/$(@D))
$(call quiet,CC $(CPPFLAGS) $(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@ -MD -MP -MF .deps/$*.d
-.PHONY : clean
-clean:
- rm -rf $(CLEAN); rm -rf .deps
+.PHONY: _clean
+_clean:
+ rm -rf $(CLEAN)
+ rm -rf .deps
-.PHONY: distclean
-distclean: clean
+.PHONY: _distclean
+_distclean: _clean
rm -rf $(DISTCLEAN)
-.PHONY: dataclean
-dataclean: distclean
+.PHONY: _dataclean
+_dataclean: _distclean
rm -rf $(DATACLEAN)
+clean: _clean
+distclean: _distclean
+dataclean: _dataclean
+
+ifeq ($(WITH_CLEAN),yes)
+ifneq ($(word 2, $(MAKECMDGOALS)),)
+clean distclean dataclean: goals_after_clean
+goals_after_clean:
+ $(MAKE) $(wordlist 2, 99, $(MAKECMDGOALS)) configure_options=$(configure_options)
+endif
+endif
+
notmuch_client_srcs = \
command-line-arguments.c\
debugger.c \
--
2.9.3
next prev parent reply other threads:[~2017-01-11 22:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-06 19:32 [RFC PATCH] rfc: make 'make distclean' always use current Makefile.config Tomi Ollila
2017-01-08 2:27 ` David Bremner
2017-01-08 22:08 ` Tomi Ollila
2017-01-11 22:07 ` Tomi Ollila [this message]
2017-01-09 20:06 ` [RFC PATCH 2] opportunistic support for make {, dist, data}clean {all, test, install} Tomi Ollila
2017-01-12 20:38 ` [RFC PATCH 5] support make goals after initial *clean goal(s) Tomi Ollila
2017-01-16 18:04 ` [RFC PATCH 6] support make goals after initial {'', dist, data}clean goal(s) Tomi Ollila
2017-03-09 13:10 ` David Bremner
2017-03-09 15:51 ` Tomi Ollila
2017-03-10 12:20 ` David Bremner
2017-03-11 14:06 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170111220705.9756-1-tomi.ollila@iki.fi \
--to=tomi.ollila@iki.fi \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).