G

G Programming Language
git clone http://git.omkov.net/G
Log | Tree | Refs | README | Download

AuthorJakob Wakeling <[email protected]>
Date2023-12-23 21:43:26
Commit8250c82bf09c1600077ced7be4f549cf7e533c9f
Parent3c485fcedc4c3a106c6ebe5103abe4db86c2b2f2

Replace build scripts with a Makefile

Diffstat

M .gitignore | 1 -
D BuildUNIX.sh | 10 ----------
A Makefile | 16 ++++++++++++++++
M README.md | 2 +-
D TestUNIX.sh | 10 ----------

5 files changed, 17 insertions, 22 deletions

diff --git a/.gitignore b/.gitignore
index f563e5a..ed26822 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,4 +3,3 @@
 /bin/
 /build/
 /compile_commands.json
-/lib/
diff --git a/BuildUNIX.sh b/BuildUNIX.sh
deleted file mode 100755
index d59505f..0000000
--- a/BuildUNIX.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env sh
-dir="$(dirname $(realpath "$0"))"
-
-cmake -S "${dir}" -B "${dir}/build" \
-	-DCMAKE_BUILD_TYPE:STRING=Release \
-	-DCMAKE_EXPORT_COMPILE_COMMANDS=1
-
-cmake --build "${dir}/build"
-
-mv -f "${dir}/build/compile_commands.json" "${dir}/compile_commands.json"
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..2932c0c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,16 @@
+.PHONY: all build test help
+all: help
+
+build: ## Build the project
+	@cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=1
+	@cmake --build ./build
+	@mv -f ./build/compile_commands.json ./compile_commands.json
+
+test: ## Run unit tests
+	@cmake -S . -B ./build -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1
+	@cmake --build ./build
+	@(cd ./build && ctest)
+
+help: ## Display help information
+	@grep -E '^[a-zA-Z_-]+:.*?##.*$$' $(MAKEFILE_LIST) | \
+		awk 'BEGIN {FS = ":.*?## *"}; {printf "\033[36m%-6s\033[0m %s\n", $$1, $$2}'
diff --git a/README.md b/README.md
index 90b5072..5f8b5f8 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 # The G Programming Language
 
 A modern alternative to **C** intended to be simple, fast, and pleasant.
-Influenced by **C**, **Odin**, **Zig**, and others.
+Influenced by **C**, **Go**, **Odin**, **Zig**, and others.
 
 Note that at present, **G** is highly unstable and will certainly change.
 
diff --git a/TestUNIX.sh b/TestUNIX.sh
deleted file mode 100755
index 4602ba0..0000000
--- a/TestUNIX.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env sh
-dir="$(dirname $(realpath "$0"))"
-
-cmake -S "${dir}" -B "${dir}/build" \
-	-DCMAKE_BUILD_TYPE:STRING=Debug \
-	-DCMAKE_EXPORT_COMPILE_COMMANDS=1
-
-cmake --build "${dir}/build"
-
-(cd "${dir}/build"; ctest)