From 5bb17634a14bb1af4944f73465552cbfd7068a77 Mon Sep 17 00:00:00 2001 Message-Id: <5bb17634a14bb1af4944f73465552cbfd7068a77.1680511419.git.yantar92@posteo.net> In-Reply-To: <313f2b6acdf67f29f4f5f671e8278bb3e566cabf.1680511418.git.yantar92@posteo.net> References: <313f2b6acdf67f29f4f5f671e8278bb3e566cabf.1680511418.git.yantar92@posteo.net> From: Ihor Radchenko Date: Sun, 2 Apr 2023 13:53:47 +0200 Subject: [PATCH 5/7] mk: Expand shell commands once only * mk/default.mk (pkgdir): * mk/targets.mk (GITVERSION): (GITSTATUS): (DATE): (YEAR): Only expand the variables once, not in every make sub-process. Previous code ran pwd/date/git in every make sub-process, slowing things down significantly and unnecessarily. --- mk/default.mk | 2 +- mk/targets.mk | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mk/default.mk b/mk/default.mk index 4ad1a4281..b43a9b3ac 100644 --- a/mk/default.mk +++ b/mk/default.mk @@ -32,7 +32,7 @@ TMPDIR ?= /tmp testdir = $(TMPDIR)/tmp-orgtest # Where to store Org dependencies -pkgdir = $(shell pwd)/pkg-deps +pkgdir := $(shell pwd)/pkg-deps # Extra flags to be passed to Emacs EFLAGS ?= diff --git a/mk/targets.mk b/mk/targets.mk index ab8b830bb..18faa02f5 100644 --- a/mk/targets.mk +++ b/mk/targets.mk @@ -14,15 +14,15 @@ ifneq ($(wildcard .git),) # Use the org.el header. ORGVERSION := $(patsubst %-dev,%,$(shell $(BATCH) --eval "(require 'lisp-mnt)" \ --visit lisp/org.el --eval '(princ (lm-header "version"))')) - GITVERSION ?= $(shell git describe --match release\* --abbrev=6 HEAD 2>/dev/null || echo "release_N/A-N/A-$(shell git describe --match release\* --abbrev=6 --always HEAD)") - GITSTATUS ?= $(shell git status -uno --porcelain) + GITVERSION := $(shell git describe --match release\* --abbrev=6 HEAD 2>/dev/null || echo "release_N/A-N/A-$(shell git describe --match release\* --abbrev=6 --always HEAD)") + GITSTATUS := $(shell git status -uno --porcelain) else -include mk/version.mk GITVERSION ?= N/A ORGVERSION ?= N/A endif -DATE = $(shell date +%Y-%m-%d) -YEAR = $(shell date +%Y) +DATE := $(shell date +%Y-%m-%d) +YEAR := $(shell date +%Y) ifneq ($(GITSTATUS),) GITVERSION := $(GITVERSION:.dirty=).dirty endif -- 2.40.0