From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id A274E6DE0355 for ; Mon, 9 Jan 2017 12:06:59 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.18 X-Spam-Level: X-Spam-Status: No, score=0.18 tagged_above=-999 required=5 tests=[AWL=0.189, HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0XeCYCzDY3TA for ; Mon, 9 Jan 2017 12:06:58 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 3DCC46DE0318 for ; Mon, 9 Jan 2017 12:06:58 -0800 (PST) Received: by guru.guru-group.fi (Postfix, from userid 501) id 9BD191001CD; Mon, 9 Jan 2017 22:06:45 +0200 (EET) From: Tomi Ollila 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 Message-Id: <20170109200644.3076-1-tomi.ollila@iki.fi> X-Mailer: git-send-email 2.11.0 In-Reply-To: <8737gucmmi.fsf@tethera.net> References: <8737gucmmi.fsf@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jan 2017 20:06:59 -0000 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 $( $@ -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