2022-02-20 19:29:04 +00:00
|
|
|
BUNDLE_NAME = bundle.lua
|
|
|
|
HAXE_NAME = haxe.lua
|
2022-02-21 01:44:38 +00:00
|
|
|
MINIFYD_NAME = bundle.min.lua
|
|
|
|
BUILD_DIR = build
|
2022-03-03 14:47:11 +00:00
|
|
|
HAXE_FLAGS =
|
2022-02-20 19:29:04 +00:00
|
|
|
POLYFILLED_NAME = bundle.polyfill.lua
|
|
|
|
POLYFILL_SRC = src/polyfill.lua
|
2023-04-08 01:43:23 +00:00
|
|
|
CREAFTOS_PATH = craftos
|
2022-02-19 20:48:34 +00:00
|
|
|
|
2022-02-20 19:29:04 +00:00
|
|
|
HAXE_PATH := $(BUILD_DIR)/$(HAXE_NAME)
|
2022-02-19 20:48:34 +00:00
|
|
|
MIN_PATH := $(BUILD_DIR)/$(MINIFYD_NAME)
|
2022-02-20 19:29:04 +00:00
|
|
|
POLYFILL_PATH := $(BUILD_DIR)/$(POLYFILLED_NAME)
|
2022-02-19 20:48:34 +00:00
|
|
|
|
2022-02-21 01:44:38 +00:00
|
|
|
all: clean build
|
2022-02-19 20:48:34 +00:00
|
|
|
|
2023-04-08 01:43:23 +00:00
|
|
|
build: HAXE_FLAGS += --main kernel.Entrypoint -D analyzer-optimize
|
2022-02-20 00:29:28 +00:00
|
|
|
build: $(MIN_PATH)
|
|
|
|
|
2023-04-08 01:43:23 +00:00
|
|
|
debug: HAXE_FLAGS += -D webconsole -D error_stack --debug
|
2022-03-03 14:47:11 +00:00
|
|
|
debug: build
|
|
|
|
|
2022-02-24 18:47:27 +00:00
|
|
|
$(HAXE_PATH): $(shell find src -name '*.hx')
|
2023-04-08 01:43:23 +00:00
|
|
|
haxe build.hxml $(HAXE_FLAGS)
|
2022-02-20 19:29:04 +00:00
|
|
|
|
|
|
|
$(POLYFILL_PATH): $(POLYFILL_SRC) $(HAXE_PATH)
|
|
|
|
cat $(POLYFILL_SRC) $(HAXE_PATH) > $@
|
2022-02-19 20:48:34 +00:00
|
|
|
|
2023-04-08 01:43:23 +00:00
|
|
|
$(MIN_PATH): $(POLYFILL_PATH)
|
|
|
|
node minify.js $(POLYFILL_PATH) $@
|
|
|
|
|
|
|
|
.PHONY: deps
|
|
|
|
deps:
|
2022-02-19 20:48:34 +00:00
|
|
|
haxelib install all --always && yarn install
|
|
|
|
|
2023-04-08 01:43:23 +00:00
|
|
|
.PHONY: clean
|
2022-02-19 20:48:34 +00:00
|
|
|
clean:
|
|
|
|
rm -rf $(BUILD_DIR)
|
2023-04-08 01:43:23 +00:00
|
|
|
mkdir $(BUILD_DIR)
|
2022-02-20 00:29:47 +00:00
|
|
|
|
2023-04-08 01:43:23 +00:00
|
|
|
.PHONY: watch
|
2022-02-20 00:29:47 +00:00
|
|
|
watch:
|
2022-03-03 14:47:11 +00:00
|
|
|
find src -name "*.hx" | entr make debug
|
2022-02-20 00:29:47 +00:00
|
|
|
|
2023-04-08 01:43:23 +00:00
|
|
|
.PHONY: emulator
|
2022-02-21 01:44:38 +00:00
|
|
|
emulator:
|
2023-04-08 01:43:23 +00:00
|
|
|
$(CREAFTOS_PATH) --mount-ro /=$(shell pwd)/$(BUILD_DIR)
|
2022-02-20 00:30:32 +00:00
|
|
|
|
2023-04-08 01:43:23 +00:00
|
|
|
.PHONY: webconsole
|
2022-02-20 00:30:32 +00:00
|
|
|
webconsole:
|
|
|
|
node console.js
|