aboutsummaryrefslogtreecommitdiff
path: root/go/Makefile
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2022-12-27 14:29:39 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:46:38 +0200
commitd6b5eeaa5e639c5ab89b5e1c93075a1b765794dc (patch)
treef87422bb91c2197f88aa8d29092592858764049d /go/Makefile
parent3c2ee4ee48480a28dc606878503f314ec8862d45 (diff)
downloadmuhqs-game-d6b5eeaa5e639c5ab89b5e1c93075a1b765794dc.tar.gz
muhqs-game-d6b5eeaa5e639c5ab89b5e1c93075a1b765794dc.zip
intermediate commit
Diffstat (limited to 'go/Makefile')
-rw-r--r--go/Makefile43
1 files changed, 43 insertions, 0 deletions
diff --git a/go/Makefile b/go/Makefile
new file mode 100644
index 00000000..88c32ebe
--- /dev/null
+++ b/go/Makefile
@@ -0,0 +1,43 @@
+PACKAGES := assets game server client ui
+
+APPS := server client
+OBJS := $(foreach app,$(APPS),$(app)/$(app))
+WASM := client/client.wasm webtools/webtools.wasm
+
+GOFMT := gofumpt -l -w .
+
+.PHONY: client server
+client: client/client
+server: server/server
+
+.PHONY: all fmt test check $(OBJS) $(WASM)
+all: $(OBJS) $(WASM)
+
+
+$(OBJS):
+ @echo Building $(@F)
+ @pushd $(@D) >/dev/null && go build && popd >/dev/null
+
+*/*.wasm:
+ @echo Building $(@F) ...
+ @pushd $(@D) >/dev/null && env GOOS=js GOARCH=wasm go build -o $(@F) && popd >/dev/null
+
+fmt:
+ @set -e; for package in $(PACKAGES) webtools; do \
+ pushd $$package >/dev/null && $(GOFMT); popd >/dev/null; \
+ done
+
+test:
+ @STATUS=0; \
+ for package in $(PACKAGES); do \
+ if pushd "$$package" >/dev/null; then \
+ go test; \
+ status="$$?"; \
+ if [ "$$status" -ne 0 ]; then STATUS="$$status"; fi; \
+ popd >/dev/null; \
+ fi; \
+ done; \
+ exit "$$STATUS"
+
+check:
+ golangci-lint run --skip-dirs webtools