-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
64 lines (54 loc) · 1.95 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Declare variables
PYTHON = python
NUITKA = -m nuitka3
PRODUCT_NAME = "Moxmoe Repacker"
PROGRAM_NAME = "moxmoe-repacker"
WORK_DIR = ./
BUILD_DIR = ./build
BUILD_SYS ?= "poetry"
ICON_DIR = ./favicon.ico
FLAGS = --show-scons --show-memory --show-progress --onefile --nofollow-imports --follow-import-to=moe_utils --output-filename=$(PROGRAM_NAME) --output-dir=$(BUILD_DIR) --enable-plugin="upx"
MAIN_SCRIPT = ./main.py
# Check System Environment
ifeq ($(OS), Windows_NT)
SHELL := pwsh.exe
.SHELLFLAGS := -NoProfile -WorkingDirectory $(WORK_DIR) -Command
else
SHELL := /bin/sh
endif
# Define Banner
VERSION := $(cat .version)
define ANNOUNCE_BODY
__ __ ____ _
| \/ | _____ ___ __ ___ ___ ___| _ \ ___ _ __ __ _ ___| | _____ _ __
| |\/| |/ _ \ \/ / '_ ` _ \ / _ \ / _ \ |_) / _ \ '_ \ / _` |/ __| |/ / _ \ '__|
| | | | (_) > <| | | | | | (_) | __/ _ < __/ |_) | (_| | (__| < __/ |
|_| |_|\___/_/\_\_| |_| |_|\___/ \___|_| \_\___| .__/ \__,_|\___|_|\_\___|_|
|_|
Moxmoe Repacker Makefile $(VERSION)
================================================================
endef
export ANNOUNCE_BODY
# Declare phony targets
.PHONY: help build clean
help: ## Show this help message
ifeq ($(OS), Windows_NT)
@./make.ps1 help
else
@echo "$$ANNOUNCE_BODY"
@printf "\033[36m%-30s %s\033[0m\n" "help" "Show this help message."
@printf "\033[36m%-30s %s\033[0m\n" "build [BUILD_SYS=poetry, pixi]" "Build python project to one-file executable."
@printf "\033[36m%-30s %s\033[0m\n" "clean" "Clean build directory."
endif
build: ## Build python project to one-file executable
ifeq ($(OS), Windows_NT)
@./make.ps1 build -e $(BUILD_SYS)
else
$(BUILD_SYS) run $(PYTHON) $(NUITKA) $(FLAGS) $(MAIN_SCRIPT)
endif
clean: ## Clean build directory
ifeq ($(OS), Windows_NT)
./make.ps1 clean
else
@rm -rf $(BUILD_DIR)/*
endif