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: deps-hx deps-node .PHONY: deps-hx deps-hx: haxelib install all --always .PHONY: deps-node deps-node: yarn install .PHONY: clean clean: rm -rf $(BUILD_DIR) mkdir $(BUILD_DIR) .PHONY: watch watch: find src | entr make debug .PHONY: emulator emulator: $(CREAFTOS_PATH) --mount-ro /=$(shell pwd)/$(BUILD_DIR) .PHONY: webconsole webconsole: node console.js