#!/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]+)$$//') SHELL := sh -e 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 # The perf-read-vdso* programs are built for different architectures, # without standard flags, but are not exposed to untrusted input. @printf '%s\n' 'blhc: ignore-line-regexp: .* -o *[^ ]*/perf-read-vdso.*' # Kernel code needs different hardening options that blhc doesn't know # about. @printf '%s\n' 'blhc: ignore-line-regexp: .* -D__KERNEL__ .*' # The tools/perf/tests/workloads/.* programs are deliberately compiled # without -O2, so instruct blhc to ignore those @printf '%s\n' 'blhc: ignore-line-regexp: .* -o .*tools/perf/tests/workloads/.*' # fixdep is not always built with the right flags but is also not packaged @printf '%s\n' 'blhc: ignore-line-regexp: .* -o .*/tools/.*/fixdep.*' # blhc gets confused by our putting compiler flags in the CC variable, # which we do as a workaround for broken upstream makefiles @printf '%s\n' 'blhc: ignore-line-regexp: /usr/bin/make .*' @printf '%s\n' 'blhc: ignore-line-regexp: .*/tools/perf/trace/beauty/arch_errno_names\.sh.*' # We need to use terse builds in CI due to the log size limit. This # mostly affects the output for builds of kernel code, which need # different options for hardening anyway. ifneq ($(filter terse,$(DEB_BUILD_OPTIONS)),) @printf '%s\n' 'blhc: ignore-line-regexp: \s*(CC(LD)?|LD|LINK)\b.*' endif $(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 DIR_ORIG = ../orig/$(DEB_SOURCE)-$(DEB_VERSION_EPOCH_UPSTREAM) TAR_ORIG = ../$(DEB_SOURCE)_$(DEB_VERSION_EPOCH_UPSTREAM).orig.tar.* orig: $(DIR_ORIG) rsync --delete --exclude /debian --exclude .git --link-dest=$$@ 'Source: %s\nVersion: %s\nDistribution: %s\n' $(DEB_SOURCE) $(DEB_VERSION) $(DEB_DISTRIBUTION) debian/control debian/rules.gen: debian/bin/gencontrol.py $(CONTROL_FILES) ifeq ($(wildcard debian/control.md5sum),) $(MAKE) -f debian/rules debian/control-real-fail else md5sum --check debian/control.md5sum --status || \ $(MAKE) -f debian/rules debian/control-real-fail endif debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES) # Hash randomisation makes the pickled config unreproducible PYTHONHASHSEED=0 $< md5sum $(sort $^) > debian/control.md5sum debian/control-real-fail: @$(MAKE) -f debian/rules debian/control-real @echo @echo This target is made to fail intentionally, to make sure @echo that it is NEVER run during the automated build. Please @echo ignore the following error, the debian/control file has @echo been generated SUCCESSFULLY. @echo exit 1 .PHONY: binary binary-% build build-% clean debian/control-real orig setup source clean-generated