aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/Makefile')
-rw-r--r--tools/perf/Makefile49
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')
158uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not') 158uname_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
161ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M)) 161ifndef NO_64BIT
162 M64 := -m64 162 ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
163 M64 := -m64
164 endif
163endif 165endif
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
167CFLAGS = $(M64) -ggdb3 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6 169CFLAGS = $(M64) -ggdb3 -Wall -Wextra -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6
168LDFLAGS = -lpthread -lrt -lelf -lm 170LDFLAGS = -lpthread -lrt -lelf -lm
169ALL_CFLAGS = $(CFLAGS) 171ALL_CFLAGS = $(CFLAGS)
170ALL_LDFLAGS = $(LDFLAGS) 172ALL_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.)
226BASIC_CFLAGS = 228BASIC_CFLAGS = -Iutil/include
227BASIC_LDFLAGS = 229BASIC_LDFLAGS =
228 230
229# Guard against environment variables 231# Guard against environment variables
@@ -289,10 +291,11 @@ export PERL_PATH
289LIB_FILE=libperf.a 291LIB_FILE=libperf.a
290 292
291LIB_H += ../../include/linux/perf_counter.h 293LIB_H += ../../include/linux/perf_counter.h
294LIB_H += ../../include/linux/rbtree.h
295LIB_H += ../../include/linux/list.h
296LIB_H += util/include/linux/list.h
292LIB_H += perf.h 297LIB_H += perf.h
293LIB_H += util/types.h 298LIB_H += util/types.h
294LIB_H += util/list.h
295LIB_H += util/rbtree.h
296LIB_H += util/levenshtein.h 299LIB_H += util/levenshtein.h
297LIB_H += util/parse-options.h 300LIB_H += util/parse-options.h
298LIB_H += util/parse-events.h 301LIB_H += util/parse-events.h
@@ -305,6 +308,7 @@ LIB_H += util/strlist.h
305LIB_H += util/run-command.h 308LIB_H += util/run-command.h
306LIB_H += util/sigchain.h 309LIB_H += util/sigchain.h
307LIB_H += util/symbol.h 310LIB_H += util/symbol.h
311LIB_H += util/module.h
308LIB_H += util/color.h 312LIB_H += util/color.h
309 313
310LIB_OBJS += util/abspath.o 314LIB_OBJS += util/abspath.o
@@ -328,6 +332,7 @@ LIB_OBJS += util/usage.o
328LIB_OBJS += util/wrapper.o 332LIB_OBJS += util/wrapper.o
329LIB_OBJS += util/sigchain.o 333LIB_OBJS += util/sigchain.o
330LIB_OBJS += util/symbol.o 334LIB_OBJS += util/symbol.o
335LIB_OBJS += util/module.o
331LIB_OBJS += util/color.o 336LIB_OBJS += util/color.o
332LIB_OBJS += util/pager.o 337LIB_OBJS += util/pager.o
333LIB_OBJS += util/header.o 338LIB_OBJS += util/header.o
@@ -342,7 +347,6 @@ BUILTIN_OBJS += builtin-stat.o
342BUILTIN_OBJS += builtin-top.o 347BUILTIN_OBJS += builtin-top.o
343 348
344PERFLIBS = $(LIB_FILE) 349PERFLIBS = $(LIB_FILE)
345EXTLIBS =
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 =
372endif 376endif
373 377
378ifneq ($(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);
380endif
381
382ifdef NO_DEMANGLE
383 BASIC_CFLAGS += -DNO_DEMANGLE
384else
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
398endif
399
374ifndef CC_LD_DYNPATH 400ifndef 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
382endif 408endif
383 409
384ifdef ZLIB_PATH
385 BASIC_CFLAGS += -I$(ZLIB_PATH)/include
386 EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib)
387endif
388EXTLIBS += -lz
389
390ifdef NEEDS_SOCKET 410ifdef NEEDS_SOCKET
391 EXTLIBS += -lsocket 411 EXTLIBS += -lsocket
392endif 412endif
@@ -697,6 +717,9 @@ builtin-init-db.o: builtin-init-db.c PERF-CFLAGS
697util/config.o: util/config.c PERF-CFLAGS 717util/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
720util/rbtree.o: ../../lib/rbtree.c PERF-CFLAGS
721 $(QUIET_CC)$(CC) -o util/rbtree.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
722
700perf-%$X: %.o $(PERFLIBS) 723perf-%$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