diff --git a/debian/build/Makefile.inc b/debian/build/Makefile.inc index 414246f47..15ff1fdb0 100644 --- a/debian/build/Makefile.inc +++ b/debian/build/Makefile.inc @@ -6,10 +6,12 @@ SHELL = /bin/sh -e CC = gcc CXX = g++ -CFLAGS ?= -O2 -Wall -CPPFLAGS = -I$(top_srcdir)/$(OUTDIR) -I$(top_srcdir)/debian/build/$(OUTDIR) \ +CFLAGS := $(shell dpkg-buildflags --get CFLAGS) -Wall +CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) \ + -I$(top_srcdir)/$(OUTDIR) -I$(top_srcdir)/debian/build/$(OUTDIR) \ -isystem $(top_srcdir)/debian/build/include -CXXFLAGS = $(CFLAGS) +CXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) -Wall +LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) all: all-local all-recursive clean: clean-local clean-recursive diff --git a/debian/build/tools/lib/lockdep/Makefile b/debian/build/tools/lib/lockdep/Makefile index 7c8408ffc..427c0de9b 100644 --- a/debian/build/tools/lib/lockdep/Makefile +++ b/debian/build/tools/lib/lockdep/Makefile @@ -1,10 +1,13 @@ -srcdir := $(top_srcdir)/tools/lib/lockdep +OUTDIR = tools/lib/lockdep + +include ../../../Makefile.inc DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) -MAKE_LOCKDEP := $(MAKE) -C $(srcdir) O=$(CURDIR)/out V=1 \ +MAKE_LOCKDEP := $(MAKE) -C $(top_srcdir)/$(OUTDIR) O=$(CURDIR)/out V=1 \ prefix=/usr libdir_relative=lib/$(DEB_HOST_MULTIARCH) \ - LIBLOCKDEP_VERSION=$(VERSION) + LIBLOCKDEP_VERSION=$(VERSION) \ + CONFIG_FLAGS='$(CFLAGS) $(filter -D%,$(CPPFLAGS))' LDFLAGS='$(LDFLAGS)' unexport CFLAGS @@ -15,7 +18,7 @@ all: install: $(MAKE_LOCKDEP) install mkdir -p $(DESTDIR)/usr/include - cp -R $(srcdir)/include/liblockdep $(DESTDIR)/usr/include/ + cp -R $(top_srcdir)/$(OUTDIR)/include/liblockdep $(DESTDIR)/usr/include/ ln -s liblockdep.so.$(VERSION) \ $(DESTDIR)/usr/lib/$(DEB_HOST_MULTIARCH)/liblockdep.so # Upstream lockdep preload script is not suitable for installation diff --git a/debian/build/tools/perf/Makefile b/debian/build/tools/perf/Makefile index e327a2d02..44ca19274 100644 --- a/debian/build/tools/perf/Makefile +++ b/debian/build/tools/perf/Makefile @@ -26,7 +26,7 @@ else ifneq ($(filter amd64 i386,$(DEB_HOST_ARCH_CPU)),) KERNEL_ARCH_PERF = x86 endif -MAKE_PERF := $(MAKE) prefix=/usr V=1 ARCH=$(KERNEL_ARCH_PERF) EXTRA_WARNINGS=-Wno-error +MAKE_PERF := $(MAKE) prefix=/usr V=1 ARCH=$(KERNEL_ARCH_PERF) EXTRA_WARNINGS=-Wno-error EXTRA_CFLAGS='$(CFLAGS) $(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' # Disable Gtk UI until it's more usable MAKE_PERF += NO_GTK2=1 diff --git a/debian/build/tools/usb/usbip/Makefile b/debian/build/tools/usb/usbip/Makefile index 90fc6baa0..75e5705bb 100644 --- a/debian/build/tools/usb/usbip/Makefile +++ b/debian/build/tools/usb/usbip/Makefile @@ -8,7 +8,8 @@ unexport MAKEFLAGS all: cd $(srcdir) && ./autogen.sh mkdir -p out - cd out && $(srcdir)/configure \ + cd out && \ + $(shell dpkg-buildflags --export=cmdline) $(srcdir)/configure \ --prefix=/usr \ --with-tcp-wrappers \ --with-usbids-dir=/usr/share/misc \ diff --git a/debian/changelog b/debian/changelog index 5e6980259..53554c55f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ linux-tools (4.2-1) UNRELEASED; urgency=medium * debian/bin/genorig.py: Make orig tarballs reproducible * linux-perf: Fix installation directory for bash completions * linux-perf: Remove shebang lines from perf scripts + * Set compiler flags according to dpkg-buildflags -- Ben Hutchings Fri, 25 Sep 2015 18:42:20 +0100 diff --git a/debian/patches/series b/debian/patches/series index 0343ca21b..e09d47f45 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -11,3 +11,5 @@ lockdep-fix-oot-build.patch lockdep-fix-headers.patch lockdep-fix-soname.patch tools-perf-remove-shebangs.patch +tools-lib-traceevent-use-ldflags.patch +tools-lib-lockdep-use-ldflags.patch diff --git a/debian/patches/tools-lib-lockdep-use-ldflags.patch b/debian/patches/tools-lib-lockdep-use-ldflags.patch new file mode 100644 index 000000000..c4ebd3ed5 --- /dev/null +++ b/debian/patches/tools-lib-lockdep-use-ldflags.patch @@ -0,0 +1,17 @@ +From: Ben Hutchings +Date: Fri, 25 Sep 2015 21:36:29 +0100 +Subject: tools/lib/lockdep: Use LDFLAGS + +Signed-off-by: Ben Hutchings +--- +--- a/tools/lib/lockdep/Makefile ++++ b/tools/lib/lockdep/Makefile +@@ -98,7 +98,7 @@ build := -f $(srctree)/tools/build/Makef + + do_compile_shared_library = \ + ($(print_shared_lib_compile) \ +- $(CC) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='$(@F)';$(shell ln -s $(@F) $(@D)/liblockdep.so)) ++ $(CC) $(LDFLAGS) --shared $^ -o $@ -lpthread -ldl -Wl,-soname='$(@F)';$(shell ln -s $(@F) $(@D)/liblockdep.so)) + + do_build_static_lib = \ + ($(print_static_lib_build) \ diff --git a/debian/patches/tools-lib-traceevent-use-ldflags.patch b/debian/patches/tools-lib-traceevent-use-ldflags.patch new file mode 100644 index 000000000..bd6c5c0b6 --- /dev/null +++ b/debian/patches/tools-lib-traceevent-use-ldflags.patch @@ -0,0 +1,26 @@ +From: Ben Hutchings +Date: Fri, 25 Sep 2015 21:26:48 +0100 +Subject: tools/lib/traceevent: Use LDFLAGS + +Signed-off-by: Ben Hutchings +--- +--- a/tools/lib/traceevent/Makefile ++++ b/tools/lib/traceevent/Makefile +@@ -172,7 +172,7 @@ $(TE_IN): force + $(Q)$(MAKE) $(build)=libtraceevent + + $(OUTPUT)libtraceevent.so: $(TE_IN) +- $(QUIET_LINK)$(CC) --shared $^ -o $@ ++ $(QUIET_LINK)$(CC) $(LDFLAGS) --shared $^ -o $@ + + $(OUTPUT)libtraceevent.a: $(TE_IN) + $(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^ +@@ -189,7 +189,7 @@ $(PLUGINS_IN): force + $(Q)$(MAKE) $(build)=$(plugin_obj) + + $(OUTPUT)%.so: $(OUTPUT)%-in.o +- $(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^ ++ $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $^ + + define make_version.h + (echo '/* This file is automatically generated. Do not modify. */'; \