📝 docs:更新README文档,添加Makefile使用说明和UPX压缩说明 🔧 chore:添加Makefile简化构建流程,支持自动UPX压缩 🔧 chore:添加cabal.project.local配置文件优化构建 ⬆️ chore:升级项目版本至0.3.0.2 🔧 chore:优化GHC编译选项,启用优化和链接器优化
41 lines
1.1 KiB
Makefile
41 lines
1.1 KiB
Makefile
.PHONY: all build compress install clean help
|
|
|
|
all: build compress
|
|
|
|
build:
|
|
cabal build --enable-executable-stripping --disable-debug-info
|
|
|
|
compress:
|
|
@echo "Compressing executable with UPX..."
|
|
@EXE_PATH=$$(cabal list-bin quickjump); \
|
|
if [ -f "$$EXE_PATH" ]; then \
|
|
if command -v upx >/dev/null 2>&1; then \
|
|
upx --best --lzma "$$EXE_PATH"; \
|
|
echo "Compression complete: $$EXE_PATH"; \
|
|
else \
|
|
echo "UPX not found. Installing via npx..."; \
|
|
npx -y @upx/upx@latest --best --lzma "$$EXE_PATH"; \
|
|
echo "Compression complete: $$EXE_PATH"; \
|
|
fi \
|
|
else \
|
|
echo "Error: Executable not found. Please run 'make build' first."; \
|
|
exit 1; \
|
|
fi
|
|
|
|
install:
|
|
cabal install
|
|
|
|
clean:
|
|
cabal clean
|
|
|
|
help:
|
|
@echo "QuickJump Makefile"
|
|
@echo ""
|
|
@echo "Available targets:"
|
|
@echo " all - Build and compress the executable (default)"
|
|
@echo " build - Build the executable with cabal"
|
|
@echo " compress - Compress the executable with UPX (uses npx if UPX not installed)"
|
|
@echo " install - Install the executable with cabal"
|
|
@echo " clean - Clean build artifacts"
|
|
@echo " help - Show this help message"
|