improved makefile

This commit is contained in:
Djeeberjr 2023-04-08 03:43:23 +02:00
parent a1fdca689f
commit 0c5775560c
2 changed files with 16 additions and 9 deletions

View File

@ -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

View File

@ -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