freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] ver_extract a1898ffb4: * builds/toplevel.mk: Simplify the ve


From: Werner Lemberg
Subject: [freetype2] ver_extract a1898ffb4: * builds/toplevel.mk: Simplify the version extraction.
Date: Wed, 23 Aug 2023 11:11:07 -0400 (EDT)

branch: ver_extract
commit a1898ffb422397b3eaf086ea29d66e577313d950
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>

    * builds/toplevel.mk: Simplify the version extraction.
---
 builds/toplevel.mk | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/builds/toplevel.mk b/builds/toplevel.mk
index 7530be753..c8c9103fa 100644
--- a/builds/toplevel.mk
+++ b/builds/toplevel.mk
@@ -198,29 +198,22 @@ modules:
 include $(TOP_DIR)/builds/modules.mk
 
 
-# get FreeType version string, using a
-# poor man's `sed' emulation with make's built-in string functions
+# get FreeType version string using built-in string functions
 #
 hash := \#
 
 work := $(strip $(shell $(CAT) \
                   $(subst /,$(SEP),$(TOP_DIR)/include/freetype/freetype.h)))
-work := $(subst |,x,$(work))
-work := $(subst $(space),|,$(work))
-work := $(subst $(hash)define|FREETYPE_MAJOR|,$(space),$(work))
-work := $(word 2,$(work))
-major := $(subst |,$(space),$(work))
-major := $(firstword $(major))
-
-work := $(subst $(hash)define|FREETYPE_MINOR|,$(space),$(work))
-work := $(word 2,$(work))
-minor := $(subst |,$(space),$(work))
-minor := $(firstword $(minor))
-
-work := $(subst $(hash)define|FREETYPE_PATCH|,$(space),$(work))
-work := $(word 2,$(work))
-patch := $(subst |,$(space),$(work))
-patch := $(firstword $(patch))
+
+work := $(subst $(hash)define$(space)FREETYPE_MAJOR$(space),MAJOR=,$(work))
+work := $(subst $(hash)define$(space)FREETYPE_MINOR$(space),MINOR=,$(work))
+work := $(subst $(hash)define$(space)FREETYPE_PATCH$(space),PATCH=,$(work))
+
+major := $(subst MAJOR=,,$(filter MAJOR=%,$(work)))
+minor := $(subst MINOR=,,$(filter MINOR=%,$(work)))
+patch := $(subst PATCH=,,$(filter PATCH=%,$(work)))
+
+work :=
 
 # ifneq ($(findstring x0x,x$(patch)x),)
 #   version := $(major).$(minor)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]