cc-haxe/Makefile
2023-04-08 03:43:23 +02:00

51 lines
1.0 KiB
Makefile

BUNDLE_NAME = bundle.lua
HAXE_NAME = haxe.lua
MINIFYD_NAME = bundle.min.lua
BUILD_DIR = build
HAXE_FLAGS =
POLYFILLED_NAME = bundle.polyfill.lua
POLYFILL_SRC = src/polyfill.lua
CREAFTOS_PATH = craftos
HAXE_PATH := $(BUILD_DIR)/$(HAXE_NAME)
MIN_PATH := $(BUILD_DIR)/$(MINIFYD_NAME)
POLYFILL_PATH := $(BUILD_DIR)/$(POLYFILLED_NAME)
all: clean build
build: HAXE_FLAGS += --main kernel.Entrypoint -D analyzer-optimize
build: $(MIN_PATH)
debug: HAXE_FLAGS += -D webconsole -D error_stack --debug
debug: build
$(HAXE_PATH): $(shell find src -name '*.hx')
haxe build.hxml $(HAXE_FLAGS)
$(POLYFILL_PATH): $(POLYFILL_SRC) $(HAXE_PATH)
cat $(POLYFILL_SRC) $(HAXE_PATH) > $@
$(MIN_PATH): $(POLYFILL_PATH)
node minify.js $(POLYFILL_PATH) $@
.PHONY: deps
deps:
haxelib install all --always && yarn install
.PHONY: clean
clean:
rm -rf $(BUILD_DIR)
mkdir $(BUILD_DIR)
.PHONY: watch
watch:
find src -name "*.hx" | entr make debug
.PHONY: emulator
emulator:
$(CREAFTOS_PATH) --mount-ro /=$(shell pwd)/$(BUILD_DIR)
.PHONY: webconsole
webconsole:
node console.js