From patchwork Mon Apr 20 12:01:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Gouders X-Patchwork-Id: 6241731 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4B7D9BF4A6 for ; Mon, 20 Apr 2015 12:43:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D77632041E for ; Mon, 20 Apr 2015 12:43:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D2632034A for ; Mon, 20 Apr 2015 12:43:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754973AbbDTMnE (ORCPT ); Mon, 20 Apr 2015 08:43:04 -0400 Received: from services.gouders.net ([141.101.32.176]:34415 "EHLO services.gouders.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754789AbbDTMnD (ORCPT ); Mon, 20 Apr 2015 08:43:03 -0400 X-Greylist: delayed 466 seconds by postgrey-1.27 at vger.kernel.org; Mon, 20 Apr 2015 08:43:03 EDT Received: from localhost ([193.175.198.193]) (authenticated bits=0) by services.gouders.net (8.14.8/8.14.8) with ESMTP id t3KCU4uV015465 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 20 Apr 2015 14:30:04 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gouders.net; s=gnet; t=1429533005; bh=wpiEMRtEwbgoAwqntXhRvf8TeWEiyQV3yjQcxU6v0Vg=; h=From:To:Cc:Subject:Date; b=EMNTPdh90cGbgYxiY7DbA7U1mZOX7fUZf9rFZ+J9KrPGu64xm6iNj0Uiv4StxTzBA xNY+IzXuTC2Pr6b1zlcU/kJN/ZFJTFN2uEjzF5yRkZ/cxDm4RWvderFbHZM5+pwoZv OWLkLmjj3Ii8oZKCrk10P6IGfRrPC1RDssaH74WA= From: Dirk Gouders To: Arnaldo Carvalho de Melo Cc: Peter Zijlstra , Paul Mackerras , Ingo Molnar , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE Date: Mon, 20 Apr 2015 14:01:19 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Message-ID: MIME-Version: 1.0 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIM_ADSP_DISCARD, DKIM_SIGNED,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For example on Gentoo systems where _FORTIFY_SOURCE is set by default, `make -C tools/perf' fails, because of the macro being redefined. Fix that by a feature-check analogous to tools/perf/config/Makefile. Signed-off-by: Dirk Gouders --- tools/lib/api/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile index d8fe29f..acf9097 100644 --- a/tools/lib/api/Makefile +++ b/tools/lib/api/Makefile @@ -16,7 +16,14 @@ MAKEFLAGS += --no-print-directory LIBFILE = $(OUTPUT)libapi.a CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC +CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fPIC + +ifeq ($(DEBUG),0) + ifeq ($(feature-fortify-source), 1) + CFLAGS += -D_FORTIFY_SOURCE=2 + endif +endif + CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 RM = rm -f