Makefile (43315956509ca6913764861ac7dec128b91eb1ec) Makefile (84087126d50400789b44459cfc45721778e6ebb0)
1# The default target of this Makefile is...
2all::
3
4# Define V=1 to have a more verbose compile.
5#
6# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
7# or vsnprintf() return -1 instead of number of characters which would
8# have been written to the final string if enough space had been available.

--- 187 unchanged lines hidden (view full) ---

196EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
197EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
198EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
199EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
200EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
201EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
202EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
203
1# The default target of this Makefile is...
2all::
3
4# Define V=1 to have a more verbose compile.
5#
6# Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()
7# or vsnprintf() return -1 instead of number of characters which would
8# have been written to the final string if enough space had been available.

--- 187 unchanged lines hidden (view full) ---

196EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wbad-function-cast
197EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-declarations
198EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wmissing-prototypes
199EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wnested-externs
200EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wold-style-definition
201EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wstrict-prototypes
202EXTRA_WARNINGS := $(EXTRA_WARNINGS) -Wdeclaration-after-statement
203
204ifeq ("$(origin DEBUG)", "command line")
205 PERF_DEBUG = $(DEBUG)
206endif
207ifndef PERF_DEBUG
208 CFLAGS_OPTIMIZE = -O6
209endif
210
211CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror $(CFLAGS_OPTIMIZE) -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
204CFLAGS = $(MBITS) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
212LDFLAGS = -lpthread -lrt -lelf -lm
213ALL_CFLAGS = $(CFLAGS)
214ALL_LDFLAGS = $(LDFLAGS)
215STRIP ?= strip
216
217# Among the variables below, these:
218# perfexecdir
219# template_dir

--- 110 unchanged lines hidden (view full) ---

330
331export PERL_PATH
332
333LIB_FILE=libperf.a
334
335LIB_H += ../../include/linux/perf_event.h
336LIB_H += ../../include/linux/rbtree.h
337LIB_H += ../../include/linux/list.h
205LDFLAGS = -lpthread -lrt -lelf -lm
206ALL_CFLAGS = $(CFLAGS)
207ALL_LDFLAGS = $(LDFLAGS)
208STRIP ?= strip
209
210# Among the variables below, these:
211# perfexecdir
212# template_dir

--- 110 unchanged lines hidden (view full) ---

