]> git.g-eek.se Git - guitarsections.git/commitdiff
[tools] Create makefiles for installation and testing
authorGustav Eek <gustav.eek@fripost.org>
Tue, 20 Aug 2024 07:30:45 +0000 (09:30 +0200)
committerGustav Eek <gustav.eek@fripost.org>
Thu, 22 Aug 2024 21:42:56 +0000 (23:42 +0200)
tools/Makefile [new file with mode: 0644]
tools/tests/Makefile [new file with mode: 0644]

diff --git a/tools/Makefile b/tools/Makefile
new file mode 100644 (file)
index 0000000..0bd8595
--- /dev/null
@@ -0,0 +1,46 @@
+SRC = a2cho cho2tex
+TRG = $(HOME)/.local/bin
+
+.PHONY: all install uninstall test clean
+
+all:
+
+# Installation
+
+install: $(SRC)
+       /usr/bin/install -m 755 -t "$(TRG)" $^
+
+uninstall:
+       /usr/bin/rm -f $(addprefix $(TRG)/, $(SRC))
+       /usr/bin/rmdir --ignore-fail-on-non-empty $(TRG)
+
+# Tests
+
+ifdef XDG_RUNTIME_DIR
+  RUN = $(XDG_RUNTIME_DIR)
+else
+  RUN = /tmp
+endif
+
+TXT = $(notdir $(basename $(wildcard tests/*.txt)))
+CHO = $(notdir $(basename $(wildcard tests/*.cho)))
+
+print:
+       echo $(RUN)
+       echo $(TXT)
+       echo $(join $(TXT), $(CHO))
+
+
+test:
+       sts=0; \
+       for f in $(TXT); do \
+         echo a2cho: $$f ; \
+         bash a2cho < tests/$$f.txt > $(RUN)/$$f.cho; \
+         diff tests/$$f.cho $(RUN)/$$f.cho; \
+         sts=$$(( $$sts + $$? )); \
+       done; \
+       exit $$sts
+
+# Cleaning
+
+clean:
diff --git a/tools/tests/Makefile b/tools/tests/Makefile
new file mode 100644 (file)
index 0000000..e69de29