Commit 9c12cf95b32a099ac92ef0e9d138acb4bef984be

Authored by Jiri Olsa
Committed by Arnaldo Carvalho de Melo
1 parent 0817df08d3

perf tools: Merge all *CFLAGS* make variable into CFLAGS

Merging all *CFLAGS* make variable into CFLAGS to eliminate all special
*_CFLAGS_* variables and make the setup clear.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1369398928-9809-19-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Showing 3 changed files with 89 additions and 84 deletions Side-by-side Diff

... ... @@ -148,7 +148,7 @@
148 148 PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT)
149 149  
150 150 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
151   - $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
  151 + $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
152 152 --quiet build_ext; \
153 153 mkdir -p $(OUTPUT)python && \
154 154 cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
... ... @@ -429,7 +429,7 @@
429 429 -include arch/$(ARCH)/Makefile
430 430  
431 431 ifneq ($(OUTPUT),)
432   - BASIC_CFLAGS += -I$(OUTPUT)
  432 + CFLAGS += -I$(OUTPUT)
433 433 endif
434 434  
435 435 ifdef NO_LIBELF
... ... @@ -513,8 +513,6 @@
513 513  
514 514 LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
515 515  
516   -ALL_CFLAGS += $(BASIC_CFLAGS)
517   -ALL_CFLAGS += $(ARCH_CFLAGS)
518 516 ALL_LDFLAGS += $(BASIC_LDFLAGS)
519 517  
520 518 export INSTALL SHELL_PATH
521 519  
522 520  
523 521  
... ... @@ -536,20 +534,20 @@
536 534 $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
537 535 $(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \
538 536 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
539   - $(ALL_CFLAGS) -c $(filter %.c,$^) -o $@
  537 + $(CFLAGS) -c $(filter %.c,$^) -o $@
540 538  
541 539 $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
542   - $(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \
  540 + $(QUIET_LINK)$(CC) $(CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \
543 541 $(BUILTIN_OBJS) $(LIBS) -o $@
544 542  
545 543 $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
546   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
  544 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
547 545 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
548 546 '-DPERF_MAN_PATH="$(mandir_SQ)"' \
549 547 '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
550 548  
551 549 $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
552   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
  550 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
553 551 '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
554 552 '-DPERF_MAN_PATH="$(mandir_SQ)"' \
555 553 '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
556 554  
557 555  
558 556  
559 557  
560 558  
561 559  
562 560  
563 561  
564 562  
565 563  
566 564  
567 565  
568 566  
569 567  
570 568  
571 569  
572 570  
573 571  
574 572  
575 573  
576 574  
577 575  
... ... @@ -574,77 +572,77 @@
574 572 # over the general rule for .o
575 573  
576 574 $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
577   - $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -w $<
  575 + $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -w $<
578 576  
579 577 $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
580   - $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
  578 + $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
581 579  
582 580 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
583   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
  581 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
584 582 $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
585   - $(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
  583 + $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
586 584 $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
587   - $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $<
  585 + $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $<
588 586 $(OUTPUT)%.o: %.S
589   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
  587 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
590 588 $(OUTPUT)%.s: %.S
591   - $(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $<
  589 + $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
592 590  
593 591 $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
594   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
  592 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
595 593 '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
596 594 '-DPREFIX="$(prefix_SQ)"' \
597 595 $<
598 596  
599 597 $(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS
600   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
  598 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
601 599 '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \
602 600 $<
603 601  
604 602 $(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS
605   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \
  603 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
606 604 -DPYTHONPATH='"$(OUTPUT)python"' \
607 605 -DPYTHON='"$(PYTHON_WORD)"' \
608 606 $<
609 607  
610 608 $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
611   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
  609 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
612 610  
613 611 $(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
614   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
  612 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
615 613  
616 614 $(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
617   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
  615 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
618 616  
619 617 $(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
620   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
  618 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
621 619  
622 620 $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
623   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
  621 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
624 622  
625 623 $(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
626   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $<
  624 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
627 625  
628 626 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
629   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
  627 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
630 628  
631 629 $(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS
632   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls $<
  630 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-redundant-decls $<
633 631  
634 632 $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
635   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
  633 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
636 634  
637 635 $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
638   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
  636 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
639 637  
640 638 $(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS
641   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
  639 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
642 640  
643 641 $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
644   - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
  642 + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
645 643  
646 644 $(OUTPUT)perf-%: %.o $(PERFLIBS)
647   - $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
  645 + $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
648 646  
649 647 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
650 648 $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
... ... @@ -731,7 +729,7 @@
731 729 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
732 730  
733 731 ### Detect prefix changes
734   -TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
  732 +TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
735 733 $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
736 734  
737 735 $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
... ... @@ -752,7 +750,7 @@
752 750 then \
753 751 for i in *.c */*.c; \
754 752 do \
755   - sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
  753 + sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
756 754 done; \
757 755 else \
758 756 exit 1; \
tools/perf/config/Makefile
... ... @@ -6,6 +6,7 @@
6 6 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
7 7 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
8 8 NO_PERF_REGS := 1
  9 +CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
9 10  
10 11 # Additional ARCH settings for x86
11 12 ifeq ($(ARCH),i386)
12 13  
... ... @@ -17,12 +18,12 @@
17 18 ifeq ($(ARCH),x86_64)
18 19 override ARCH := x86
19 20 IS_X86_64 := 0
20   - ifeq (, $(findstring m32,$(EXTRA_CFLAGS)))
  21 + ifeq (, $(findstring m32,$(CFLAGS)))
21 22 IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1)
22 23 endif
23 24 ifeq (${IS_X86_64}, 1)
24 25 RAW_ARCH := x86_64
25   - ARCH_CFLAGS := -DARCH_X86_64
  26 + CFLAGS += -DARCH_X86_64
26 27 ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
27 28 endif
28 29 NO_PERF_REGS := 0
... ... @@ -30,7 +31,7 @@
30 31 endif
31 32  
32 33 ifeq ($(NO_PERF_REGS),0)
33   - BASIC_CFLAGS += -DHAVE_PERF_REGS
  34 + CFLAGS += -DHAVE_PERF_REGS
34 35 endif
35 36  
36 37 -include config/feature-tests.mak
37 38  
38 39  
39 40  
40 41  
41 42  
42 43  
43 44  
44 45  
45 46  
... ... @@ -45,46 +46,52 @@
45 46  
46 47 # Treat warnings as errors unless directed not to
47 48 ifneq ($(WERROR),0)
48   - CFLAGS_WERROR := -Werror
  49 + CFLAGS += -Werror
49 50 endif
50 51  
51 52 ifeq ("$(origin DEBUG)", "command line")
52 53 PERF_DEBUG = $(DEBUG)
53 54 endif
54 55 ifndef PERF_DEBUG
55   - CFLAGS_OPTIMIZE = -O6
  56 + CFLAGS += -O6
56 57 endif
57 58  
58 59 ifdef PARSER_DEBUG
59   - PARSER_DEBUG_BISON := -t
60   - PARSER_DEBUG_FLEX := -d
61   - PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG
  60 + PARSER_DEBUG_BISON := -t
  61 + PARSER_DEBUG_FLEX := -d
  62 + CFLAGS += -DPARSER_DEBUG
62 63 endif
63 64  
64   -CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
  65 +CFLAGS += \
  66 + -fno-omit-frame-pointer \
  67 + -ggdb3 \
  68 + -funwind-tables \
  69 + -Wall \
  70 + -Wextra \
  71 + -std=gnu99
  72 +
65 73 EXTLIBS = -lpthread -lrt -lelf -lm
66   -ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
67 74 ALL_LDFLAGS = $(LDFLAGS)
68 75  
69 76 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y)
70   - CFLAGS := $(CFLAGS) -fstack-protector-all
  77 + CFLAGS += -fstack-protector-all
71 78 endif
72 79  
73 80 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y)
74   - CFLAGS := $(CFLAGS) -Wstack-protector
  81 + CFLAGS += -Wstack-protector
75 82 endif
76 83  
77 84 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y)
78   - CFLAGS := $(CFLAGS) -Wvolatile-register-var
  85 + CFLAGS += -Wvolatile-register-var
79 86 endif
80 87  
81 88 ifndef PERF_DEBUG
82 89 ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y)
83   - CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2
  90 + CFLAGS += -D_FORTIFY_SOURCE=2
84 91 endif
85 92 endif
86 93  
87   -BASIC_CFLAGS += \
  94 +CFLAGS += \
88 95 -Iutil/include \
89 96 -Iarch/$(ARCH)/include \
90 97 $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \
... ... @@ -106,7 +113,6 @@
106 113 BIONIC := 1
107 114 EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
108 115 EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
109   - BASIC_CFLAGS += -I.
110 116 endif
111 117  
112 118 ifdef NO_LIBELF
113 119  
... ... @@ -114,9 +120,9 @@
114 120 NO_DEMANGLE := 1
115 121 NO_LIBUNWIND := 1
116 122 else
117   -FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
  123 +FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
118 124 ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y)
119   - FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS)
  125 + FLAGS_GLIBC=$(CFLAGS) $(ALL_LDFLAGS)
120 126 ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y)
121 127 LIBC_SUPPORT := 1
122 128 endif
... ... @@ -140,7 +146,7 @@
140 146 LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
141 147 endif
142 148  
143   - FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
  149 + FLAGS_DWARF=$(CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
144 150 ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y)
145 151 msg := $(warning No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev);
146 152 NO_DWARF := 1
147 153  
... ... @@ -149,10 +155,10 @@
149 155 endif # NO_LIBELF
150 156  
151 157 ifndef NO_LIBELF
152   -BASIC_CFLAGS += -DLIBELF_SUPPORT
153   -FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
  158 +CFLAGS += -DLIBELF_SUPPORT
  159 +FLAGS_LIBELF=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
154 160 ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
155   - BASIC_CFLAGS += -DLIBELF_MMAP
  161 + CFLAGS += -DLIBELF_MMAP
156 162 endif
157 163  
158 164 # include ARCH specific config
... ... @@ -163,7 +169,7 @@
163 169 msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
164 170 NO_DWARF := 1
165 171 else
166   - BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS)
  172 + CFLAGS += -DDWARF_SUPPORT $(LIBDW_CFLAGS)
167 173 BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS)
168 174 EXTLIBS += -lelf -ldw
169 175 endif # PERF_HAVE_DWARF_REGS
... ... @@ -184,7 +190,7 @@
184 190 LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
185 191 endif
186 192  
187   -FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
  193 +FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS)
188 194 ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y)
189 195 msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99);
190 196 NO_LIBUNWIND := 1
191 197  
192 198  
193 199  
... ... @@ -192,19 +198,19 @@
192 198 endif # NO_LIBUNWIND
193 199  
194 200 ifndef NO_LIBUNWIND
195   - BASIC_CFLAGS += -DLIBUNWIND_SUPPORT
  201 + CFLAGS += -DLIBUNWIND_SUPPORT
196 202 EXTLIBS += $(LIBUNWIND_LIBS)
197   - BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS)
  203 + CFLAGS += $(LIBUNWIND_CFLAGS)
198 204 BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS)
199 205 endif # NO_LIBUNWIND
200 206  
201 207 ifndef NO_LIBAUDIT
202   - FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit
  208 + FLAGS_LIBAUDIT = $(CFLAGS) $(ALL_LDFLAGS) -laudit
203 209 ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y)
204 210 msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
205 211 NO_LIBAUDIT := 1
206 212 else
207   - BASIC_CFLAGS += -DLIBAUDIT_SUPPORT
  213 + CFLAGS += -DLIBAUDIT_SUPPORT
208 214 EXTLIBS += -laudit
209 215 endif
210 216 endif
211 217  
212 218  
213 219  
214 220  
... ... @@ -214,29 +220,29 @@
214 220 endif
215 221  
216 222 ifndef NO_SLANG
217   - FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
  223 + FLAGS_SLANG=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang
218 224 ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y)
219 225 msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
220 226 NO_SLANG := 1
221 227 else
222 228 # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
223   - BASIC_CFLAGS += -I/usr/include/slang
224   - BASIC_CFLAGS += -DSLANG_SUPPORT
  229 + CFLAGS += -I/usr/include/slang
  230 + CFLAGS += -DSLANG_SUPPORT
225 231 EXTLIBS += -lslang
226 232 endif
227 233 endif
228 234  
229 235 ifndef NO_GTK2
230   - FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
  236 + FLAGS_GTK2=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null)
231 237 ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y)
232 238 msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
233 239 NO_GTK2 := 1
234 240 else
235 241 ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y)
236   - BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR
  242 + CFLAGS += -DHAVE_GTK_INFO_BAR
237 243 endif
238   - BASIC_CFLAGS += -DGTK2_SUPPORT
239   - BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
  244 + CFLAGS += -DGTK2_SUPPORT
  245 + CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null)
240 246 EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null)
241 247 endif
242 248 endif
... ... @@ -245,7 +251,7 @@
245 251 strip-libs = $(filter-out -l%,$(1))
246 252  
247 253 ifdef NO_LIBPERL
248   - BASIC_CFLAGS += -DNO_LIBPERL
  254 + CFLAGS += -DNO_LIBPERL
249 255 else
250 256 PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
251 257 PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
... ... @@ -254,7 +260,7 @@
254 260 FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
255 261  
256 262 ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y)
257   - BASIC_CFLAGS += -DNO_LIBPERL
  263 + CFLAGS += -DNO_LIBPERL
258 264 NO_LIBPERL := 1
259 265 else
260 266 ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
... ... @@ -264,7 +270,7 @@
264 270  
265 271 disable-python = $(eval $(disable-python_code))
266 272 define disable-python_code
267   - BASIC_CFLAGS += -DNO_LIBPYTHON
  273 + CFLAGS += -DNO_LIBPYTHON
268 274 $(if $(1),$(warning No $(1) was found))
269 275 $(warning Python support will not be built)
270 276 NO_LIBPYTHON := 1
271 277  
272 278  
... ... @@ -326,13 +332,13 @@
326 332 endif
327 333  
328 334 ifdef NO_DEMANGLE
329   - BASIC_CFLAGS += -DNO_DEMANGLE
  335 + CFLAGS += -DNO_DEMANGLE
330 336 else
331 337 ifdef HAVE_CPLUS_DEMANGLE
332 338 EXTLIBS += -liberty
333   - BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
  339 + CFLAGS += -DHAVE_CPLUS_DEMANGLE
334 340 else
335   - FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
  341 + FLAGS_BFD=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd
336 342 has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd)
337 343 ifeq ($(has_bfd),y)
338 344 EXTLIBS += -lbfd
339 345  
340 346  
... ... @@ -347,14 +353,14 @@
347 353 ifeq ($(has_bfd_iberty_z),y)
348 354 EXTLIBS += -lbfd -liberty -lz
349 355 else
350   - FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
  356 + FLAGS_CPLUS_DEMANGLE=$(CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty
351 357 has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle)
352 358 ifeq ($(has_cplus_demangle),y)
353 359 EXTLIBS += -liberty
354   - BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE
  360 + CFLAGS += -DHAVE_CPLUS_DEMANGLE
355 361 else
356 362 msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
357   - BASIC_CFLAGS += -DNO_DEMANGLE
  363 + CFLAGS += -DNO_DEMANGLE
358 364 endif
359 365 endif
360 366 endif
361 367  
362 368  
363 369  
364 370  
... ... @@ -364,29 +370,29 @@
364 370  
365 371 ifndef NO_STRLCPY
366 372 ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y)
367   - BASIC_CFLAGS += -DHAVE_STRLCPY
  373 + CFLAGS += -DHAVE_STRLCPY
368 374 endif
369 375 endif
370 376  
371 377 ifndef NO_ON_EXIT
372 378 ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y)
373   - BASIC_CFLAGS += -DHAVE_ON_EXIT
  379 + CFLAGS += -DHAVE_ON_EXIT
374 380 endif
375 381 endif
376 382  
377 383 ifndef NO_BACKTRACE
378 384 ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y)
379   - BASIC_CFLAGS += -DBACKTRACE_SUPPORT
  385 + CFLAGS += -DBACKTRACE_SUPPORT
380 386 endif
381 387 endif
382 388  
383 389 ifndef NO_LIBNUMA
384   - FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma
  390 + FLAGS_LIBNUMA = $(CFLAGS) $(ALL_LDFLAGS) -lnuma
385 391 ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
386 392 msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev);
387 393 NO_LIBNUMA := 1
388 394 else
389   - BASIC_CFLAGS += -DLIBNUMA_SUPPORT
  395 + CFLAGS += -DLIBNUMA_SUPPORT
390 396 EXTLIBS += -lnuma
391 397 endif
392 398 endif
tools/perf/util/setup.py
... ... @@ -18,8 +18,9 @@
18 18 self.build_dir = build_lib
19 19  
20 20  
21   -cflags = ['-fno-strict-aliasing', '-Wno-write-strings']
22   -cflags += getenv('CFLAGS', '').split()
  21 +cflags = getenv('CFLAGS', '').split()
  22 +# switch off several checks (need to be at the end of cflags list)
  23 +cflags += ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ]
23 24  
24 25 build_lib = getenv('PYTHON_EXTBUILD_LIB')
25 26 build_tmp = getenv('PYTHON_EXTBUILD_TMP')