linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Sam Ravnborg <sam@ravnborg.org>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 36/66] perf tools: Move compiler and linker flags check into config/Makefile
Date: Thu, 30 May 2013 19:01:09 +0300	[thread overview]
Message-ID: <1369929699-8724-37-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1369929699-8724-1-git-send-email-acme@infradead.org>

From: Jiri Olsa <jolsa@redhat.com>

Moving compiler and linker flags check into config/Makefile.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-5-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Makefile        | 110 ++++++++-------------------------------------
 tools/perf/config/Makefile |  66 +++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 91 deletions(-)

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 2a75476..aa6f933 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -52,6 +52,20 @@ include config/utilities.mak
 #
 # Define NO_LIBNUMA if you do not want numa perf benchmark
 
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+#$(info Determined 'srctree' to be $(srctree))
+endif
+
+ifneq ($(objtree),)
+#$(info Determined 'objtree' to be $(objtree))
+endif
+
+ifneq ($(OUTPUT),)
+#$(info Determined 'OUTPUT' to be $(OUTPUT))
+endif
+
 $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
 	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
 
@@ -66,6 +80,9 @@ FLEX    = flex
 BISON   = bison
 STRIP  ?= strip
 
+LK_DIR = ../lib/lk/
+TRACE_EVENT_DIR = ../lib/traceevent/
+
 # include config/Makefile by default and rule out
 # non-config cases
 config := 1
@@ -82,33 +99,10 @@ ifeq ($(config),1)
 include config/Makefile
 endif
 
-# Treat warnings as errors unless directed not to
-ifneq ($(WERROR),0)
-  CFLAGS_WERROR := -Werror
-endif
-
-ifeq ("$(origin DEBUG)", "command line")
-  PERF_DEBUG = $(DEBUG)
-endif
-ifndef PERF_DEBUG
-  CFLAGS_OPTIMIZE = -O6
-endif
-
-ifdef PARSER_DEBUG
-	PARSER_DEBUG_BISON  := -t
-	PARSER_DEBUG_FLEX   := -d
-	PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
-endif
-
 ifdef NO_NEWT
 	NO_SLANG=1
 endif
 
-CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
-EXTLIBS = -lpthread -lrt -lelf -lm
-ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-ALL_LDFLAGS = $(LDFLAGS)
-
 # Among the variables below, these:
 #   perfexecdir
 #   template_dir
@@ -148,71 +142,6 @@ export prefix bindir sharedir sysconfdir
 # explicitly what architecture to check for. Fix this up for yours..
 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 
-ifneq ($(MAKECMDGOALS),clean)
-ifneq ($(MAKECMDGOALS),tags)
--include config/feature-tests.mak
-
-ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
-	CFLAGS := $(CFLAGS) -fstack-protector-all
-endif
-
-ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
-       CFLAGS := $(CFLAGS) -Wstack-protector
-endif
-
-ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
-       CFLAGS := $(CFLAGS) -Wvolatile-register-var
-endif
-
-ifndef PERF_DEBUG
-	ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
-		CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
-	endif
-endif
-
-### --- END CONFIGURATION SECTION ---
-
-ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
-srctree := $(patsubst %/,%,$(dir $(srctree)))
-#$(info Determined 'srctree' to be $(srctree))
-endif
-
-ifneq ($(objtree),)
-#$(info Determined 'objtree' to be $(objtree))
-endif
-
-ifneq ($(OUTPUT),)
-#$(info Determined 'OUTPUT' to be $(OUTPUT))
-endif
-
-BASIC_CFLAGS += \
-	-Iutil/include \
-	-Iarch/$(ARCH)/include \
-	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
-	-I$(srctree)/arch/$(ARCH)/include/uapi \
-	-I$(srctree)/arch/$(ARCH)/include \
-	$(if $(objtree),-I$(objtree)/include/generated/uapi) \
-	-I$(srctree)/include/uapi \
-	-I$(srctree)/include \
-	-I$(OUTPUT)util \
-	-Iutil \
-	-I. \
-	-I$(TRACE_EVENT_DIR) \
-	-I../lib/ \
-	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-
-BASIC_LDFLAGS =
-
-ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
-	BIONIC := 1
-	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
-	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
-	BASIC_CFLAGS += -I.
-endif
-endif # MAKECMDGOALS != tags
-endif # MAKECMDGOALS != clean
-
 # Guard against environment variables
 BUILTIN_OBJS =
 LIB_H =
