From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C02AD138350 for ; Thu, 6 Feb 2020 20:53:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D456AE082F; Thu, 6 Feb 2020 20:53:27 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BC7CDE082F for ; Thu, 6 Feb 2020 20:53:27 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CA50D34E80D for ; Thu, 6 Feb 2020 20:53:26 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3F64CEE for ; Thu, 6 Feb 2020 20:53:25 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1580994263.a08319d85e0e3054aaa8048b4d51fc534533e23e.ulm@gentoo> Subject: [gentoo-commits] proj/devmanual:master commit in: / X-VCS-Repository: proj/devmanual X-VCS-Files: Makefile X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: a08319d85e0e3054aaa8048b4d51fc534533e23e X-VCS-Branch: master Date: Thu, 6 Feb 2020 20:53:25 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6f4f104b-5d60-4fa0-aa02-2c2463d1be17 X-Archives-Hash: 6041d21f9f0922ac2c1cd7d0bc3dae1f commit: a08319d85e0e3054aaa8048b4d51fc534533e23e Author: Ulrich Müller gentoo org> AuthorDate: Thu Feb 6 13:04:23 2020 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Thu Feb 6 13:04:23 2020 +0000 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=a08319d8 Makefile: New target "delete-old". This will delete any orphaned html and image files that could be left over after the corresponding source file was moved or removed. Such files are also not covered by "clean", so add the new target as prerequisite. Run a single "find" pass to get a list of all files in ALL_FILES and subsequently extract the necessary subsets from it. The list of all files is needed anyway for deletion of orphans, which are not included in HTMLS or IMAGES. Signed-off-by: Ulrich Müller gentoo.org> Makefile | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index ef2c735..d379bd3 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,16 @@ -# These "find" commands match text.xml and *.svg files, respectively, -# but only after excluding the .git directory from the search for -# performance and overall sanity reasons. -XMLS := $(shell find . -name .git -prune -o -type f -name 'text.xml' -print) -SVGS := $(shell find . -name .git -prune -o -type f -name '*.svg' -print) +# Run a single "find" pass to get a list of all files (with the .git +# directory excluded), then filter out what we need. +ALL_FILES := $(shell find . -name .git -prune -o -type f -print) +XMLS := $(filter %/text.xml,$(ALL_FILES)) +SVGS := $(filter %.svg,$(ALL_FILES)) HTMLS := $(subst text.xml,index.html,$(XMLS)) -ECLASS_HTMLS := $(wildcard eclass-reference/*/index.html) +ECLASS_HTMLS := $(filter ./eclass-reference/%/index.html,$(ALL_FILES)) IMAGES := $(patsubst %.svg,%.png,$(SVGS)) # Nonzero value disables external assets for offline browsing. OFFLINE = 0 -all: prereq validate build documents.js +all: prereq validate delete-old build documents.js prereq: @type rsvg-convert >/dev/null 2>&1 || \ @@ -70,7 +70,14 @@ tidy: $(HTMLS) $(ECLASS_HTMLS) test $${status} -eq 0 && echo "tidy validation successful"; \ exit $${status} -clean: - rm -f $(HTMLS) $(IMAGES) _documents.js documents.js +# Delete any orphaned html and image files that could be left over +# after the corresponding source file was moved or removed. +delete-old: + @-rm -f $(filter-out $(HTMLS) $(ECLASS_HTMLS) $(IMAGES), \ + $(filter %/index.html %.png,$(ALL_FILES))) + @find . ! -path './.git*' -type d -empty -delete -.PHONY: all prereq validate build tidy clean +clean: delete-old + @rm -f $(HTMLS) $(IMAGES) _documents.js documents.js + +.PHONY: all prereq validate build tidy delete-old clean