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.
This commit is contained in:
Ben Hutchings 2016-02-19 19:17:44 +00:00
parent 32be752344
commit e1fd4b6f1e
12 changed files with 15 additions and 26 deletions

View File

@ -6,8 +6,6 @@ SUBDIRS = \
scripts \
tools
OUTDIR = .
include Makefile.inc
# Build userland headers first

View File

@ -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

View File

@ -44,8 +44,6 @@ SUBDIRS = \
kconfig \
mod
OUTDIR = scripts
include ..//Makefile.inc
CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

View File

@ -2,6 +2,4 @@ PROGS = \
bin2c \
fixdep
OUTDIR = scripts/basic
include ../../Makefile.inc

View File

@ -1,7 +1,5 @@
PROGS = genksyms
OUTDIR = scripts/genksyms
include ../../Makefile.inc
genksyms: genksyms.o parse.tab.o lex.lex.o

View File

@ -1,7 +1,5 @@
PROGS = conf
OUTDIR = scripts/kconfig
include ../../Makefile.inc
conf: conf.o zconf.tab.o

View File

@ -5,8 +5,6 @@ PROGS = \
modpost.real-msb-32 \
modpost.real-msb-64
OUTDIR = scripts/mod
include ../../Makefile.inc
modpost.real-%:

View File

@ -3,7 +3,6 @@ PROGS = \
hv_kvp_daemon \
hv_vss_daemon
OUTDIR = tools/hv
prefix = /usr/sbin
include ../../Makefile.inc

View File

@ -1,5 +1,3 @@
OUTDIR = tools/lib/lockdep
include ../../../Makefile.inc
DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

View File

@ -1,5 +1,3 @@
OUTDIR = tools/perf
include ../../Makefile.inc
DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)

2
debian/rules vendored
View File

@ -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

17
debian/rules.real vendored
View File

@ -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)