@@ -225,9 +154,6 @@ SCRIPT_SH += perf-archive.sh
 grep-libs = $(filter -l%,$(1))
 strip-libs = $(filter-out -l%,$(1))
 
-LK_DIR = ../lib/lk/
-TRACE_EVENT_DIR = ../lib/traceevent/
-
 LK_PATH=$(LK_DIR)
 
 ifneq ($(OUTPUT),)
@@ -541,6 +467,8 @@ PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT)
 ifneq ($(MAKECMDGOALS),clean)
 ifneq ($(MAKECMDGOALS),tags)
 
+-include config/feature-tests.mak
+
 # We choose to avoid "if .. else if .. else .. endif endif"
 # because maintaining the nesting to match is a pain.  If
 # we had "elif" things would have been much nicer...
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 04bf8ac..8acbcfe 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -42,3 +42,69 @@ endif
 ifeq ($(call get-executable,$(BISON)),)
 	dummy := $(error Error: $(BISON) is missing on this system, please install it)
 endif
+
+# Treat warnings as errors unless directed not to
+ifneq ($(WERROR),0)
+	CFLAGS_WERROR := -Werror
+endif
+
+ifeq ("$(origin DEBUG)", "command line")
+	PERF_DEBUG = $(DEBUG)
+endif
+ifndef PERF_DEBUG
+	CFLAGS_OPTIMIZE = -O6
+endif
+
+ifdef PARSER_DEBUG
+	PARSER_DEBUG_BISON  := -t
+	PARSER_DEBUG_FLEX   := -d
+	PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
+endif
+
+CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
+EXTLIBS = -lpthread -lrt -lelf -lm
+ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+ALL_LDFLAGS = $(LDFLAGS)
+
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
+	CFLAGS := $(CFLAGS) -fstack-protector-all
+endif
+
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
+	CFLAGS := $(CFLAGS) -Wstack-protector
+endif
+
+ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
+	CFLAGS := $(CFLAGS) -Wvolatile-register-var
+endif
+
+ifndef PERF_DEBUG
+	ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
+		CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
+	endif
+endif
+
+BASIC_CFLAGS += \
+	-Iutil/include \
+	-Iarch/$(ARCH)/include \
+	$(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
+	-I$(srctree)/arch/$(ARCH)/include/uapi \
+	-I$(srctree)/arch/$(ARCH)/include \
+	$(if $(objtree),-I$(objtree)/include/generated/uapi) \
+	-I$(srctree)/include/uapi \
+	-I$(srctree)/include \
+	-I$(OUTPUT)util \
+	-Iutil \
+	-I. \
+	-I$(TRACE_EVENT_DIR) \
+	-I../lib/ \
+	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
+
+BASIC_LDFLAGS =
+
+ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y)
+	BIONIC := 1
+	EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
+	EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
+	BASIC_CFLAGS += -I.
+endif
-- 
1.8.1.4


  parent reply	other threads:[~2013-05-30 16:07 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 16:00 [GIT PULL 00/66] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 01/66] perf tools: Fix bug in isupper() and islower() Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 02/66] perf hists: Fix an invalid memory free on he->branch_info Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 03/66] perf hists: Free unused mem info of a matched hist entry Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 04/66] perf report: Fix alignment of symbol column when -v is given Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 05/66] perf sort: Introduce sort__mode variable Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 06/66] perf sort: Factor out common code in sort_dimension__add() Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 07/66] perf sort: Separate out memory-specific sort keys Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 08/66] perf sort: Consolidate sort_entry__setup_elide() Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 09/66] perf archive: Fix typo on Documentation Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 10/66] perf sort: Reorder HISTC_SRCLINE index Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 11/66] perf sort: Cleanup sort__has_sym setting Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 12/66] perf top: Use sort__has_sym Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 13/66] perf hists browser: " Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 14/66] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 15/66] perf tests: Fix compile errors in bp_signal files Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 16/66] perf tools: Handle JITed code in shared memory Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 17/66] perf record: handle death by SIGTERM Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 18/66] perf top: Fix -E option behavior Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 19/66] perf top: Fix percent output when no samples collected Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 20/66] perf top: Get rid of *_threaded() functions Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 21/66] perf hists: Move locking to its call-sites Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 22/66] perf report: Don't bother locking when adding hist entries Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 23/66] perf report: Add --percent-limit option Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 24/66] perf top: " Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 25/66] perf report: Add report.percent-limit config variable Arnaldo Carvalho de Melo
