scripts/Makefile.package

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

File Facts

System
Linux kernel
Corpus path
scripts/Makefile.package
Extension
.package
Size
10214 bytes
Lines
287
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-only
# Makefile for the different targets used to generate full packages of a kernel

include $(srctree)/scripts/Kbuild.include
include $(srctree)/scripts/Makefile.lib

# Git
# ---------------------------------------------------------------------------

filechk_HEAD = git -C $(srctree) rev-parse --verify HEAD 2>/dev/null

.tmp_HEAD: check-git FORCE
	$(call filechk,HEAD)

PHONY += check-git
check-git:
	@if ! $(srctree)/scripts/check-git; then \
		echo >&2 "error: creating source package requires git repository"; \
		false; \
	fi

git-config-tar.gz   = -c tar.tar.gz.command="$(KGZIP)"
git-config-tar.bz2  = -c tar.tar.bz2.command="$(KBZIP2)"
git-config-tar.lzma = -c tar.tar.lzma.command="$(LZMA)"
git-config-tar.xz   = -c tar.tar.xz.command="$(XZ)"
git-config-tar.zst  = -c tar.tar.zst.command="$(ZSTD)"

quiet_cmd_archive = ARCHIVE $@
      cmd_archive = git -C $(srctree) $(git-config-tar$(suffix $@)) archive \
                    --output=$$(realpath $@) $(archive-args)

suffix-gzip  := .gz
suffix-bzip2 := .bz2
suffix-lzma  := .lzma
suffix-xz    := .xz

# Linux source tarball
# ---------------------------------------------------------------------------

linux-tarballs := $(addprefix linux, .tar.gz .tar.bz2 .tar.lzma .tar.xz)

targets += $(linux-tarballs)
$(linux-tarballs): archive-args = --prefix=linux/ $$(cat $<)
$(linux-tarballs): .tmp_HEAD FORCE
	$(call if_changed,archive)

# rpm-pkg srcrpm-pkg binrpm-pkg
# ---------------------------------------------------------------------------

quiet_cmd_mkspec = GEN     $@
      cmd_mkspec = $(srctree)/scripts/package/mkspec $@

rpmbuild/SPECS/kernel.spec: FORCE
	$(call cmd,mkspec)

PHONY += rpm-sources
rpm-sources: linux.tar.gz
	$(Q)mkdir -p rpmbuild/SOURCES
	$(Q)ln -f linux.tar.gz rpmbuild/SOURCES/linux.tar.gz
	$(Q)cp $(KCONFIG_CONFIG) rpmbuild/SOURCES/config
	$(Q)$(srctree)/scripts/package/gen-diff-patch rpmbuild/SOURCES/diff.patch

PHONY += rpm-pkg srcrpm-pkg binrpm-pkg

ifneq ($(CC),$(HOSTCC))
rpm-no-devel = --without=devel
endif

rpm-pkg:    private build-type := a
srcrpm-pkg: private build-type := s

Annotation

Implementation Notes