scripts/Makefile.host

Source file repositories/reference/linux-study-clean/scripts/Makefile.host

File Facts

System
Linux kernel
Corpus path
scripts/Makefile.host
Extension
.host
Size
6166 bytes
Lines
166
Domain
Support Tooling And Documentation
Bucket
scripts
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

# LEX
# ---------------------------------------------------------------------------
quiet_cmd_flex = LEX     $@
      cmd_flex = $(LEX) -o$@ -L $<

$(obj)/%.lex.c: $(src)/%.l FORCE
	$(call if_changed,flex)

# YACC
# ---------------------------------------------------------------------------
quiet_cmd_bison = YACC    $(basename $@).[ch]
      cmd_bison = $(YACC) -o $(basename $@).c --defines=$(basename $@).h -t -l $<

$(obj)/%.tab.c $(obj)/%.tab.h: $(src)/%.y FORCE
	$(call if_changed,bison)

# ==========================================================================
# Building binaries on the host system
# Binaries are used during the compilation of the kernel, for example
# to preprocess a data file.
#
# Both C and C++ are supported, but preferred language is C for such utilities.
# Rust is also supported, but it may only be used in scenarios where a Rust
# toolchain is required to be available (e.g. when  `CONFIG_RUST` is enabled).
#
# Sample syntax (see Documentation/kbuild/makefiles.rst for reference)
# hostprogs := bin2hex
# Will compile bin2hex.c and create an executable named bin2hex
#
# hostprogs     := lxdialog
# lxdialog-objs := checklist.o lxdialog.o
# Will compile lxdialog.c and checklist.c, and then link the executable
# lxdialog, based on checklist.o and lxdialog.o
#
# hostprogs       := qconf
# qconf-cxxobjs   := qconf.o
# qconf-objs      := menu.o
# Will compile qconf as a C++ program, and menu as a C program.
# They are linked as C++ code to the executable qconf
#
# hostprogs   := target
# target-rust := y
# Will compile `target` as a Rust program, using `target.rs` as the crate root.
# The crate may consist of several source files.

# C code
# Executables compiled from a single .c file
host-csingle	:= $(foreach m,$(hostprogs), \
			$(if $($(m)-objs)$($(m)-cxxobjs)$($(m)-rust),,$(m)))

# C executables linked based on several .o files
host-cmulti	:= $(foreach m,$(hostprogs),\
		   $(if $($(m)-cxxobjs)$($(m)-rust),,$(if $($(m)-objs),$(m))))

# Object (.o) files compiled from .c files
host-cobjs	:= $(sort $(foreach m,$(hostprogs),$($(m)-objs)))

# C++ code
# C++ executables compiled from at least one .cc file
# and zero or more .c files
host-cxxmulti	:= $(foreach m,$(hostprogs),$(if $($(m)-cxxobjs),$(m)))

# C++ Object (.o) files compiled from .cc files
host-cxxobjs	:= $(sort $(foreach m,$(host-cxxmulti),$($(m)-cxxobjs)))

# Rust code
# Executables compiled from a single Rust crate (which may consist of
# one or more .rs files)

Annotation

Implementation Notes