2013-05-30 16:00 ` [PATCH 26/66] perf diff: Use internal rb tree for hists__precompute Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 27/66] perf hists: Rename hist_entry__add_pair arguments Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 28/66] perf test: Fix typo Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 29/66] perf evsel: Fix printing of perf_event_paranoid message Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 30/66] perf kvm: Handle realloc failures Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 31/66] perf stats: Fix divide by 0 in variance Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 32/66] perf tools: Save parent pid in thread struct Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 33/66] perf tools: Add automated make test suite Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 34/66] perf tools: Move arch check into config/Makefile Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 35/66] perf tools: Move programs " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` Arnaldo Carvalho de Melo [this message]
2013-05-30 16:01 ` [PATCH 37/66] perf tools: Move libelf check config " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 38/66] perf tools: Move libdw " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 39/66] perf tools: Move libunwind " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 40/66] perf tools: Move libaudit " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 41/66] perf tools: Move slang " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 42/66] perf tools: Move gtk2 " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 43/66] perf tools: Move libperl " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 44/66] perf tools: Move libpython " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 45/66] perf tools: Move libbfd " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 46/66] perf tools: Move stdlib " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 47/66] perf tools: Move libnuma " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 48/66] perf tools: Move paths " Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 49/66] perf tools: Final touches for CHK config move Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 50/66] perf tests: Fix attr test for record -d option Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 51/66] perf tests: Fix exclude_guest|exclude_host checking for attr tests Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 52/66] perf tools: Remove frozen from perf_header struct Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 53/66] perf tools: Remove cwdlen from struct perf_session Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 54/66] tools lib lk: Respect CROSS_COMPILE Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 55/66] perf: Power7: Make CPI stack events available in sysfs Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 56/66] perf: Power7 Update testing ABI to list CPI-stack events Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 57/66] perf: Expand definition of sysfs format attribute Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 58/66] perf evlist: Reset SIGTERM handler in workload child process Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 59/66] perf tools: Merge all *CFLAGS* make variable into CFLAGS Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 60/66] perf tools: Merge all *LDFLAGS* make variable into LDFLAGS Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 61/66] perf tools: Switch to full path C include directories Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 62/66] perf tools: Add NO_BIONIC variable to confiure bionic setup Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 63/66] perf tools: Replace tabs with spaces for all non-commands statements Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 64/66] perf tools: Replace multiple line assignment with multiple statements Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 65/66] perf tools: Remove '?=' Makefile STRIP assignment Arnaldo Carvalho de Melo
2013-05-30 16:01 ` [PATCH 66/66] perf tools: Add missing liblk.a dependency for python/perf.so Arnaldo Carvalho de Melo
2013-05-31 11:04 ` [GIT PULL 00/66] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369929699-8724-37-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=bp@alien8.de \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).