59 lines
1.8 KiB
Ruby
59 lines
1.8 KiB
Ruby
# Builder 契约文件。放到项目根,用 `make -f makefile.builder <target>`。
|
||
# Android 轨道:build 产出 dist/<name>_<version>_<arch>.apk,push 走 copy_artifact.sh。
|
||
# copy_artifact.sh 会按 COPY_SCRIPT 分发;未配置时回退到 COPY_DEST。
|
||
# ARCHES 是构建机 ISA;APK 可含多 ABI。不要把这些目标写进用户 Makefile。
|
||
|
||
ARCHES ?= amd64
|
||
ARCH ?= $(firstword $(ARCHES))
|
||
ifeq ($(strip $(ARCHES)),)
|
||
$(error ARCHES must not be empty)
|
||
endif
|
||
ifneq ($(filter-out amd64 arm64,$(ARCHES)),)
|
||
$(error ARCHES entries must be amd64 or arm64)
|
||
endif
|
||
ifneq ($(filter $(ARCH),$(ARCHES)),$(ARCH))
|
||
$(error ARCH must be one of: $(ARCHES))
|
||
endif
|
||
|
||
PROJECT_NAME ?= $(notdir $(CURDIR))
|
||
DIST_DIR ?= dist
|
||
|
||
ifneq ($(BUILDER_SKILL_DIR),)
|
||
include $(BUILDER_SKILL_DIR)/scripts/version.mk
|
||
else
|
||
include $(HOME)/.pouch/skills/builder/scripts/version.mk
|
||
endif
|
||
|
||
BUILDER_SCRIPTS := $(or $(BUILDER_SKILL_DIR),$(HOME)/.pouch/skills/builder)/scripts
|
||
APK_OUT := $(DIST_DIR)/$(PROJECT_NAME)_$(VERSION)_$(ARCH).apk
|
||
|
||
.PHONY: help version arches clean build android push
|
||
|
||
help:
|
||
@echo "$(PROJECT_NAME) $(VERSION)"
|
||
@echo " ARCHES=$(ARCHES) ARCH=$(ARCH)"
|
||
@echo " make -f makefile.builder build [ARCH=amd64|arm64] - 构建 Release APK"
|
||
@echo " make -f makefile.builder version - 打印规范版本"
|
||
@echo " make -f makefile.builder arches - 打印架构清单"
|
||
@echo " make -f makefile.builder clean - 删除 $(DIST_DIR)"
|
||
@echo " make -f makefile.builder push - copy_artifact.sh 分发 APK"
|
||
|
||
version:
|
||
@echo $(VERSION)
|
||
|
||
arches:
|
||
@echo $(ARCHES)
|
||
|
||
clean:
|
||
rm -rf $(DIST_DIR)
|
||
|
||
# 替换为项目真实 assemble 命令,且必须使用 $(ARCH)。不得 curl/scp/docker cp。
|
||
build:
|
||
mkdir -p $(DIST_DIR)
|
||
cp app-release.apk $(APK_OUT)
|
||
|
||
android: build
|
||
|
||
push:
|
||
$(BUILDER_SCRIPTS)/copy_artifact.sh $(APK_OUT)
|