diff options
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r-- | tools/perf/Makefile | 49 |
1 files changed, 36 insertions, 13 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 9c6d0ae3708e..1916e44b9bb0 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -158,13 +158,15 @@ uname_P := $(shell sh -c 'uname -p 2>/dev/null || echo not') | |||
158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') | 158 | uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') |
159 | 159 | ||
160 | # If we're on a 64-bit kernel, use -m64 | 160 | # If we're on a 64-bit kernel, use -m64 |
161 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) | 161 | ifndef NO_64BIT |
162 | M64 := -m64 | 162 | ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) |
163 | M64 := -m64 | ||
164 | endif | ||
163 | endif | 165 | endif |
164 | 166 | ||
165 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 167 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
166 | 168 | ||
167 | CFLAGS = $(M64) -ggdb3 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6 | 169 | CFLAGS = $(M64) -ggdb3 -Wall -Wextra -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6 |
168 | LDFLAGS = -lpthread -lrt -lelf -lm | 170 | LDFLAGS = -lpthread -lrt -lelf -lm |
169 | ALL_CFLAGS = $(CFLAGS) | 171 | ALL_CFLAGS = $(CFLAGS) |
170 | ALL_LDFLAGS = $(LDFLAGS) | 172 | ALL_LDFLAGS = $(LDFLAGS) |
@@ -223,7 +225,7 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ | |||
223 | # Those must not be GNU-specific; they are shared with perl/ which may | 225 | # Those must not be GNU-specific; they are shared with perl/ which may |
224 | # be built by a different compiler. (Note that this is an artifact now | 226 | # be built by a different compiler. (Note that this is an artifact now |
225 | # but it still might be nice to keep that distinction.) | 227 | # but it still might be nice to keep that distinction.) |
226 | BASIC_CFLAGS = | 228 | BASIC_CFLAGS = -Iutil/include |
227 | BASIC_LDFLAGS = | 229 | BASIC_LDFLAGS = |
228 | 230 | ||
229 | # Guard against environment variables | 231 | # Guard against environment variables |
@@ -289,10 +291,11 @@ export PERL_PATH | |||
289 | LIB_FILE=libperf.a | 291 | LIB_FILE=libperf.a |
290 | 292 | ||
291 | LIB_H += ../../include/linux/perf_counter.h | 293 | LIB_H += ../../include/linux/perf_counter.h |
294 | LIB_H += ../../include/linux/rbtree.h | ||
295 | LIB_H += ../../include/linux/list.h | ||
296 | LIB_H += util/include/linux/list.h | ||
292 | LIB_H += perf.h | 297 | LIB_H += perf.h |
293 | LIB_H += util/types.h | 298 | LIB_H += util/types.h |
294 | LIB_H += util/list.h | ||
295 | LIB_H += util/rbtree.h | ||
296 | LIB_H += util/levenshtein.h | 299 | LIB_H += util/levenshtein.h |
297 | LIB_H += util/parse-options.h | 300 | LIB_H += util/parse-options.h |
298 | LIB_H += util/parse-events.h | 301 | LIB_H += util/parse-events.h |
@@ -305,6 +308,7 @@ LIB_H += util/strlist.h | |||
305 | LIB_H += util/run-command.h | 308 | LIB_H += util/run-command.h |
306 | LIB_H += util/sigchain.h | 309 | LIB_H += util/sigchain.h |
307 | LIB_H += util/symbol.h | 310 | LIB_H += util/symbol.h |
311 | LIB_H += util/module.h | ||
308 | LIB_H += util/color.h | 312 | LIB_H += util/color.h |
309 | 313 | ||
310 | LIB_OBJS += util/abspath.o | 314 | LIB_OBJS += util/abspath.o |
@@ -328,6 +332,7 @@ LIB_OBJS += util/usage.o | |||
328 | LIB_OBJS += util/wrapper.o | 332 | LIB_OBJS += util/wrapper.o |
329 | LIB_OBJS += util/sigchain.o | 333 | LIB_OBJS += util/sigchain.o |
330 | LIB_OBJS += util/symbol.o | 334 | LIB_OBJS += util/symbol.o |
335 | LIB_OBJS += util/module.o | ||
331 | LIB_OBJS += util/color.o | 336 | LIB_OBJS += util/color.o |
332 | LIB_OBJS += util/pager.o | 337 | LIB_OBJS += util/pager.o |
333 | LIB_OBJS += util/header.o | 338 | LIB_OBJS += util/header.o |
@@ -342,7 +347,6 @@ BUILTIN_OBJS += builtin-stat.o | |||
342 | BUILTIN_OBJS += builtin-top.o | 347 | BUILTIN_OBJS += builtin-top.o |
343 | 348 | ||
344 | PERFLIBS = $(LIB_FILE) | 349 | PERFLIBS = $(LIB_FILE) |
345 | EXTLIBS = | ||
346 | 350 | ||
347 | # | 351 | # |
348 | # Platform specific tweaks | 352 | # Platform specific tweaks |
@@ -371,6 +375,28 @@ ifeq ($(uname_S),Darwin) | |||
371 | PTHREAD_LIBS = | 375 | PTHREAD_LIBS = |
372 | endif | 376 | endif |
373 | 377 | ||
378 | ifneq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ_MMAP, 0); return (long)elf; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y) | ||
379 | msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel); | ||
380 | endif | ||
381 | |||
382 | ifdef NO_DEMANGLE | ||
383 | BASIC_CFLAGS += -DNO_DEMANGLE | ||
384 | else | ||
385 | |||
386 | has_bfd := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd > /dev/null 2>&1 && echo y") | ||
387 | |||
388 | has_bfd_iberty := $(shell sh -c "(echo '\#include <bfd.h>'; echo 'int main(void) { bfd_demangle(0, 0, 0); return 0; }') | $(CC) -x c - $(ALL_CFLAGS) -o /dev/null $(ALL_LDFLAGS) -lbfd -liberty > /dev/null 2>&1 && echo y") | ||
389 | |||
390 | ifeq ($(has_bfd),y) | ||
391 | EXTLIBS += -lbfd | ||
392 | else ifeq ($(has_bfd_iberty),y) | ||
393 | EXTLIBS += -lbfd -liberty | ||
394 | else | ||
395 | msg := $(warning No bfd.h/libbfd found, install binutils-dev[el] to gain symbol demangling) | ||
396 | BASIC_CFLAGS += -DNO_DEMANGLE | ||
397 | endif | ||
398 | endif | ||
399 | |||
374 | ifndef CC_LD_DYNPATH | 400 | ifndef CC_LD_DYNPATH |
375 | ifdef NO_R_TO_GCC_LINKER | 401 | ifdef NO_R_TO_GCC_LINKER |
376 | # Some gcc does not accept and pass -R to the linker to specify | 402 | # Some gcc does not accept and pass -R to the linker to specify |
@@ -381,12 +407,6 @@ ifndef CC_LD_DYNPATH | |||
381 | endif | 407 | endif |
382 | endif | 408 | endif |
383 | 409 | ||
384 | ifdef ZLIB_PATH | ||
385 | BASIC_CFLAGS += -I$(ZLIB_PATH)/include | ||
386 | EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib) | ||
387 | endif | ||
388 | EXTLIBS += -lz | ||
389 | |||
390 | ifdef NEEDS_SOCKET | 410 | ifdef NEEDS_SOCKET |
391 | EXTLIBS += -lsocket | 411 | EXTLIBS += -lsocket |
392 | endif | 412 | endif |
@@ -697,6 +717,9 @@ builtin-init-db.o: builtin-init-db.c PERF-CFLAGS | |||
697 | util/config.o: util/config.c PERF-CFLAGS | 717 | util/config.o: util/config.c PERF-CFLAGS |
698 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | 718 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< |
699 | 719 | ||
720 | util/rbtree.o: ../../lib/rbtree.c PERF-CFLAGS | ||
721 | $(QUIET_CC)$(CC) -o util/rbtree.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | ||
722 | |||
700 | perf-%$X: %.o $(PERFLIBS) | 723 | perf-%$X: %.o $(PERFLIBS) |
701 | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) | 724 | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) |
702 | 725 | ||