]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(Makefile): reduce the number of shell invocations
authorJóhann B. Guðmundsson <johannbg@gmail.com>
Thu, 2 Jun 2022 12:31:50 +0000 (12:31 +0000)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Tue, 21 Jun 2022 05:40:09 +0000 (05:40 +0000)
Makefile uses recursively expanded macros and as can be seen by simply
adding $(warning Call to shell) in front of $(shell ...) Foo's in the
Makefile, we are calling out to shell 9 times just to get the working
directory, a working directory which doesn't change during Make!

Let's save few pony's and reduce it to 2...

Makefile

index 97e189b4641d341783c2dafc8552e9ce08edc8ed..4bf96036d95491f20cd05830be5cf14caf6b546b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
 -include dracut-version.sh
 
-DRACUT_MAIN_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CURDIR)/.. git describe --abbrev=0 --tags --always 2>/dev/null || :)
+DRACUT_MAIN_VERSION := $(shell env GIT_CEILING_DIRECTORIES=$(CURDIR)/.. git describe --abbrev=0 --tags --always 2>/dev/null || :)
 ifeq ($(DRACUT_MAIN_VERSION),)
 DRACUT_MAIN_VERSION = $(DRACUT_VERSION)
 endif
-DRACUT_FULL_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CURDIR)/.. git describe --tags --always 2>/dev/null || :)
+DRACUT_FULL_VERSION := $(shell env GIT_CEILING_DIRECTORIES=$(CURDIR)/.. git describe --tags --always 2>/dev/null || :)
 ifeq ($(DRACUT_FULL_VERSION),)
 DRACUT_FULL_VERSION = $(DRACUT_VERSION)
 endif