perf: Use default compiler mode by default

gcc with no flags typically is a sane default for systems to
use, and looking at the running kernel is probably broken for
cross-builds anyway, so let's not do this.  Add EXTRA_CFLAGS so
that users can override default gcc mode if they want to.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Arjan van de Ven <arjan@infradead.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <20091122121335.GA24254@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Michael S. Tsirkin 2009-11-22 14:13:35 +02:00 committed by Ingo Molnar
parent 50e5095afa
commit 81516c5fc8

View file

@ -148,6 +148,8 @@ all::
# broken, or spawning external process is slower than built-in grep perf has). # broken, or spawning external process is slower than built-in grep perf has).
# #
# Define LDFLAGS=-static to build a static binary. # Define LDFLAGS=-static to build a static binary.
#
# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
@$(SHELL_PATH) util/PERF-VERSION-GEN @$(SHELL_PATH) util/PERF-VERSION-GEN
@ -160,22 +162,6 @@ uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not')
uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
#
# Add -m32 for cross-builds:
#
ifdef NO_64BIT
MBITS := -m32
else
#
# If we're on a 64-bit kernel (except ia64), use -m64:
#
ifneq ($(uname_M),ia64)
ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
MBITS := -m64
endif
endif
endif
# CFLAGS and LDFLAGS are for the users to override from the command line. # CFLAGS and LDFLAGS are for the users to override from the command line.
# #
@ -212,7 +198,7 @@ ifndef PERF_DEBUG
CFLAGS_OPTIMIZE = -O6 CFLAGS_OPTIMIZE = -O6
endif endif
CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
EXTLIBS = -lpthread -lrt -lelf -lm EXTLIBS = -lpthread -lrt -lelf -lm
ALL_CFLAGS = $(CFLAGS) ALL_CFLAGS = $(CFLAGS)
ALL_LDFLAGS = $(LDFLAGS) ALL_LDFLAGS = $(LDFLAGS)