summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------liberty0
-rw-r--r--xC-gen-proto.awk4
-rw-r--r--xS/Makefile8
-rw-r--r--xS/xS-gen-version.awk14
-rw-r--r--xS/xS.go8
5 files changed, 24 insertions, 10 deletions
diff --git a/liberty b/liberty
-Subproject 34460ca715b295cc73c3f2bba4156c7f072ce12
+Subproject af2756ee01fa6b1921c6bcb581817e64c30beb4
diff --git a/xC-gen-proto.awk b/xC-gen-proto.awk
index ad375af..9b65a74 100644
--- a/xC-gen-proto.awk
+++ b/xC-gen-proto.awk
@@ -100,12 +100,12 @@ function nexttoken() {
Token = substr($0, 1, RLENGTH)
$0 = substr($0, RLENGTH + 1)
return Token
- } else if (/./) {
+ } else if ($0) {
Token = substr($0, 1, 1)
$0 = substr($0, 2)
return Token
}
- } while (/./ || getline > 0)
+ } while ($0 || getline > 0)
Token = ""
return Token
}
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 -----------------------------------------------------------------