cc-haxe/Makefile

90 lines
2.2 KiB
Makefile
Raw Normal View History

2022-02-20 20:29:04 +01:00
BUNDLE_NAME = bundle.lua
HAXE_NAME = haxe.lua
2022-02-21 02:44:38 +01:00
MINIFYD_NAME = bundle.min.lua
2024-04-16 11:05:28 +02: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 02:44:38 +01:00
BUILD_DIR = build
2024-08-17 00:48:53 +02:00
HAXE_FLAGS = -D message.reporting=pretty
2022-02-20 20:29:04 +01:00
POLYFILLED_NAME = bundle.polyfill.lua
POLYFILL_SRC = src/polyfill.lua
2023-04-08 03:43:23 +02:00
CREAFTOS_PATH = craftos
2024-04-16 11:05:28 +02:00
BUILD_HXML = build.hxml
2022-02-19 21:48:34 +01:00
2022-02-20 20:29:04 +01:00
HAXE_PATH := $(BUILD_DIR)/$(HAXE_NAME)
2022-02-19 21:48:34 +01:00
MIN_PATH := $(BUILD_DIR)/$(MINIFYD_NAME)
2022-02-20 20:29:04 +01:00
POLYFILL_PATH := $(BUILD_DIR)/$(POLYFILLED_NAME)
2024-04-16 11:05:28 +02: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 21:48:34 +01:00
2024-04-16 11:05:28 +02:00
all: clean build unpack
2022-02-19 21:48:34 +01:00
2024-08-17 00:55:52 +02:00
build: HAXE_FLAGS += -D analyzer-optimize -D no-traces
2022-02-20 01:29:28 +01:00
build: $(MIN_PATH)
2023-04-08 03:43:23 +02:00
debug: HAXE_FLAGS += -D webconsole -D error_stack --debug
2024-04-16 11:05:28 +02:00
debug: $(MIN_PATH)
2022-03-03 15:47:11 +01:00
2024-04-16 11:05:28 +02:00
unpack: $(UNPACK_MINIFYD_PATH) $(HAXE_ZIP_PATH)
$(HAXE_PATH): HAXE_FLAGS += --main kernel.Entrypoint --lua $(HAXE_PATH)
2022-02-24 19:47:27 +01:00
$(HAXE_PATH): $(shell find src -name '*.hx')
2024-04-16 11:05:28 +02:00
haxe $(BUILD_HXML) $(HAXE_FLAGS)
2022-02-20 20:29:04 +01:00
$(POLYFILL_PATH): $(POLYFILL_SRC) $(HAXE_PATH)
cat $(POLYFILL_SRC) $(HAXE_PATH) > $@
2022-02-19 21:48:34 +01:00
2023-04-08 03:43:23 +02:00
$(MIN_PATH): $(POLYFILL_PATH)
2024-04-16 11:05:28 +02: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 03:43:23 +02:00
.PHONY: deps
2023-06-30 15:34:51 +02:00
deps: deps-hx deps-node
.PHONY: deps-hx
deps-hx:
haxelib install all --always
.PHONY: deps-node
deps-node:
2024-08-13 00:13:24 +02:00
npm install
2022-02-19 21:48:34 +01:00
2023-04-08 03:43:23 +02:00
.PHONY: clean
2022-02-19 21:48:34 +01:00
clean:
rm -rf $(BUILD_DIR)
2023-04-08 03:43:23 +02:00
mkdir $(BUILD_DIR)
2022-02-20 01:29:47 +01:00
2023-04-08 03:43:23 +02:00
.PHONY: watch
2022-02-20 01:29:47 +01:00
watch:
2023-07-27 20:30:11 +02:00
find src | entr make debug
2022-02-20 01:29:47 +01:00
2023-04-08 03:43:23 +02:00
.PHONY: emulator
2022-02-21 02:44:38 +01:00
emulator:
2023-04-08 03:43:23 +02:00
$(CREAFTOS_PATH) --mount-ro /=$(shell pwd)/$(BUILD_DIR)
2022-02-20 01:30:32 +01:00
2023-04-08 03:43:23 +02:00
.PHONY: webconsole
2022-02-20 01:30:32 +01:00
webconsole:
2024-04-16 11:05:28 +02:00
node tools/console.js
2023-07-30 23:33:51 +02:00
.PHONY: format
format:
2024-03-12 21:44:51 +01:00
haxelib run formatter -s src
.PHONY: format-deps
format-deps:
haxelib install formatter