aboutsummaryrefslogtreecommitdiff
path: root/go/Makefile
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-08-19 15:32:17 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:40 +0200
commitedf89db6fc28931ca59f6c9acfd0a561d68145c7 (patch)
treefe2961223279d16f5d9952f2e9d4aa6d1a5fcf66 /go/Makefile
parent97a80cc2cf2a5b5a8334fc42f65863651516d4cf (diff)
downloadmuhqs-game-edf89db6fc28931ca59f6c9acfd0a561d68145c7.tar.gz
muhqs-game-edf89db6fc28931ca59f6c9acfd0a561d68145c7.zip
add discard2 icon and button to trigger the free action
Diffstat (limited to 'go/Makefile')
-rw-r--r--go/Makefile36
1 files changed, 26 insertions, 10 deletions
diff --git a/go/Makefile b/go/Makefile
index ced2e223..879cb8c0 100644
--- a/go/Makefile
+++ b/go/Makefile
@@ -1,7 +1,16 @@
-PACKAGES := activities assets client dummy-ui game log server
+# The full path to the Makefile
+MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
+# The path to the directory of the Makefile
+MAKEFILE_DIR := $(realpath $(dir $(MAKEFILE_PATH)))
+
+ASSETSROOT = $(MAKEFILE_DIR)/../assets/
+ASSETS = $(wildcard $(ASSETSROOT)/icons/*)
+ASSETSTOCOPY = $(addprefix assets/,$(ASSETS:$(ASSETSROOT)/%=copy/%))
SHELL := bash
+PACKAGES := activities assets client dummy-ui game log server
+
APPS := server client dummy-ui
OBJS := $(foreach app,$(APPS),$(app)/$(app))
WASM := client/client.wasm webtools/webtools.wasm dummy-ui/dummy-ui.wasm
@@ -21,21 +30,28 @@ client: client/client
server: server/server
dummy-ui: dummy-ui/dummy-ui
-$(OBJS):
- @echo Building $(@F)
- @pushd $(@D) >/dev/null && go build $(GO_BUILDTAGS) && popd >/dev/null
+VERBOSE ?= @
+
+assets/copy/%: $(ASSETSROOT)/%
+ $(VERBOSE)echo Copying asset $(@F)
+ $(VERBOSE)if test \( ! \( -d $(@D) \) \); then mkdir -p $(@D);fi
+ $(VERBOSE)cp $< $@
+
+$(OBJS): $(ASSETSTOCOPY)
+ $(VERBOSE)echo Building $(@F)
+ $(VERBOSE)pushd $(@D) >/dev/null && go build $(GO_BUILDTAGS) && popd >/dev/null
-$(WASM):
- @echo Building $(@F) ...
- @pushd $(@D) >/dev/null && env GOOS=js GOARCH=wasm go build $(GO_BUILDTAGS) -o $(@F) && popd >/dev/null
+$(WASM): $(ASSETSTOCOPY)
+ $(VERBOSE)echo Building $(@F) ...
+ $(VERBOSE)pushd $(@D) >/dev/null && env GOOS=js GOARCH=wasm go build $(GO_BUILDTAGS) -o $(@F) && popd >/dev/null
fmt:
- @set -e; for package in $(PACKAGES) webtools; do \
+ $(VERBOSE)set -e; for package in $(PACKAGES) webtools; do \
pushd $$package >/dev/null && $(GOFMT); popd >/dev/null; \
done
test:
- @STATUS=0; \
+ $(VERBOSE)STATUS=0; \
for package in $(PACKAGES); do \
if pushd "$$package" >/dev/null; then \
go test; \
@@ -47,7 +63,7 @@ test:
exit "$$STATUS"
check:
- @STATUS=0; \
+ $(VERBOSE)STATUS=0; \
for package in $(PACKAGES); do \
if pushd "$$package" >/dev/null; then \
golangci-lint run; \