aboutsummaryrefslogtreecommitdiff
path: root/builds/toplevel.mk
diff options
context:
space:
mode:
Diffstat (limited to 'builds/toplevel.mk')
-rw-r--r--builds/toplevel.mk33
1 files changed, 14 insertions, 19 deletions
diff --git a/builds/toplevel.mk b/builds/toplevel.mk
index a0e0c8787..8d5063ebb 100644
--- a/builds/toplevel.mk
+++ b/builds/toplevel.mk
@@ -198,27 +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 \#define|FREETYPE_MAJOR|,$(space),$(work))
-work := $(word 2,$(work))
-major := $(subst |,$(space),$(work))
-major := $(firstword $(major))
-
-work := $(subst \#define|FREETYPE_MINOR|,$(space),$(work))
-work := $(word 2,$(work))
-minor := $(subst |,$(space),$(work))
-minor := $(firstword $(minor))
-
-work := $(subst \#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)
@@ -317,6 +312,6 @@ do-dist: distclean refdoc
rm -f $(TOP_DIR)/docs/mkdocs.yml
@# Remove more stuff related to git.
- rm -rf (TOP_DIR)/subprojects/dlg
+ rm -rf $(TOP_DIR)/subprojects/dlg
# EOF