1
0
linux/debian/rules

108 lines
3.4 KiB
Plaintext
Raw Permalink Normal View History

#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk
DEB_VERSION_SOURCE = $(shell echo '$(DEB_VERSION)' | sed -re 's/\+b([0-9]+)$$//')
include debian/rules.defs
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
DEBIAN_KERNEL_JOBS := $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif
ifdef DEBIAN_KERNEL_JOBS
MAKEFLAGS += -j$(DEBIAN_KERNEL_JOBS)
endif
# dpkg-buildpackage passes the -s option if DEB_BUILD_OPTIONS contains
# terse, but that triggers Kbuild to turn off progress messages
# completely, which we don't want.
override MAKEFLAGS := $(subst s,,$(filter-out -%,$(MAKEFLAGS))) $(filter -%,$(MAKEFLAGS))
.NOTPARALLEL:
source: debian/control
dh_testdir
$(MAKE) -f debian/rules.gen source
setup: debian/control
dh_testdir
$(MAKE) -f debian/rules.gen setup_$(DEB_HOST_ARCH)
build: build-arch build-indep
build-arch: debian/control
dh_testdir
$(MAKE) -f debian/rules.gen build-arch_$(DEB_HOST_ARCH)
build-indep: debian/control
dh_testdir
$(MAKE) -f debian/rules.gen build-indep
binary: binary-indep binary-arch
binary-arch: build-arch
dh_testdir
$(MAKE) -f debian/rules.gen binary-arch_$(DEB_HOST_ARCH)
binary-indep: build-indep
dh_testdir
$(MAKE) -f debian/rules.gen binary-indep
2024-10-29 05:12:06 +03:00
CLEAN_PATTERNS := $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_linux/*.pyc debian/lib/python/debian_linux/__pycache__ $$(find debian -maxdepth 1 -type d -name 'linux-*') debian/*-tmp debian/*.substvars
clean-generated:
rm -rf $(CLEAN_PATTERNS)
# We cannot use dh_clean here because it requires debian/control to exist
rm -rf debian/.debhelper debian/*.debhelper* debian/files debian/generated.*
rm -f \
debian/control \
debian/control.md5sum \
2024-10-29 13:06:39 +03:00
debian/krd-linux-headers-*.maintscript \
debian/krd-linux-headers-*.postinst \
debian/krd-linux-image-*.lintian-overrides \
debian/krd-linux-image-*.maintscript \
debian/krd-linux-image-*.postinst \
debian/krd-linux-image-*.postrm \
debian/krd-linux-image-*.preinst \
debian/krd-linux-image-*.prerm \
debian/krd-linux-source.maintscript \
2024-10-29 05:12:06 +03:00
debian/rules.gen
maintainerclean: clean-generated
rm -rf $(filter-out debian .git, $(wildcard * .[^.]*))
clean: debian/control
dh_testdir
rm -rf $(CLEAN_PATTERNS)
dh_clean
CONTROL_FILES = $(BUILD_DIR)/version-info $(sort $(wildcard debian/templates/*.in))
CONTROL_FILES += debian/config/defines.toml $(sort $(wildcard debian/config/*/defines.toml))
# debian/bin/gencontrol.py uses debian/changelog as input, but the
# output only depends on the source name and version. To avoid
# frequent changes to debian/control.md5sum, include only those fields
# in the checksum.
$(BUILD_DIR)/version-info: debian/changelog
mkdir -p $(@D)
# Use DEB_VERSION_SOURCE to allow binNMU
printf >$@ 'Source: %s\nVersion: %s\n' '$(DEB_SOURCE)' '$(DEB_VERSION)'
debian/control debian/rules.gen: debian/bin/gencontrol.py $(CONTROL_FILES)
ifeq ($(wildcard debian/control.md5sum),)
$(MAKE) -f debian/rules debian/control-real
else
md5sum --check debian/control.md5sum --status || \
$(MAKE) -f debian/rules debian/control-real
endif
debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES)
# Hash randomisation makes the pickled config unreproducible
PYTHONHASHSEED=0 $<
find debian/ -name __pycache__ -type d -exec rm -rf {} +
find debian/ -name '*.pyc' -type f -exec rm -f {} +
md5sum $(sort $^) > debian/control.md5sum
2024-10-29 05:12:06 +03:00
.PHONY: binary binary-% build build-% clean debian/control-real setup source clean-generated