1# Copyright (C) 2022 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# 15 16LOCAL_DIR := $(GET_LOCAL_DIR) 17 18MODULE := $(LOCAL_DIR) 19 20LIBSTD_DIR = $(RUST_BINDIR)/../src/stdlibs/library/std 21 22MODULE_SRCS := $(LIBSTD_DIR)/src/lib.rs 23 24MODULE_CRATE_NAME := std 25 26MODULE_RUST_EDITION := 2021 27 28MODULE_LIBRARY_EXPORTED_DEPS += \ 29 $(call FIND_CRATE,cfg-if) \ 30 trusty/user/base/lib/libcore-rust \ 31 $(call FIND_CRATE,libc) \ 32 trusty/user/base/lib/liballoc-rust \ 33 trusty/user/base/lib/libunwind-rust \ 34 trusty/user/base/lib/libhashbrown-rust \ 35 trusty/user/base/lib/libstd_detect-rust \ 36 trusty/user/base/lib/librustc-demangle-rust \ 37 trusty/user/base/lib/libpanic_abort-rust \ 38 39MODULE_RUSTFLAGS += \ 40 --cfg 'backtrace_in_libstd' \ 41 -Z force-unstable-if-unmarked \ 42 43# Suppress known warnings. The libstd source code generates warnings which are 44# normally suppressed with `--cap-lints=allow` during the rustbuild process. We 45# opt to suppress lints individually in order to avoid missing warnings that 46# might be specific to the Trusty build process. These may need to be updated 47# for future Rust releases. 48MODULE_RUSTFLAGS += \ 49 -A unused-variables \ 50 -A non-fmt-panics \ 51 -A deprecated \ 52 53MODULE_ADD_IMPLICIT_DEPS := false 54 55# Allow targets to further reduce rust footprint by removing panic information 56ifeq (true,$(call TOBOOL,$(RUST_USE_PANIC_IMMEDIATE_ABORT))) 57MODULE_RUSTFLAGS += \ 58 --cfg 'feature="panic_immediate_abort"' \ 59 -A unused-imports \ 60 -A unused-unsafe \ 61 62endif 63 64# `STD_ENV_ARCH` needs to be set when building libstd. For ARM64 `ARCH` needs to 65# be translated to the architecture name that rustc expects, but for the 66# remaining targets `ARCH` already matches. This will need to be updated 67# accordingly if we add support for additional targets where `ARCH` doesn't line 68# up with rustc's architecture names. 69ifeq ($(ARCH),arm64) 70MODULE_RUST_ENV += STD_ENV_ARCH=aarch64 71else 72MODULE_RUST_ENV += STD_ENV_ARCH=$(ARCH) 73endif 74 75MODULE_SKIP_DOCS := true 76 77include make/library.mk 78