cc-haxe/Makefile

90 lines
2.2 KiB
Makefile
Raw Normal View History

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
2024-04-16 09:05:28 +00:00
HAXE_ZIP_NAME = "haxe.zip"
UNPACK_NAME = unpack.lua
UNPACK_POLYFILLED_NAME = unpack.polyfill.lua
UNPACK_MINIFYD_NAME = unpack.min.lua
2022-02-21 01:44:38 +00:00
BUILD_DIR = build
2024-08-16 22:48:53 +00:00
HAXE_FLAGS = -D message.reporting=pretty
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
2024-04-16 09:05:28 +00:00
BUILD_HXML = build.hxml
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)
2024-04-16 09:05:28 +00:00
UNPACK_PATH := $(BUILD_DIR)/$(UNPACK_NAME)
UNPACK_MINIFYD_PATH := $(BUILD_DIR)/$(UNPACK_MINIFYD_NAME)
HAXE_ZIP_PATH := $(BUILD_DIR)/$(HAXE_ZIP_NAME)
UNPACK_POLYFILLED_PATH := $(BUILD_DIR)/$(UNPACK_POLYFILLED_NAME)
2022-02-19 20:48:34 +00:00
2024-04-16 09:05:28 +00:00
all: clean build unpack
2022-02-19 20:48:34 +00:00
2024-08-16 22:55:52 +00:00
build: HAXE_FLAGS += -D analyzer-optimize -D no-traces
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
2024-04-16 09:05:28 +00:00
debug: $(MIN_PATH)
2022-03-03 14:47:11 +00:00
2024-04-16 09:05:28 +00:00
unpack: $(UNPACK_MINIFYD_PATH) $(HAXE_ZIP_PATH)
$(HAXE_PATH): HAXE_FLAGS += --main kernel.Entrypoint --lua $(HAXE_PATH)
2022-02-24 18:47:27 +00:00
$(HAXE_PATH): $(shell find src -name '*.hx')
2024-04-16 09:05:28 +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)
2024-04-16 09:05:28 +00:00
node tools/minify.js < $(POLYFILL_PATH) > $@
$(HAXE_ZIP_PATH): $(MIN_PATH)
node tools/zlibDeflate.js < $(MIN_PATH) > $@
$(UNPACK_PATH): HAXE_FLAGS += --main Unpack -D analyzer-optimize --lua $(UNPACK_PATH)
$(UNPACK_PATH): $(shell find src -name '*.hx')
haxe $(BUILD_HXML) $(HAXE_FLAGS)
$(UNPACK_POLYFILLED_PATH): $(UNPACK_PATH)
cat $(POLYFILL_SRC) $(UNPACK_PATH) > $@
$(UNPACK_MINIFYD_PATH): $(UNPACK_POLYFILLED_PATH)
node tools/minify.js < $(UNPACK_POLYFILLED_PATH) > $@
2023-04-08 01:43:23 +00:00
.PHONY: deps
2023-06-30 13:34:51 +00:00
deps: deps-hx deps-node
.PHONY: deps-hx
deps-hx:
haxelib install all --always
.PHONY: deps-node
deps-node:
2024-08-12 22:13:24 +00:00
npm install
2022-02-19 20:48:34 +00:00
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:
2023-07-27 18:30:11 +00:00
find src | 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:
2024-04-16 09:05:28 +00:00
node tools/console.js
2023-07-30 21:33:51 +00:00
.PHONY: format
format:
2024-03-12 20:44:51 +00:00
haxelib run formatter -s src
.PHONY: format-deps
format-deps:
haxelib install formatter