From 0812b43bb857fcce7a328828aac6ccc03d9b753f Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Sat, 19 Feb 2022 21:48:34 +0100 Subject: [PATCH] added makefile --- Makefile | 20 ++++++++++++++++++++ build.hxml | 2 +- minify.js | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..80f0e5d --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +BIN_NAME := Haxe.lua +MINIFYD_NAME := Haxe.min.lua +BUILD_DIR := build + +BIN_PATH := $(BUILD_DIR)/$(BIN_NAME) +MIN_PATH := $(BUILD_DIR)/$(MINIFYD_NAME) + +all: clean $(MIN_PATH) + +$(BIN_PATH): $(shell find src -name '*.hx') + haxe build.hxml --lua $@ + +$(MIN_PATH): $(BIN_PATH) + node minify.js $@ + +deps: package.json build.hxml + haxelib install all --always && yarn install + +clean: + rm -rf $(BUILD_DIR) diff --git a/build.hxml b/build.hxml index 31ac015..01bb01b 100644 --- a/build.hxml +++ b/build.hxml @@ -5,5 +5,5 @@ --dce full ---lua build/Haxe.lua +# --lua build/Haxe.lua -D lua-vanilla diff --git a/minify.js b/minify.js index 9d846d2..f8a92d9 100644 --- a/minify.js +++ b/minify.js @@ -5,6 +5,6 @@ const haxeOutput = fs.readFileSync("build/Haxe.lua",{encoding:"utf8"}); const minified = luamin.minify(haxeOutput); -fs.writeFileSync("build/Haxe.min.lua",minified); +fs.writeFileSync(process.argv[2] ?? "build/Haxe.min.lua",minified); console.log("minified lua");