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 = HAXE_FLAGS =
POLYFILLED_NAME = bundle.polyfill.lua POLYFILLED_NAME = bundle.polyfill.lua
POLYFILL_SRC = src/polyfill.lua POLYFILL_SRC = src/polyfill.lua
CREAFTOS_PATH = craftos
HAXE_PATH := $(BUILD_DIR)/$(HAXE_NAME) HAXE_PATH := $(BUILD_DIR)/$(HAXE_NAME)
MIN_PATH := $(BUILD_DIR)/$(MINIFYD_NAME) MIN_PATH := $(BUILD_DIR)/$(MINIFYD_NAME)
@ -12,31 +13,38 @@ POLYFILL_PATH := $(BUILD_DIR)/$(POLYFILLED_NAME)
all: clean build all: clean build
build: HAXE_FLAGS += --main kernel.Entrypoint -D analyzer-optimize
build: $(MIN_PATH) build: $(MIN_PATH)
debug: HAXE_FLAGS += -D webconsole -D error_stack --debug debug: HAXE_FLAGS += -D webconsole -D error_stack --debug
debug: build debug: build
$(HAXE_PATH): $(shell find src -name '*.hx') $(HAXE_PATH): $(shell find src -name '*.hx')
haxe build.hxml $(HAXE_FLAGS) --cmd "mv build/_haxe.lua $(HAXE_PATH)" haxe build.hxml $(HAXE_FLAGS)
$(MIN_PATH): $(POLYFILL_PATH)
node minify.js $(POLYFILL_PATH) $@
$(POLYFILL_PATH): $(POLYFILL_SRC) $(HAXE_PATH) $(POLYFILL_PATH): $(POLYFILL_SRC) $(HAXE_PATH)
cat $(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 haxelib install all --always && yarn install
.PHONY: clean
clean: clean:
rm -rf $(BUILD_DIR) rm -rf $(BUILD_DIR)
mkdir $(BUILD_DIR)
.PHONY: watch
watch: watch:
find src -name "*.hx" | entr make debug find src -name "*.hx" | entr make debug
.PHONY: emulator
emulator: emulator:
craftos --mount-ro /=build $(CREAFTOS_PATH) --mount-ro /=$(shell pwd)/$(BUILD_DIR)
.PHONY: webconsole
webconsole: webconsole:
node console.js node console.js

View File

@ -1,5 +1,4 @@
-p src -p src
--main kernel.Entrypoint
--library cctweaked:git:https://git.kapelle.org/niklas/cctweaked-haxelib.git --library cctweaked:git:https://git.kapelle.org/niklas/cctweaked-haxelib.git
--library tink_core --library tink_core
@ -9,4 +8,4 @@
-D lua-vanilla -D lua-vanilla
-D lua-ver 5.1 -D lua-ver 5.1
--lua build/_haxe.lua --lua build/haxe.lua