[linux-tools] 06/11: Set compiler flags according to dpkg-buildflags

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Fri Sep 25 23:40:36 UTC 2015


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch master
in repository linux-tools.

commit 5b5133ebf7ed35256c3fe6f9adae7497ee9f41c3
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Fri Sep 25 20:18:12 2015 +0100

    Set compiler flags according to dpkg-buildflags
    
    ...and in general, pass compiler flags down through all makefiles,
    regardless of what creative names people found for the variables.
---
 debian/build/Makefile.inc                          |  8 ++++---
 debian/build/tools/lib/lockdep/Makefile            | 11 +++++----
 debian/build/tools/perf/Makefile                   |  2 +-
 debian/build/tools/usb/usbip/Makefile              |  3 ++-
 debian/changelog                                   |  1 +
 debian/patches/series                              |  2 ++
 debian/patches/tools-lib-lockdep-use-ldflags.patch | 17 ++++++++++++++
 .../patches/tools-lib-traceevent-use-ldflags.patch | 26 ++++++++++++++++++++++
 8 files changed, 61 insertions(+), 9 deletions(-)

diff --git a/debian/build/Makefile.inc b/debian/build/Makefile.inc
index 414246f..15ff1fd 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 7c8408f..427c0de 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 e327a2d..44ca192 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 90fc6ba..75e5705 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 5e69802..53554c5 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 <ben at decadent.org.uk>  Fri, 25 Sep 2015 18:42:20 +0100
 
diff --git a/debian/patches/series b/debian/patches/series
index 0343ca2..e09d47f 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 0000000..c4ebd3e
--- /dev/null
+++ b/debian/patches/tools-lib-lockdep-use-ldflags.patch
@@ -0,0 +1,17 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Fri, 25 Sep 2015 21:36:29 +0100
+Subject: tools/lib/lockdep: Use LDFLAGS
+
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+--- 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 0000000..bd6c5c0
--- /dev/null
+++ b/debian/patches/tools-lib-traceevent-use-ldflags.patch
@@ -0,0 +1,26 @@
+From: Ben Hutchings <ben at decadent.org.uk>
+Date: Fri, 25 Sep 2015 21:26:48 +0100
+Subject: tools/lib/traceevent: Use LDFLAGS
+
+Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
+---
+--- 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. */';		\

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux-tools.git



More information about the Kernel-svn-changes mailing list