diff --git a/Makefile b/Makefile index dba5931..869241b 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ 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) @@ -12,31 +13,38 @@ 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: HAXE_FLAGS += -D webconsole -D error_stack --debug debug: build $(HAXE_PATH): $(shell find src -name '*.hx') - haxe build.hxml $(HAXE_FLAGS) --cmd "mv build/_haxe.lua $(HAXE_PATH)" - -$(MIN_PATH): $(POLYFILL_PATH) - node minify.js $(POLYFILL_PATH) $@ + haxe build.hxml $(HAXE_FLAGS) $(POLYFILL_PATH): $(POLYFILL_SRC) $(HAXE_PATH) cat $(POLYFILL_SRC) $(HAXE_PATH) > $@ -deps: package.json build.hxml +$(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: - craftos --mount-ro /=build + $(CREAFTOS_PATH) --mount-ro /=$(shell pwd)/$(BUILD_DIR) +.PHONY: webconsole webconsole: node console.js diff --git a/build.hxml b/build.hxml index 76081b0..37538a4 100644 --- a/build.hxml +++ b/build.hxml @@ -1,5 +1,4 @@ -p src ---main kernel.Entrypoint --library cctweaked:git:https://git.kapelle.org/niklas/cctweaked-haxelib.git --library tink_core @@ -9,4 +8,4 @@ -D lua-vanilla -D lua-ver 5.1 ---lua build/_haxe.lua +--lua build/haxe.lua