From d6b5eeaa5e639c5ab89b5e1c93075a1b765794dc Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Tue, 27 Dec 2022 14:29:39 +0100 Subject: intermediate commit --- go/Makefile | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 go/Makefile (limited to 'go/Makefile') 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 -- cgit v1.2.3