-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
147 lines (135 loc) · 4.54 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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
.DEFAULT_GOAL := help
################################################################################
RUST_GIT_URL ?= https://github.com/rust-lang/rust.git
RUST_HOST ?= x86_64-apple-darwin
RUST_TARGETS ?= arm64e-apple-darwin
RUST_TOOLS ?= cargo,clippy,rustdoc,rustfmt,rust-analyzer,analysis,src
RUST_CHANNEL ?= dev
RUST_CODEGEN_BACKENDS ?= llvm
RUST_USE_LLD ?= false
RUST_VERBOSE ?= 0
RUST_DESCRIPTION ?= ""
RUST_INSTALL_DIR ?= install
RUST_DIST_FORMATS ?= xz
RUST_CONFIGURE_ARGS ?=
# Note: use Makefile.local for customization
-include misc/make/utility.Makefile
-include misc/make/doc.Makefile
-include misc/make/offline.Makefile
-include Makefile.local
## ▸▸▸ Download commands ◂◂◂
.PHONY: download
download: ## Download Rust sources
git clone --recurse-submodules -j$(shell nproc) ${RUST_GIT_URL}
###
# Configure: https://github.com/rust-lang/rust/blob/master/src/bootstrap/configure.py
###
## ▸▸▸ Configure commands ◂◂◂
.PHONY: configure
configure: ## Configure Rust & LLVM with optimizations
cd rust && ./configure \
--enable-option-checking \
--enable-verbose-configure \
--enable-locked-deps \
--enable-cargo-native-static \
--enable-codegen-tests \
--enable-verbose-tests \
--enable-dist-src \
--enable-sccache \
--enable-ninja \
--enable-optimize-llvm \
--enable-full-tools \
--enable-sanitizers \
--enable-profiler \
--host=${RUST_HOST} \
--target=${RUST_TARGETS} \
--codegen-backends=${RUST_CODEGEN_BACKENDS} \
--set llvm.download-ci-llvm=false \
--set llvm.targets="AArch64;X86" \
--set llvm.experimental-targets="" \
--set llvm.static-libstdcpp \
--set llvm.tests=true \
--set build.optimized-compiler-builtins \
--set build.print-step-timings \
--set build.metrics \
--set build.verbose=${RUST_VERBOSE} \
--set rust.channel=${RUST_CHANNEL} \
--set rust.jemalloc \
--set rust.lto=thin \
--set rust.codegen-units=1 \
--set rust.codegen-backends=${RUST_CODEGEN_BACKENDS} \
--set rust.use-lld=${RUST_USE_LLD} \
--set rust.omit-git-hash=true \
--set dist.compression-profile=balanced \
--dist-compression-formats=${RUST_DIST_FORMATS} \
--prefix=${RUST_INSTALL_DIR} \
${RUST_CONFIGURE_ARGS}
.PHONY: configure-dev
configure-dev: ## Configure Rust without optimizations
cd rust && ./configure \
--enable-option-checking \
--enable-verbose-configure \
--enable-locked-deps \
--enable-cargo-native-static \
--enable-codegen-tests \
--enable-verbose-tests \
--enable-dist-src \
--host=${RUST_HOST} \
--target=${RUST_TARGETS} \
--tools=${RUST_TOOLS} \
--set llvm.download-ci-llvm=true \
--set build.optimized-compiler-builtins \
--set build.print-step-timings \
--set build.metrics \
--set build.verbose=${RUST_VERBOSE} \
--set rust.channel=${RUST_CHANNEL} \
--set rust.description=${RUST_DESCRIPTION} \
--set rust.use-lld=${RUST_USE_LLD} \
--set dist.compression-profile=balanced \
--dist-compression-formats=${RUST_DIST_FORMATS} \
--prefix=${RUST_INSTALL_DIR} \
${RUST_CONFIGURE_ARGS}
.PHONY: configure-dev-llvm
configure-dev-llvm: ## Configure Rust & LLVM without optimizations
cd rust && ./configure \
--enable-option-checking \
--enable-verbose-configure \
--enable-locked-deps \
--enable-cargo-native-static \
--enable-codegen-tests \
--enable-verbose-tests \
--enable-dist-src \
--enable-sccache \
--enable-ninja \
--enable-debug-assertions \
--enable-overflow-checks \
--enable-llvm-assertions \
--host=${RUST_HOST} \
--target=${RUST_TARGETS} \
--tools=${RUST_TOOLS} \
--codegen-backends=${RUST_CODEGEN_BACKENDS} \
--set llvm.download-ci-llvm=false \
--set llvm.targets="AArch64;X86" \
--set llvm.experimental-targets="" \
--set llvm.static-libstdcpp \
--set llvm.tests=true \
--set build.optimized-compiler-builtins \
--set build.print-step-timings \
--set build.metrics \
--set build.verbose=${RUST_VERBOSE} \
--set rust.channel=${RUST_CHANNEL} \
--set rust.verify-llvm-ir \
--set rust.use-lld=${RUST_USE_LLD} \
--set rust.codegen-backends=${RUST_CODEGEN_BACKENDS} \
--set rust.omit-git-hash=true \
--set dist.compression-profile=balanced \
--dist-compression-formats=${RUST_DIST_FORMATS} \
--prefix=${RUST_INSTALL_DIR} \
${RUST_CONFIGURE_ARGS}
## ▸▸▸ Target Info commands ◂◂◂
.PHONY: show-target-info
show-target-info: SHELL:=/bin/bash
show-target-info: ## Show target info
@for RUST_TARGET in $(shell echo ${RUST_TARGETS} | tr "," " "); do \
rust/build/${RUST_HOST}/stage2/bin/rustc -Z unstable-options --target=$${RUST_TARGET} --print target-spec-json | tee $${RUST_TARGET}-spec.json ; \
done;