-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (73 loc) · 2.83 KB
/
Copy pathMakefile
File metadata and controls
89 lines (73 loc) · 2.83 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# android-arm-build-tools — top-level orchestration.
#
# All real work happens inside Docker. This Makefile builds the
# container image, clones the AOSP project repos listed in
# repos.json, drives a CMake cross-build, and packages the result.
#
# See MIGRATION.md for the architecture switch from Soong to CMake.
SHELL := /bin/bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
# ---- knobs ------------------------------------------------------------
include config.env
export
# Resolve project dir to an absolute path; bind-mounted into containers.
PROJECT_DIR := $(abspath .)
# Image name.
IMG_LINUX_ARM64 := android-arm-build-tools-linux-arm64:latest
# Common docker-run flags. Build steps run non-interactively so they
# work under CI; shell-* targets layer `-it` on top for a real terminal.
DOCKER_RUN_ARGS := \
--rm \
-v $(PROJECT_DIR):/workspace \
-w /workspace \
-e AOSP_BRANCH=$(AOSP_BRANCH) \
-e BUILD_TOOLS_LABEL=$(BUILD_TOOLS_LABEL) \
-e TARGETS="$(TARGETS)" \
-e JOBS=$(JOBS)
DOCKER_RUN_INTERACTIVE := $(DOCKER_RUN_ARGS) -it
# ---- public targets ---------------------------------------------------
.PHONY: all linux-arm64 fetch clean distclean \
image-linux-arm64 \
shell-linux-arm64 \
help
help:
@cat <<-'EOF'
android-arm-build-tools
----------------------
make linux-arm64 cross-build TARGETS for linux-glibc-arm64
make fetch clone AOSP project repos into src/
make clean remove out/ and build/
make distclean clean + remove src/, ccache, and docker image
make shell-linux-arm64 drop into a shell in the build image
make help this message
Configure via config.env or VAR=value on the command line, e.g.:
make linux-arm64 TARGETS=aapt2 AOSP_BRANCH=platform-tools-35.0.2
EOF
all: linux-arm64
# ---- image ------------------------------------------------------------
# CMake handles the cross-compile to aarch64 internally via the
# toolchain file, so this image builds for the host's native platform.
image-linux-arm64:
docker build \
-t $(IMG_LINUX_ARM64) \
-f docker/linux-arm64.Dockerfile \
docker/
# ---- workflow ---------------------------------------------------------
fetch: image-linux-arm64
docker run $(DOCKER_RUN_ARGS) \
$(IMG_LINUX_ARM64) \
python3 scripts/fetch_sources.py
linux-arm64: fetch
docker run $(DOCKER_RUN_ARGS) \
$(IMG_LINUX_ARM64) \
bash -c 'python3 scripts/build_linux_arm64.py && TARGET=linux-arm64 python3 scripts/collect_artifacts.py'
# ---- shell (for iteration / debugging) --------------------------------
shell-linux-arm64: image-linux-arm64
docker run $(DOCKER_RUN_INTERACTIVE) $(IMG_LINUX_ARM64) bash
# ---- cleanup ----------------------------------------------------------
clean:
rm -rf out/ build/
distclean: clean
rm -rf src/ .ccache/
-docker image rm $(IMG_LINUX_ARM64) 2>/dev/null