diff options
author | David Daney <david.daney@cavium.com> | 2012-01-17 16:41:01 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-01-24 17:26:33 -0500 |
commit | 2ef1ea3826434bdebe17b2941356a8f764ff5fcd (patch) | |
tree | 50e6d1272b370b7a52a3f7a0bffbc0e4908fc979 /tools/perf/Makefile | |
parent | e3e877e79b7c6a322f9f628e87052c13581238cc (diff) |
perf tools: Fix broken build by defining _GNU_SOURCE in Makefile
When building on my Debian/mips system, util/util.c fails to build
because commit 1aed2671738785e8f5aea663a6fda91aa7ef59b5 (perf kvm: Do
guest-only counting by default) indirectly includes stdio.h before the
feature selection in util.h is done. This prevents _GNU_SOURCE in
util.h from enabling the declaration of getline(), from now second
inclusion of stdio.h, and the build is broken.
There is another breakage in util/evsel.c caused by include ordering,
but I didn't fully track down the commit that caused it.
The root cause of all this is an inconsistent definition of _GNU_SOURCE,
so I move the definition into the Makefile so that it is passed to all
invocations of the compiler and used uniformly for all system header
files. All other #define and #undef of _GNU_SOURCE are removed as they
cause conflicts with the definition passed to the compiler.
All the features.h definitions (_LARGEFILE64_SOURCE _FILE_OFFSET_BITS=64
and _GNU_SOURCE) are needed by the python glue code too, so they are
moved to BASIC_CFLAGS, and the misleading comments about BASIC_CFLAGS
are removed.
This gives me a clean build on x86_64 (fc12) and mips (Debian).
Cc: David Daney <david.daney@cavium.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1326836461-11952-1-git-send-email-ddaney.cavm@gmail.com
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 599031ac69ac..d64f5819a380 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -104,7 +104,7 @@ endif | |||
104 | 104 | ||
105 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) | 105 | CFLAGS = -fno-omit-frame-pointer -ggdb3 -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) |
106 | EXTLIBS = -lpthread -lrt -lelf -lm | 106 | EXTLIBS = -lpthread -lrt -lelf -lm |
107 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 | 107 | ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
108 | ALL_LDFLAGS = $(LDFLAGS) | 108 | ALL_LDFLAGS = $(LDFLAGS) |
109 | STRIP ?= strip | 109 | STRIP ?= strip |
110 | 110 | ||
@@ -168,10 +168,7 @@ endif | |||
168 | 168 | ||
169 | ### --- END CONFIGURATION SECTION --- | 169 | ### --- END CONFIGURATION SECTION --- |
170 | 170 | ||
171 | # Those must not be GNU-specific; they are shared with perl/ which may | 171 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE |
172 | # be built by a different compiler. (Note that this is an artifact now | ||
173 | # but it still might be nice to keep that distinction.) | ||
174 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include | ||
175 | BASIC_LDFLAGS = | 172 | BASIC_LDFLAGS = |
176 | 173 | ||
177 | # Guard against environment variables | 174 | # Guard against environment variables |