323
324export PERL_PATH
325
326LIB_FILE=libperf.a
327
328LIB_H += ../../include/linux/perf_event.h
329LIB_H += ../../include/linux/rbtree.h
330LIB_H += ../../include/linux/list.h
338LIB_H += ../../include/linux/stringify.h
339LIB_H += util/include/linux/bitmap.h
340LIB_H += util/include/linux/bitops.h
341LIB_H += util/include/linux/compiler.h
342LIB_H += util/include/linux/ctype.h
343LIB_H += util/include/linux/kernel.h
344LIB_H += util/include/linux/list.h
331LIB_H += util/include/linux/list.h
345LIB_H += util/include/linux/module.h
346LIB_H += util/include/linux/poison.h
347LIB_H += util/include/linux/prefetch.h
348LIB_H += util/include/linux/rbtree.h
349LIB_H += util/include/linux/string.h
350LIB_H += util/include/linux/types.h
351LIB_H += util/include/asm/asm-offsets.h
352LIB_H += util/include/asm/bitops.h
353LIB_H += util/include/asm/byteorder.h
354LIB_H += util/include/asm/swab.h
355LIB_H += util/include/asm/system.h
356LIB_H += util/include/asm/uaccess.h
357LIB_H += perf.h
332LIB_H += perf.h
358LIB_H += util/event.h
359LIB_H += util/types.h
360LIB_H += util/levenshtein.h
361LIB_H += util/parse-options.h
362LIB_H += util/parse-events.h
363LIB_H += util/quote.h
364LIB_H += util/util.h
365LIB_H += util/help.h
366LIB_H += util/strbuf.h
367LIB_H += util/string.h
368LIB_H += util/strlist.h
369LIB_H += util/run-command.h
370LIB_H += util/sigchain.h
371LIB_H += util/symbol.h
333LIB_H += util/types.h
334LIB_H += util/levenshtein.h
335LIB_H += util/parse-options.h
336LIB_H += util/parse-events.h
337LIB_H += util/quote.h
338LIB_H += util/util.h
339LIB_H += util/help.h
340LIB_H += util/strbuf.h
341LIB_H += util/string.h
342LIB_H += util/strlist.h
343LIB_H += util/run-command.h
344LIB_H += util/sigchain.h
345LIB_H += util/symbol.h
346LIB_H += util/module.h
372LIB_H += util/color.h
373LIB_H += util/values.h
347LIB_H += util/color.h
348LIB_H += util/values.h
374LIB_H += util/sort.h
375LIB_H += util/hist.h
376LIB_H += util/thread.h
377LIB_H += util/data_map.h
378
379LIB_OBJS += util/abspath.o
380LIB_OBJS += util/alias.o
381LIB_OBJS += util/config.o
382LIB_OBJS += util/ctype.o
383LIB_OBJS += util/environment.o
384LIB_OBJS += util/exec_cmd.o
385LIB_OBJS += util/help.o
386LIB_OBJS += util/levenshtein.o
387LIB_OBJS += util/parse-options.o
388LIB_OBJS += util/parse-events.o
389LIB_OBJS += util/path.o
390LIB_OBJS += util/rbtree.o
349
350LIB_OBJS += util/abspath.o
351LIB_OBJS += util/alias.o
352LIB_OBJS += util/config.o
353LIB_OBJS += util/ctype.o
354LIB_OBJS += util/environment.o
355LIB_OBJS += util/exec_cmd.o
356LIB_OBJS += util/help.o
357LIB_OBJS += util/levenshtein.o
358LIB_OBJS += util/parse-options.o
359LIB_OBJS += util/parse-events.o
360LIB_OBJS += util/path.o
361LIB_OBJS += util/rbtree.o
391LIB_OBJS += util/bitmap.o
392LIB_OBJS += util/hweight.o
393LIB_OBJS += util/find_next_bit.o
394LIB_OBJS += util/run-command.o
395LIB_OBJS += util/quote.o
396LIB_OBJS += util/strbuf.o
397LIB_OBJS += util/string.o
398LIB_OBJS += util/strlist.o
399LIB_OBJS += util/usage.o
400LIB_OBJS += util/wrapper.o
401LIB_OBJS += util/sigchain.o
402LIB_OBJS += util/symbol.o
362LIB_OBJS += util/run-command.o
363LIB_OBJS += util/quote.o
364LIB_OBJS += util/strbuf.o
365LIB_OBJS += util/string.o
366LIB_OBJS += util/strlist.o
367LIB_OBJS += util/usage.o
368LIB_OBJS += util/wrapper.o
369LIB_OBJS += util/sigchain.o
370LIB_OBJS += util/symbol.o
371LIB_OBJS += util/module.o
403LIB_OBJS += util/color.o
404LIB_OBJS += util/pager.o
405LIB_OBJS += util/header.o
406LIB_OBJS += util/callchain.o
407LIB_OBJS += util/values.o
408LIB_OBJS += util/debug.o
409LIB_OBJS += util/map.o
410LIB_OBJS += util/thread.o
411LIB_OBJS += util/trace-event-parse.o
412LIB_OBJS += util/trace-event-read.o
413LIB_OBJS += util/trace-event-info.o
414LIB_OBJS += util/svghelper.o
372LIB_OBJS += util/color.o
373LIB_OBJS += util/pager.o
374LIB_OBJS += util/header.o
375LIB_OBJS += util/callchain.o
376LIB_OBJS += util/values.o
377LIB_OBJS += util/debug.o
378LIB_OBJS += util/map.o
379LIB_OBJS += util/thread.o
380LIB_OBJS += util/trace-event-parse.o
381LIB_OBJS += util/trace-event-read.o
382LIB_OBJS += util/trace-event-info.o
383LIB_OBJS += util/svghelper.o
415LIB_OBJS += util/sort.o
416LIB_OBJS += util/hist.o
417LIB_OBJS += util/data_map.o
418
419BUILTIN_OBJS += builtin-annotate.o
420BUILTIN_OBJS += builtin-help.o
421BUILTIN_OBJS += builtin-sched.o
422BUILTIN_OBJS += builtin-list.o
423BUILTIN_OBJS += builtin-record.o
424BUILTIN_OBJS += builtin-report.o
425BUILTIN_OBJS += builtin-stat.o
426BUILTIN_OBJS += builtin-timechart.o
427BUILTIN_OBJS += builtin-top.o
428BUILTIN_OBJS += builtin-trace.o
384
385BUILTIN_OBJS += builtin-annotate.o
386BUILTIN_OBJS += builtin-help.o
387BUILTIN_OBJS += builtin-sched.o
388BUILTIN_OBJS += builtin-list.o
389BUILTIN_OBJS += builtin-record.o
390BUILTIN_OBJS += builtin-report.o
391BUILTIN_OBJS += builtin-stat.o
392BUILTIN_OBJS += builtin-timechart.o
393BUILTIN_OBJS += builtin-top.o
394BUILTIN_OBJS += builtin-trace.o
429BUILTIN_OBJS += builtin-probe.o
430
431PERFLIBS = $(LIB_FILE)
432
433#
434# Platform specific tweaks
435#
436
437# We choose to avoid "if .. else if .. else .. endif endif"

--- 14 unchanged lines hidden (view full) ---

