Files
mr.zeroandClaude Opus 5 d2daa3f02a
ci/woodpecker/push/ebitengine Pipeline was successful
ci/woodpecker/manual/ebitengine Pipeline was successful
Consume the published inkwell module instead of a sibling checkout
inkwell is now released as engines/inkwell v0.1.0, so the `replace
=> ../inkwell` directive can go. That directive is why this pipeline
was failing: it requires a sibling working copy that only exists on a
developer's machine, never in a CI checkout.

Module paths follow the org move as well — this repo is demos/, inkwell
is engines/ — since Gitea's redirect does not apply to Go module paths.

GOPRIVATE is exported from the Makefile: our own modules are not on
proxy.golang.org and not in the public checksum database.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-16 10:35:01 +02:00

87 lines
2.9 KiB
Makefile
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -----------------------------------------
# Makefile Ebitengine project builder
# -----------------------------------------
PROJECT = inkwell-demo
# Our own modules live on the forge, not on proxy.golang.org: fetch them
# directly and skip the public checksum database.
export GOPRIVATE = git.teletypegames.org
BIN_DIR = bin
DIST_DIR = dist
WASM_NAME = game.wasm
OUTPUT_BIN = $(BIN_DIR)/$(PROJECT)
OUTPUT_WASM = $(DIST_DIR)/$(WASM_NAME)
OUTPUT_JS = $(DIST_DIR)/wasm_exec.js
OUTPUT_ZIP = $(PROJECT)-$(VERSION).html.zip
INDEX_HTML_URL = https://git.teletypegames.org/tools/ebitengine-tools/raw/branch/master/web/index.html
all: build
build:
@mkdir -p $(BIN_DIR)
go build -o $(OUTPUT_BIN) .
wasm:
@mkdir -p $(DIST_DIR)
GOOS=js GOARCH=wasm go build -o $(OUTPUT_WASM) .
cp "$$(go env GOROOT)/lib/wasm/wasm_exec.js" $(OUTPUT_JS)
export: wasm
@if [ -z "$(VERSION)" ]; then \
echo "ERROR: VERSION not set!"; exit 1; \
fi
@echo "==> Downloading index.html"
curl -sSL $(INDEX_HTML_URL) -o $(DIST_DIR)/index.html
@echo "==> Packaging HTML/WASM for $(VERSION)"
zip -r $(OUTPUT_ZIP) -j $(DIST_DIR)/$(WASM_NAME) $(DIST_DIR)/wasm_exec.js $(DIST_DIR)/index.html
@echo "==> Cleaning temporary files"
rm -f $(DIST_DIR)/$(WASM_NAME) $(DIST_DIR)/wasm_exec.js $(DIST_DIR)/index.html
# --- native binaries (lásd: teletypegames/NOTES_BINARY_PLAN.md) -------------
# win-x86 / win-x64: pure Go cross-compile (Windowson nem kell cgo)
# linux-x64: cgo build, linux/amd64 hoston fut (builder image, X11/GL dev libekkel)
BINARY_TARGETS = win-x86 win-x64 linux-x64
binaries:
@if [ -z "$(VERSION)" ]; then \
echo "ERROR: VERSION not set!"; exit 1; \
fi
@for target in $(BINARY_TARGETS); do \
$(MAKE) binary-$$target VERSION=$(VERSION) || exit 1; \
done
binary-win-x86:
@$(MAKE) binary-build VERSION=$(VERSION) B_GOOS=windows B_GOARCH=386 B_CGO=0 B_EXT=.exe B_TARGET=win-x86
binary-win-x64:
@$(MAKE) binary-build VERSION=$(VERSION) B_GOOS=windows B_GOARCH=amd64 B_CGO=0 B_EXT=.exe B_TARGET=win-x64
binary-linux-x64:
@$(MAKE) binary-build VERSION=$(VERSION) B_GOOS=linux B_GOARCH=amd64 B_CGO=1 B_EXT= B_TARGET=linux-x64
# belső helper: egy target buildje + zip egyetlen gyökérmappával
# (a zipet unixos zip készíti, így a végrehajtási bit megmarad)
binary-build:
@set -e; \
PKG_DIR="$(PROJECT)-$(VERSION)-$(B_TARGET)"; \
echo "==> Building $$PKG_DIR"; \
rm -rf "$$PKG_DIR" "$$PKG_DIR.zip"; \
mkdir -p "$$PKG_DIR"; \
CGO_ENABLED=$(B_CGO) GOOS=$(B_GOOS) GOARCH=$(B_GOARCH) go build -o "$$PKG_DIR/$(PROJECT)$(B_EXT)" .; \
if [ -f LICENSE ]; then cp LICENSE "$$PKG_DIR/"; fi; \
if [ -f README.md ]; then cp README.md "$$PKG_DIR/"; fi; \
zip -r "$$PKG_DIR.zip" "$$PKG_DIR" >/dev/null; \
rm -rf "$$PKG_DIR"; \
echo "==> $$PKG_DIR.zip kesz"
watch:
fswatch -o . | while read; do make build; done
clean:
rm -rf $(BIN_DIR) $(DIST_DIR)
.PHONY: all build wasm export watch clean binaries binary-win-x86 binary-win-x64 binary-linux-x64 binary-build