From e1fd4b6f1e2d2122072323a014ae4cd439c996e0 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 19 Feb 2016 19:17:44 +0000 Subject: [PATCH] Move definition of OUTDIR from debian/build/**/Makefile to outer rules Simplify things by making debian/rules.real, debian/rules and debian/build/Makefile.inc (for the recursive case) set OUTDIR. --- debian/build/Makefile | 2 -- debian/build/Makefile.inc | 5 ++++- debian/build/scripts/Makefile | 2 -- debian/build/scripts/basic/Makefile | 2 -- debian/build/scripts/genksyms/Makefile | 2 -- debian/build/scripts/kconfig/Makefile | 2 -- debian/build/scripts/mod/Makefile | 2 -- debian/build/tools/hv/Makefile | 1 - debian/build/tools/lib/lockdep/Makefile | 2 -- debian/build/tools/perf/Makefile | 2 -- debian/rules | 2 +- debian/rules.real | 17 ++++++++++------- 12 files changed, 15 insertions(+), 26 deletions(-) diff --git a/debian/build/Makefile b/debian/build/Makefile index 329e47ed2..a83996d22 100644 --- a/debian/build/Makefile +++ b/debian/build/Makefile @@ -6,8 +6,6 @@ SUBDIRS = \ scripts \ tools -OUTDIR = . - include Makefile.inc # Build userland headers first diff --git a/debian/build/Makefile.inc b/debian/build/Makefile.inc index 15ff1fdb0..f7ca4d1e7 100644 --- a/debian/build/Makefile.inc +++ b/debian/build/Makefile.inc @@ -1,5 +1,8 @@ top_srcdir = $(dir $(lastword $(MAKEFILE_LIST)))/../.. +# Normalise OUTDIR to avoid triggering rebuilds +override OUTDIR := $(patsubst ./%,%,$(OUTDIR)) + VPATH = $(top_srcdir)/$(OUTDIR) SHELL = /bin/sh -e @@ -21,7 +24,7 @@ install: install-local install-recursive +@list='$(SUBDIRS)'; \ for subdir in $$list; do \ echo "Making $* in $$subdir"; \ - $(MAKE) -C $$subdir $* \ + $(MAKE) -C $$subdir OUTDIR=$(OUTDIR)/$$subdir $* \ || exit 1; \ done diff --git a/debian/build/scripts/Makefile b/debian/build/scripts/Makefile index ab2a6a412..d62a40f7b 100644 --- a/debian/build/scripts/Makefile +++ b/debian/build/scripts/Makefile @@ -44,8 +44,6 @@ SUBDIRS = \ kconfig \ mod -OUTDIR = scripts - include ..//Makefile.inc CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 diff --git a/debian/build/scripts/basic/Makefile b/debian/build/scripts/basic/Makefile index 1b2635f9e..6a801c327 100644 --- a/debian/build/scripts/basic/Makefile +++ b/debian/build/scripts/basic/Makefile @@ -2,6 +2,4 @@ PROGS = \ bin2c \ fixdep -OUTDIR = scripts/basic - include ../../Makefile.inc diff --git a/debian/build/scripts/genksyms/Makefile b/debian/build/scripts/genksyms/Makefile index fc26e0c54..22e3163da 100644 --- a/debian/build/scripts/genksyms/Makefile +++ b/debian/build/scripts/genksyms/Makefile @@ -1,7 +1,5 @@ PROGS = genksyms -OUTDIR = scripts/genksyms - include ../../Makefile.inc genksyms: genksyms.o parse.tab.o lex.lex.o diff --git a/debian/build/scripts/kconfig/Makefile b/debian/build/scripts/kconfig/Makefile index 201ab58bb..52e436633 100644 --- a/debian/build/scripts/kconfig/Makefile +++ b/debian/build/scripts/kconfig/Makefile @@ -1,7 +1,5 @@ PROGS = conf -OUTDIR = scripts/kconfig - include ../../Makefile.inc conf: conf.o zconf.tab.o diff --git a/debian/build/scripts/mod/Makefile b/debian/build/scripts/mod/Makefile index 4b5e9b43c..be0e2aa3c 100644 --- a/debian/build/scripts/mod/Makefile +++ b/debian/build/scripts/mod/Makefile @@ -5,8 +5,6 @@ PROGS = \ modpost.real-msb-32 \ modpost.real-msb-64 -OUTDIR = scripts/mod - include ../../Makefile.inc modpost.real-%: diff --git a/debian/build/tools/hv/Makefile b/debian/build/tools/hv/Makefile index a1fddeb49..7f89bbb54 100644 --- a/debian/build/tools/hv/Makefile +++ b/debian/build/tools/hv/Makefile @@ -3,7 +3,6 @@ PROGS = \ hv_kvp_daemon \ hv_vss_daemon -OUTDIR = tools/hv prefix = /usr/sbin include ../../Makefile.inc diff --git a/debian/build/tools/lib/lockdep/Makefile b/debian/build/tools/lib/lockdep/Makefile index a0f954fd4..7e2534e07 100644 --- a/debian/build/tools/lib/lockdep/Makefile +++ b/debian/build/tools/lib/lockdep/Makefile @@ -1,5 +1,3 @@ -OUTDIR = tools/lib/lockdep - include ../../../Makefile.inc DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) diff --git a/debian/build/tools/perf/Makefile b/debian/build/tools/perf/Makefile index c3d1c0738..e20b6b39e 100644 --- a/debian/build/tools/perf/Makefile +++ b/debian/build/tools/perf/Makefile @@ -1,5 +1,3 @@ -OUTDIR = tools/perf - include ../../Makefile.inc DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU) diff --git a/debian/rules b/debian/rules index 36a278d58..f6e52337c 100755 --- a/debian/rules +++ b/debian/rules @@ -40,7 +40,7 @@ maintainerclean: clean: debian/control dh_testdir - make -C $(BUILD_DIR) clean top_srcdir=$(CURDIR) + $(MAKE) -C $(BUILD_DIR) clean top_srcdir=$(CURDIR) OUTDIR=. rm -rf $(STAMPS_DIR) debian/lib/python/debian_linux/__pycache__ debian/*-tmp dh_clean diff --git a/debian/rules.real b/debian/rules.real index 1eb2cf8e4..4294a84d7 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -3,6 +3,10 @@ export KBUILD_BUILD_TIMESTAMP := $(shell dpkg-parsechangelog | sed -ne 's,^Date: include debian/rules.defs +define submake ++$(MAKE) -C $(BUILD_DIR)/$(1) top_srcdir=$(CURDIR) OUTDIR=$(1) +endef + binary-arch: install-kbuild install-usbip install-liblockdep ifneq ($(filter alpha amd64 arm64 armel armhf hppa i386 mips mips64 mips64el mipsel powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64,$(DEB_BUILD_ARCH)),) binary-arch: install-perf @@ -18,7 +22,7 @@ build-arch: $(STAMPS_DIR)/build build-indep: $(STAMPS_DIR)/build: - $(MAKE) -C $(BUILD_DIR) top_srcdir=$(CURDIR) + $(call submake,.) mkdir -p $(STAMPS_DIR) touch '$@' @@ -30,7 +34,7 @@ install-kbuild: $(STAMPS_DIR)/build dh_testdir dh_testroot dh_prep - $(MAKE) -C $(BUILD_DIR)/scripts install prefix=$(DIR) top_srcdir=$(CURDIR) + $(call submake,scripts) install prefix=$(DIR) dh_link $(BASE_DIR) /usr/src/$(PACKAGE_NAME) dh_installchangelogs dh_installdocs @@ -50,7 +54,7 @@ install-perf: $(STAMPS_DIR)/build dh_testdir dh_testroot dh_prep - $(MAKE) -C $(BUILD_DIR)/tools/perf install top_srcdir=$(CURDIR) DESTDIR=$(DIR) + $(call submake,tools/perf) install DESTDIR=$(DIR) dh_perl /usr/share/perf_$(VERSION)-core/scripts/perl/Perf-Trace-Util/lib/ dh_python2 /usr/share/perf_$(VERSION)-core/scripts/python/Perf-Trace-Util/lib/ dh_installchangelogs @@ -71,7 +75,7 @@ install-usbip: $(STAMPS_DIR)/build dh_testdir dh_testroot dh_prep - $(MAKE) -C $(BUILD_DIR)/tools/usb/usbip install top_srcdir=$(CURDIR) DESTDIR=$(DIR) + $(call submake,tools/usb/usbip) install DESTDIR=$(DIR) dh_install --sourcedir=$(DIR) dh_installchangelogs dh_installdocs @@ -93,7 +97,7 @@ install-hyperv-daemons: $(STAMPS_DIR)/build dh_testdir dh_testroot dh_prep - $(MAKE) -C $(BUILD_DIR)/tools/hv install top_srcdir=$(CURDIR) DESTDIR=$(DIR) + $(call submake,tools/hv) install DESTDIR=$(DIR) dh_install dh_installchangelogs dh_installdocs @@ -115,8 +119,7 @@ install-liblockdep: $(STAMPS_DIR)/build dh_testdir dh_testroot dh_prep - $(MAKE) -C $(BUILD_DIR)/tools/lib/lockdep install top_srcdir=$(CURDIR) \ - DESTDIR=$(DIR) + $(call submake,tools/lib/lockdep) install DESTDIR=$(DIR) env -u DH_OPTIONS dh_install -pliblockdep$(VERSION) --sourcedir=$(DIR) \ 'usr/lib/*/liblockdep.so.*' dh_install --sourcedir=$(DIR)