452 ifeq ($(shell test -d /opt/local/lib && echo y),y)
453 BASIC_CFLAGS += -I/opt/local/include
454 BASIC_LDFLAGS += -L/opt/local/lib
455 endif
456 endif
457 PTHREAD_LIBS =
458endif
459
395
396PERFLIBS = $(LIB_FILE)
397
398#
399# Platform specific tweaks
400#
401
402# We choose to avoid "if .. else if .. else .. endif endif"

--- 14 unchanged lines hidden (view full) ---

417 ifeq ($(shell test -d /opt/local/lib && echo y),y)
418 BASIC_CFLAGS += -I/opt/local/include
419 BASIC_LDFLAGS += -L/opt/local/lib
420 endif
421 endif
422 PTHREAD_LIBS =
423endif
424
460ifneq ($(shell sh -c "(echo '\#include <gnu/libc-version.h>'; echo 'int main(void) { const char * version = gnu_get_libc_version(); return (long)version; }') | $(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)
461 msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]);
462endif
463
464ifneq ($(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)
465 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel);
466endif
467
468ifneq ($(shell sh -c "(echo '\#include <libdwarf/dwarf.h>'; echo '\#include <libdwarf/libdwarf.h>'; echo 'int main(void) { Dwarf_Debug dbg; Dwarf_Error err; Dwarf_Ranges *rng; dwarf_init(0, DW_DLC_READ, 0, 0, &dbg, &err); dwarf_get_ranges(dbg, 0, &rng, 0, 0, &err); return (long)dbg; }') | $(CC) -x c - $(ALL_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -ldwarf -lelf -o /dev/null $(ALL_LDFLAGS) > /dev/null 2>&1 && echo y"), y)
469 msg := $(warning No libdwarf.h found or old libdwarf.h found, disables dwarf support. Please install libdwarf-dev/libdwarf-devel >= 20081231);
470 BASIC_CFLAGS += -DNO_LIBDWARF
425ifeq ($(shell sh -c "(echo '\#include <libelf.h>'; echo 'int main(void) { Elf * elf = elf_begin(0, ELF_C_READ, 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)
426 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)
427 BASIC_CFLAGS += -DLIBELF_NO_MMAP
428 endif
471else
429else
472 EXTLIBS += -lelf -ldwarf
473 LIB_H += util/probe-finder.h
474 LIB_OBJS += util/probe-finder.o
430 msg := $(error No libelf.h/libelf found, please install libelf-dev/elfutils-libelf-devel and glibc-dev[el]);
475endif
476
477ifdef NO_DEMANGLE
478 BASIC_CFLAGS += -DNO_DEMANGLE
479else
480 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")
481
482 ifeq ($(has_bfd),y)

--- 344 unchanged lines hidden (view full) ---

827 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_PERF_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
828
829util/config.o: util/config.c PERF-CFLAGS
830 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
831
832util/rbtree.o: ../../lib/rbtree.c PERF-CFLAGS
833 $(QUIET_CC)$(CC) -o util/rbtree.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
834
431endif
432
433ifdef NO_DEMANGLE
434 BASIC_CFLAGS += -DNO_DEMANGLE
435else
436 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")
437
438 ifeq ($(has_bfd),y)

--- 344 unchanged lines hidden (view full) ---

783 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DDEFAULT_PERF_TEMPLATE_DIR='"$(template_dir_SQ)"' $<
784
785util/config.o: util/config.c PERF-CFLAGS
786 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
787
788util/rbtree.o: ../../lib/rbtree.c PERF-CFLAGS
789 $(QUIET_CC)$(CC) -o util/rbtree.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
790
835# some perf warning policies can't fit to lib/bitmap.c, eg: it warns about variable shadowing
836# from <string.h> that comes from kernel headers wrapping.
837KBITMAP_FLAGS=`echo $(ALL_CFLAGS) | sed s/-Wshadow// | sed s/-Wswitch-default// | sed s/-Wextra//`
838
839util/bitmap.o: ../../lib/bitmap.c PERF-CFLAGS
840 $(QUIET_CC)$(CC) -o util/bitmap.o -c $(KBITMAP_FLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
841
842util/hweight.o: ../../lib/hweight.c PERF-CFLAGS
843 $(QUIET_CC)$(CC) -o util/hweight.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
844
845util/find_next_bit.o: ../../lib/find_next_bit.c PERF-CFLAGS
846 $(QUIET_CC)$(CC) -o util/find_next_bit.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
847
848perf-%$X: %.o $(PERFLIBS)
849 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
850
851$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
852$(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
853builtin-revert.o wt-status.o: wt-status.h
854
855$(LIB_FILE): $(LIB_OBJS)

--- 232 unchanged lines hidden ---
791perf-%$X: %.o $(PERFLIBS)
792 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
793
794$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
795$(patsubst perf-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
796builtin-revert.o wt-status.o: wt-status.h
797
798$(LIB_FILE): $(LIB_OBJS)

--- 232 unchanged lines hidden ---