From 1515712e093137fe9642c7f1e2ebc0fc71119740 Mon Sep 17 00:00:00 2001 Message-Id: <1515712e093137fe9642c7f1e2ebc0fc71119740.1680454654.git.yantar92@posteo.net> In-Reply-To: References: From: Ihor Radchenko Date: Sun, 2 Apr 2023 13:53:47 +0200 Subject: [PATCH 4/6] 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.39.1