aboutsummaryrefslogtreecommitdiff
path: root/xS
diff options
context:
space:
mode:
Diffstat (limited to 'xS')
-rw-r--r--xS/Makefile8
-rw-r--r--xS/xS-gen-version.awk14
-rw-r--r--xS/xS.go8
3 files changed, 22 insertions, 8 deletions
diff --git a/xS/Makefile b/xS/Makefile
index 55ad4d2..f0f662d 100644
--- a/xS/Makefile
+++ b/xS/Makefile
@@ -2,11 +2,15 @@
.SUFFIXES:
AWK = env LC_ALL=C awk
-outputs = xS xS-replies.go
+outputs = xS xS-version.go xS-replies.go
all: $(outputs)
-xS: xS.go xS-replies.go
+xS: xS.go xS-version.go xS-replies.go
go build -o $@
+xS-version.go: ../liberty/tools/cmake-parser.awk \
+ xS-gen-version.awk ../CMakeLists.txt
+ $(AWK) -f ../liberty/tools/cmake-parser.awk \
+ -f xS-gen-version.awk ../CMakeLists.txt > $@
xS-replies.go: xS-gen-replies.awk xS-replies
$(AWK) -f xS-gen-replies.awk xS-replies > $@
clean:
diff --git a/xS/xS-gen-version.awk b/xS/xS-gen-version.awk
new file mode 100644
index 0000000..1312a63
--- /dev/null
+++ b/xS/xS-gen-version.awk
@@ -0,0 +1,14 @@
+# xS-gen-version.awk: extract version information from the CMake script
+#
+# Copyright (c) 2022, Přemysl Eric Janouch <p@janouch.name>
+# SPDX-License-Identifier: 0BSD
+
+Command == "project" {
+ for (i = 2; i in Args; i++)
+ if (Args[i] == "VERSION") {
+ print "package main"
+ print ""
+ print "const projectVersion = `" Args[++i] "`"
+ exit
+ }
+}
diff --git a/xS/xS.go b/xS/xS.go
index e6c3b3c..feefb5c 100644
--- a/xS/xS.go
+++ b/xS/xS.go
@@ -40,13 +40,9 @@ import (
"time"
)
-var debugMode = false
+const projectName = "xS"
-const (
- projectName = "xS"
- // TODO: Consider using the same version number for all subprojects.
- projectVersion = "0"
-)
+var debugMode = false
// --- Logging -----------------------------------------------------------------