From 05acfe81810fd9965c91723dc283bcf737a3dc8e Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philip.kaludercic@fau.de>
Date: Wed, 17 Jan 2024 16:58:13 +0100
Subject: [PATCH] Allow translating .q files in parallel

Trick taken from https://github.com/jqlang/jq/issues/805
---
 .gitignore |  3 +--
 Makefile   | 10 +++++++---
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/.gitignore b/.gitignore
index 91d763f..02c15e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,2 @@
 *~
-sp.q
-sp.json
+*.json
diff --git a/Makefile b/Makefile
index 0f5f9c8..1ba6c7a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,15 @@
 QFILES != find . -name '[ws]s[[:digit:]][[:digit:]].q' -type f
+JFILES := $(QFILES:%.q=%.json)
 
 .PHONY: all
 all: sp.json
 
-sp.json: $(QFILES)
-	./gen.pl $^ > $@
+$(JFILES): %.json: %.q
+	./gen.pl $< > $@
+
+sp.json: $(JFILES)
+	jq -cs '[.[][]]' $^ > $@
 
 .PHONY: clean
 clean:
-	rm -f sp.json
+	rm -f sp.json $(JFILES)
-- 
GitLab