tools/testing/selftests/nolibc/Makefile.nolibc

Source file repositories/reference/linux-study-clean/tools/testing/selftests/nolibc/Makefile.nolibc

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/nolibc/Makefile.nolibc
Extension
.nolibc
Size
13872 bytes
Lines
345
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: build/configuration rule
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

# SPDX-License-Identifier: GPL-2.0
# Makefile for nolibc tests
# we're in ".../tools/testing/selftests/nolibc"
ifeq ($(srctree),)
srctree := $(patsubst %/tools/testing/selftests/,%,$(dir $(CURDIR)))
endif

include $(srctree)/tools/scripts/utilities.mak
# We need this for the "__cc-option" macro.
include $(srctree)/scripts/Makefile.compiler

ifneq ($(O),)
ifneq ($(call is-absolute,$(O)),y)
$(error Only absolute O= parameters are supported)
endif
objtree := $(O)
else
objtree ?= $(srctree)
endif

ifeq ($(ARCH),)
include $(srctree)/scripts/subarch.include
ARCH = $(SUBARCH)
endif

cc-option = $(call __cc-option, $(CC),$(CLANG_CROSS_FLAGS),$(1),$(2))

# XARCH extends the kernel's ARCH with a few variants of the same
# architecture that only differ by the configuration, the toolchain
# and the Qemu program used. It is copied as-is into ARCH except for
# a few specific values which are mapped like this:
#
#  XARCH        | ARCH      | config
#  -------------|-----------|-------------------------
#  ppc          | powerpc   | 32 bits
#  ppc64        | powerpc   | 64 bits big endian
#  ppc64le      | powerpc   | 64 bits little endian
#
# It is recommended to only use XARCH, though it does not harm if
# ARCH is already set. For simplicity, ARCH is sufficient for all
# architectures where both are equal.

# configure default variants for target kernel supported architectures
XARCH_powerpc    = ppc
XARCH_mips       = mips32le
XARCH_riscv      = riscv64
XARCH            = $(or $(XARCH_$(ARCH)),$(ARCH))

# map from user input variants to their kernel supported architectures
ARCH_x32         = x86
ARCH_armthumb    = arm
ARCH_ppc         = powerpc
ARCH_ppc64       = powerpc
ARCH_ppc64le     = powerpc
ARCH_mips32le    = mips
ARCH_mips32be    = mips
ARCH_mipsn32le   = mips
ARCH_mipsn32be   = mips
ARCH_mips64le    = mips
ARCH_mips64be    = mips
ARCH_riscv32     = riscv
ARCH_riscv64     = riscv
ARCH_s390x       = s390
ARCH_sparc32     = sparc
ARCH_sparc64     = sparc
ARCH_sh4         = sh
ARCH_parisc32    = parisc
ARCH            := $(or $(ARCH_$(XARCH)),$(XARCH))

# kernel image names by architecture

Annotation

Implementation Notes