Files
ebitengine-tools/example-makefile.make
2026-01-30 01:14:41 +01:00

61 lines
1.7 KiB
Makefile
Raw 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 = ebitenginedemo
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
VERSION_FILE = .version
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 "==> Packaging HTML/WASM for $(VERSION)"
cp web/index.html $(DIST_DIR)/index.html
zip -r $(OUTPUT_ZIP) -j $(DIST_DIR)/$(WASM_NAME) $(DIST_DIR)/wasm_exec.js $(DIST_DIR)/index.html
rm -f $(DIST_DIR)/$(WASM_NAME) $(DIST_DIR)/wasm_exec.js $(DIST_DIR)/index.html
watch:
fswatch -o . | while read; do make build; done
clean:
rm -rf $(BIN_DIR) $(DIST_DIR)
ci-version:
@VERSION=$$(git describe --tags --dirty --always); \
echo $$VERSION > $(VERSION_FILE)
ci-export:
@VERSION=$$(cat $(VERSION_FILE)); \
$(MAKE) export VERSION=$$VERSION
ci-upload:
@VERSION=$$(cat $(VERSION_FILE)); \
FILE=$(OUTPUT_ZIP); \
sshpass -p "$(DROPAREA_SSH_PASSWORD)" scp -o StrictHostKeyChecking=no -P $(DROPAREA_PORT) \
$$FILE $(DROPAREA_USER)@$(DROPAREA_HOST):$(DROPAREA_TARGET_PATH)/
ci-update:
@VERSION=$$(cat $(VERSION_FILE)); \
curl "$(UPDATE_SERVER)/update?secret=$(UPDATE_SECRET)&name=$(PROJECT)&platform=web&version=$$VERSION"
.PHONY: all build wasm export watch clean ci-version ci-export ci-upload ci-update