unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Cc: tomi.ollila@iki.fi
Subject: [RFC PATCH 2] opportunistic support for make {, dist, data}clean {all, test, install}
Date: Mon,  9 Jan 2017 22:06:44 +0200	[thread overview]
Message-ID: <20170109200644.3076-1-tomi.ollila@iki.fi> (raw)
In-Reply-To: <8737gucmmi.fsf@tethera.net>

Makes make clean, make distclean and make dataclean faster if
Makefile.config exists but configure is newer.

Makes any combination of make {,dist,data}clean {all,test,install}
work (probably, some ad-hoc hand testing done).
---

Well, could not resist the temptation to dig further...

This may be as fragile as out-of-tree build, but should
not make the status quo worse.


Makefile                  | 15 +++++++++++++++
 Makefile.local            | 14 ++++++++++++--
 completion/Makefile.local |  2 +-
 emacs/Makefile.local      |  6 +++---
 lib/Makefile.local        |  2 +-
 test/Makefile.local       |  5 +++++
 6 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 0ef57fa..874a5ae 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-out all test install, $(wordlist 2, 99, $(MAKECMDGOALS))),)
+$(error With "$(word 1, $(MAKECMDGOALS))" only "all", "test" and "install" may work)
+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..a9e831a 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -1,7 +1,11 @@
 # -*- makefile -*-
 
 .PHONY: all
-all: notmuch notmuch-shared build-man ruby-bindings
+ifeq ($(WITH_CLEAN),yes)
+all:
+	$(MAKE) $@ configure_options=$(configure_options)
+else
+all: _all notmuch notmuch-shared build-man ruby-bindings
 ifeq ($(MAKECMDGOALS),)
 ifeq ($(shell cat .first-build-message 2>/dev/null),)
 	@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
@@ -16,6 +20,7 @@ ifeq ($(shell cat .first-build-message 2>/dev/null),)
 	@echo Printed > .first-build-message
 endif
 endif
+endif
 
 # Depend (also) on the file 'version'. In case of ifeq ($(IS_GIT),yes)
 # this file may already have been updated.
@@ -249,7 +254,11 @@ notmuch-shared: $(notmuch_client_modules) lib/$(LINKER_NAME)
 	$(call quiet,$(FINAL_NOTMUCH_LINKER) $(CFLAGS)) $(notmuch_client_modules) $(FINAL_NOTMUCH_LDFLAGS) -o $@
 
 .PHONY: install
-install: all install-man
+ifeq ($(WITH_CLEAN),yes)
+install:
+	$(MAKE) $@ configure_options=$(configure_options)
+else
+install: _install all install-man
 	mkdir -p "$(DESTDIR)$(prefix)/bin/"
 	install notmuch-shared "$(DESTDIR)$(prefix)/bin/notmuch"
 ifeq ($(MAKECMDGOALS), install)
@@ -273,6 +282,7 @@ ifeq ($(WITH_EMACS), 1)
 	@echo "the command \"M-x notmuch\" from within emacs."
 endif
 endif
+endif
 
 SRCS  := $(SRCS) $(notmuch_client_srcs)
 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
diff --git a/completion/Makefile.local b/completion/Makefile.local
index dfc1271..e0a1893 100644
--- a/completion/Makefile.local
+++ b/completion/Makefile.local
@@ -8,7 +8,7 @@ dir := completion
 bash_script := $(srcdir)/$(dir)/notmuch-completion.bash
 zsh_script := $(srcdir)/$(dir)/notmuch-completion.zsh
 
-install: install-$(dir)
+_install: install-$(dir)
 
 install-$(dir):
 	@echo $@
diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 040e64d..e6a2b1b 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -35,7 +35,7 @@ $(dir)/notmuch-pkg.el: $(srcdir)/$(dir)/notmuch-pkg.el.tmpl
 	@sed -e 's/%AG%/Generated file (from $(<F)) -- do not edit!/' \
 	     -e 's/%VERSION%/"$(ELPA_VERSION)"/' $< > $@
 
-all: $(dir)/notmuch-pkg.el
+_all: $(dir)/notmuch-pkg.el
 install-emacs: $(dir)/notmuch-pkg.el
 
 emacs_mua := $(dir)/notmuch-emacs-mua
@@ -88,11 +88,11 @@ notmuch-emacs-%.tar: ${elpa_sources}
 
 ifeq ($(WITH_EMACS),1)
 ifeq ($(HAVE_EMACS),1)
-all: $(emacs_bytecode)
+_all: $(emacs_bytecode)
 install-emacs: $(emacs_bytecode)
 endif
 
-install: install-emacs
+_install: install-emacs
 endif
 
 .PHONY: install-emacs
diff --git a/lib/Makefile.local b/lib/Makefile.local
index b77e578..479c60c 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -71,7 +71,7 @@ $(dir)/$(SONAME): $(dir)/$(LIBNAME)
 $(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
 	ln -sf $(LIBNAME) $@
 
-install: install-$(dir)
+_install: install-$(dir)
 
 install-$(dir): $(dir)/$(LIBNAME)
 	mkdir -p "$(DESTDIR)$(libdir)/"
diff --git a/test/Makefile.local b/test/Makefile.local
index f8cf90d..fbb395f 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -59,6 +59,10 @@ TEST_BINARIES := $(TEST_BINARIES:.cc=)
 
 test-binaries: $(TEST_BINARIES)
 
+ifeq ($(WITH_CLEAN),yes)
+test:
+	$(MAKE) $@ configure_options=$(configure_options)
+else
 test:	all test-binaries
 ifeq ($V,)
 	@echo 'Use "$(MAKE) V=1" to print test headings and PASSing results.'
@@ -71,6 +75,7 @@ else
 	@${test_src_dir}/notmuch-test $(OPTIONS)
 endif
 endif
+endif
 
 check: test
 
-- 
2.9.3

  parent reply	other threads:[~2017-01-09 20:06 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     ` [RFC PATCH 3] support goals after make *clean, *clean with " Tomi Ollila
2017-01-09 20:06   ` Tomi Ollila [this message]
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=20170109200644.3076-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).