Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755196AbcKBNf6 (ORCPT ); Wed, 2 Nov 2016 09:35:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58318 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752535AbcKBNf4 (ORCPT ); Wed, 2 Nov 2016 09:35:56 -0400 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Peter Zijlstra , Andi Kleen , William Cohen , Stephane Eranian , Namhyung Kim , David Ahern Subject: [PATCH 1/3] tools build: Add CFLAGS_REMOVE_* support Date: Wed, 2 Nov 2016 14:35:47 +0100 Message-Id: <1478093749-5602-2-git-send-email-jolsa@kernel.org> In-Reply-To: <1478093749-5602-1-git-send-email-jolsa@kernel.org> References: <1478093749-5602-1-git-send-email-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 02 Nov 2016 13:35:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2119 Lines: 47 Adding support to remove options from final CFLAGS for both object file and build target. It's now possible to remove CFLAGS options like: CFLAGS_REMOVE_krava.o += -Wstrict-prototypes Link: http://lkml.kernel.org/n/tip-0t59dihg30fh035xo69df3m8@git.kernel.org Signed-off-by: Jiri Olsa --- tools/build/Build.include | 4 +++- tools/build/Documentation/Build.txt | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/build/Build.include b/tools/build/Build.include index 1dcb95e76f70..c4ae12a5d0a5 100644 --- a/tools/build/Build.include +++ b/tools/build/Build.include @@ -89,7 +89,9 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ # - per target C flags # - per object C flags # - BUILD_STR macro to allow '-D"$(variable)"' constructs -c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj)) +c_flags_1 = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj)) +c_flags_2 = $(filter-out $(CFLAGS_REMOVE_$(basetarget).o), $(c_flags_1)) +c_flags = $(filter-out $(CFLAGS_REMOVE_$(obj)), $(c_flags_2)) cxx_flags = -Wp,-MD,$(depfile),-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXXFLAGS_$(basetarget).o) $(CXXFLAGS_$(obj)) ### diff --git a/tools/build/Documentation/Build.txt b/tools/build/Documentation/Build.txt index a47bffbae159..a22587475dbe 100644 --- a/tools/build/Documentation/Build.txt +++ b/tools/build/Documentation/Build.txt @@ -135,8 +135,10 @@ CFLAGS It's possible to alter the standard object C flags in the following way: - CFLAGS_perf.o += '...' - alters CFLAGS for perf.o object - CFLAGS_gtk += '...' - alters CFLAGS for gtk build object + CFLAGS_perf.o += '...' - adds CFLAGS for perf.o object + CFLAGS_gtk += '...' - adds CFLAGS for gtk build object + CFLAGS_REMOVE_perf.o += '...' - removes CFLAGS for perf.o object + CFLAGS_REMOVE_gtk += '...' - removes CFLAGS for gtk build object This C flags changes has the scope of the Build makefile they are defined in. -- 2.7.4