perf tools: Build changes and kbuild support
Subsystems (3)
PATCH 1/27 perf tools: Add automated make test suite
In reply to Jiri OlsaAdding automatd test for testing the build process. To run it you needto be in perf directory or specify one with PERF variable. It's also possible to specify optional Makefile to test via MK variable.
Whole suite is executed twice, the second time with O=/tmp/xxx option added.
To run the whole suite:
$ make -f tests/make MAKE_PURE: cd . && make -f Makefile TEST: test -x ./perf MAKE_DEBUG: cd . && make -f Makefile DEBUG=1 TEST: test -x ./perf ...
You see command line for 'MAKE_PURE' test right away, and the output is stored into MAKE_PURE file.
To run simple test:
$ make -f tests/make MAKE_DEBUG MAKE_DEBUG: cd . && make -f Makefile DEBUG=1 TEST: test -x ./perf
At this moment tests checks for succesfull build and for existence of several built files. Additional after-build checks could be added.
--- tools/perf/tests/make | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 tools/perf/tests/make
tools/perf/tests/make new file +122 -0
@@ -0,0 +1,122 @@ +ifndef PERF +PERF := . +endif + +ifndef MK +MK := Makefile +endif + +MAKE_DEBUG := DEBUG=1 +MAKE_NO_LIBPERL := NO_LIBPERL=1 +MAKE_NO_LIBPYTHON := NO_LIBPYTHON=1 +MAKE_NO_SCRIPTS := NO_LIBPYTHON=1 NO_LIBPERL=1 +MAKE_NO_NEWT := NO_NEWT=1 +MAKE_NO_SLANG := NO_SLANG=1 +MAKE_NO_GTK2 := NO_GTK2=1 +MAKE_NO_UI := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 +MAKE_NO_DEMANGLE := NO_DEMANGLE=1 +MAKE_NO_LIBELF := NO_LIBELF=1 +MAKE_NO_LIBUNWIND := NO_LIBUNWIND=1 +MAKE_NO_BACKTRACE := NO_BACKTRACE=1 +MAKE_NO_LIBNUMA := NO_LIBNUMA=1 +MAKE_NO_LIBAUDIT := NO_LIBAUDIT=1 +MAKE_NO_LIBBIONIC := NO_LIBBIONIC=1 +MAKE_MINIMAL := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 +MAKE_TAGS := tags +MAKE_CSCOPE := cscope +MAKE_HELP := help +MAKE_DOC := doc +MAKE_PERF_O := perf.o +MAKE_UTIL_MAP_O := util/map.o + +RUN := \ + MAKE_PURE \ + MAKE_DEBUG \ + MAKE_NO_LIBPERL \ + MAKE_NO_LIBPYTHON \ + MAKE_NO_SCRIPTS \ + MAKE_NO_NEWT \ + MAKE_NO_SLANG \ + MAKE_NO_GTK2 \ + MAKE_NO_UI \ + MAKE_NO_DEMANGLE \ + MAKE_NO_LIBELF \ + MAKE_NO_LIBUNWIND \ + MAKE_NO_BACKTRACE \ + MAKE_NO_LIBNUMA \ + MAKE_NO_LIBAUDIT \ + MAKE_NO_LIBBIONIC \ + MAKE_MINIMAL \ + MAKE_TAGS \ + MAKE_CSCOPE \ + MAKE_HELP \ + MAKE_DOC \ + MAKE_PERF_O \ + MAKE_UTIL_MAP_O + +RUN_O := $(addsuffix _O,$(RUN)) + +TEST_MAKE_TAGS = test -f tags +TEST_MAKE_CSCOPE = test -f cscope.out + +TEST_MAKE_TAGS_O := $(TEST_MAKE_TAGS) +TEST_MAKE_CSCOPE_O := $(TEST_MAKE_CSCOPE) + +TEST_OK := true +TEST_MAKE_HELP := $(TEST_OK) +TEST_MAKE_DOC := $(TEST_OK) +TEST_MAKE_HELP_O := $(TEST_OK) +TEST_MAKE_DOC_O := $(TEST_OK) + +TEST_MAKE_PERF_O := test -f $(PERF)/perf.o +TEST_MAKE_UTIL_MAP_O := test -f $(PERF)/util/map.o + +# Kbuild tests only +#TEST_MAKE_PERF_O_O := test -f $$TMP/tools/perf/perf.o +#TEST_MAKE_UTIL_MAP_O_O := test -f $$TMP/tools/perf/util/map.o + +TEST_MAKE_PERF_O_O := true +TEST_MAKE_UTIL_MAP_O_O := true + +TEST_DEFAULT = test -x $(PERF)/perf +test = $(if $(TEST_$1),$(TEST_$1),$(TEST_DEFAULT)) + +TEST_DEFAULT_O = test -x $$TMP/perf +test_o = $(if $(TEST_$1),$(TEST_$1),$(TEST_DEFAULT_O)) + +all: + +ifdef DEBUG +d := $(info RUN $(RUN)) +d := $(info RUN_O $(RUN_O)) +endif + +MAKEFLAGS := --no-print-directory + +clean := @cd $(PERF); make -s -f $(MK) clean >/dev/null + +$(RUN): + $(call clean) && \ + cmd="cd $(PERF) && make -f $(MK) $($@)"; \ + echo "$@: $$cmd" && echo $$cmd > $@ && \ + ( eval $$cmd ) >> $@ 2>&1; \ + echo "TEST: $(call test,$@)"; \ + $(call test,$@) + +$(RUN_O): + $(call clean) && \ + TMP=$$(mktemp -d); \ + cmd="cd $(PERF) && make -f $(MK) $($(patsubst %_O,%,$@)) O=$$TMP"; \ + echo "$@: $$cmd" && echo $$cmd > $@ && \ + ( eval $$cmd ) >> $@ 2>&1 && \ + echo "TEST: $(call test_o,$@)"; \ + $(call test_o,$@) && \ + rm -rf $$TMP + +all: $(RUN) $(RUN_O) + @echo OK + +out: $(RUN_O) + @echo OK + +.PHONY: all $(RUN) $(RUN_O) clean
Signature · 1 line
1.7.11.7
PATCH 2/27 perf tools: Fix tab vs spaces issue in Makefile ifdef/endif
In reply to Jiri OlsaUnmatched spaces/tabs Makefile indentation could make the Makefile fails. While the tabed line could be considered sometimes as follow up for rule command, the mixed space tab meses up with makefile if conditions.
--- tools/perf/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/Makefile +3 -3
@@ -90,7 +90,7 @@ endif # Treat warnings as errors unless directed not to ifneq ($(WERROR),0) - CFLAGS_WERROR := -Werror + CFLAGS_WERROR := -Werror endif ifeq ("$(origin DEBUG)", "command line")
@@ -819,10 +819,10 @@ endif ifdef NO_DEMANGLE BASIC_CFLAGS += -DNO_DEMANGLE else - ifdef HAVE_CPLUS_DEMANGLE + ifdef HAVE_CPLUS_DEMANGLE EXTLIBS += -liberty BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE - else + else FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) ifeq ($(has_bfd),y)
Signature · 1 line
1.7.11.7
PATCH 3/27 perf tools: Move arch check into config/Makefile
In reply to Jiri OlsaMoving arch check into config/Makefile.
--- tools/perf/Makefile | 31 ++----------------------------- tools/perf/config/Makefile | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 29 deletions(-) create mode 100644 tools/perf/config/Makefile
tools/perf/Makefile +2 -29
@@ -55,37 +55,11 @@ include config/utilities.mak $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) -uname_M := $(shell uname -m 2>/dev/null || echo not) - -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ -e s/sa110/arm/ \ - -e s/s390x/s390/ -e s/parisc64/parisc/ \ - -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) -NO_PERF_REGS := 1 - CC = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar -# Additional ARCH settings for x86 -ifeq ($(ARCH),i386) - override ARCH := x86 - NO_PERF_REGS := 0 - LIBUNWIND_LIBS = -lunwind -lunwind-x86 -endif -ifeq ($(ARCH),x86_64) - override ARCH := x86 - IS_X86_64 := 0 - ifeq (, $(findstring m32,$(EXTRA_CFLAGS))) - IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1) - endif - ifeq (${IS_X86_64}, 1) - RAW_ARCH := x86_64 - ARCH_CFLAGS := -DARCH_X86_64 - ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S - endif - NO_PERF_REGS := 0 - LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 +ifeq ($(filter clean tags,$(MAKECMDGOALS)),) +include config/Makefile endif # Treat warnings as errors unless directed not to
@@ -857,7 +831,6 @@ ifeq ($(NO_PERF_REGS),0) ifeq ($(ARCH),x86) LIB_H += arch/x86/include/perf_regs.h endif - BASIC_CFLAGS += -DHAVE_PERF_REGS endif ifndef NO_STRLCPY
tools/perf/config/Makefile new file +34 -0
@@ -0,0 +1,34 @@ +uname_M := $(shell uname -m 2>/dev/null || echo not) + +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ + -e s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/s390x/s390/ -e s/parisc64/parisc/ \ + -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) +NO_PERF_REGS := 1 + +# Additional ARCH settings for x86 +ifeq ($(ARCH),i386) + override ARCH := x86 + NO_PERF_REGS := 0 + LIBUNWIND_LIBS = -lunwind -lunwind-x86 +endif + +ifeq ($(ARCH),x86_64) + override ARCH := x86 + IS_X86_64 := 0 + ifeq (, $(findstring m32,$(EXTRA_CFLAGS))) + IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1) + endif + ifeq (${IS_X86_64}, 1) + RAW_ARCH := x86_64 + ARCH_CFLAGS := -DARCH_X86_64 + ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S + endif + NO_PERF_REGS := 0 + LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 +endif + +ifeq ($(NO_PERF_REGS),0) + BASIC_CFLAGS += -DHAVE_PERF_REGS +endif
Signature · 1 line
1.7.11.7
PATCH 6/27 perf tools: Move libelf check config into config/Makefile
In reply to Jiri OlsaMoving libelf check config into config/Makefile.
--- tools/perf/Makefile | 46 --------------------------------------------- tools/perf/config/Makefile | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 46 deletions(-)
tools/perf/Makefile +0 -46
@@ -461,45 +461,6 @@ ifneq ($(MAKECMDGOALS),tags) # because maintaining the nesting to match is a pain. If # we had "elif" things would have been much nicer... -ifdef NO_LIBELF - NO_DWARF := 1 - NO_DEMANGLE := 1 - NO_LIBUNWIND := 1 -else -FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -ifneq ($(call try-cc,$(SOURCE_LIBELF),$(FLAGS_LIBELF),libelf),y) - FLAGS_GLIBC=$(ALL_CFLAGS) $(ALL_LDFLAGS) - ifeq ($(call try-cc,$(SOURCE_GLIBC),$(FLAGS_GLIBC),glibc),y) - LIBC_SUPPORT := 1 - endif - ifeq ($(BIONIC),1) - LIBC_SUPPORT := 1 - endif - ifeq ($(LIBC_SUPPORT),1) - msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev); - - NO_LIBELF := 1 - NO_DWARF := 1 - NO_DEMANGLE := 1 - else - msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static); - endif -else - # for linking with debug library, run like: - # make DEBUG=1 LIBDW_DIR=/opt/libdw/ - ifdef LIBDW_DIR - LIBDW_CFLAGS := -I$(LIBDW_DIR)/include - LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib - endif - - FLAGS_DWARF=$(ALL_CFLAGS) $(LIBDW_CFLAGS) -ldw -lelf $(LIBDW_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) - ifneq ($(call try-cc,$(SOURCE_DWARF),$(FLAGS_DWARF),libdw),y) - 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); - NO_DWARF := 1 - endif # Dwarf support -endif # SOURCE_LIBELF -endif # NO_LIBELF - # There's only x86 (both 32 and 64) support for CFI unwind so far ifneq ($(ARCH),x86) NO_LIBUNWIND := 1
@@ -541,13 +502,6 @@ BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS)) LIB_OBJS += $(OUTPUT)util/symbol-minimal.o else # NO_LIBELF -BASIC_CFLAGS += -DLIBELF_SUPPORT - -FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) - BASIC_CFLAGS += -DLIBELF_MMAP -endif - ifndef NO_DWARF ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
tools/perf/config/Makefile +47 -0
50 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 7/27 perf tools: Move libdw check config into config/Makefile
In reply to Jiri OlsaMoving libdw check config into config/Makefile.
--- tools/perf/Makefile | 7 ------- tools/perf/config/Makefile | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 7 deletions(-)
tools/perf/Makefile +0 -7
@@ -503,15 +503,8 @@ LIB_OBJS += $(OUTPUT)util/symbol-minimal.o else # NO_LIBELF ifndef NO_DWARF -ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) - msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); -else - BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS) - BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS) - EXTLIBS += -lelf -ldw LIB_OBJS += $(OUTPUT)util/probe-finder.o LIB_OBJS += $(OUTPUT)util/dwarf-aux.o -endif # PERF_HAVE_DWARF_REGS endif # NO_DWARF endif # NO_LIBELF
tools/perf/config/Makefile +15 -0
@@ -154,4 +154,19 @@ FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y) BASIC_CFLAGS += -DLIBELF_MMAP endif + +# include ARCH specific config +-include arch/$(ARCH)/Makefile + +ifndef NO_DWARF +ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) + msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); + NO_DWARF := 1 +else + BASIC_CFLAGS := -DDWARF_SUPPORT $(LIBDW_CFLAGS) $(BASIC_CFLAGS) + BASIC_LDFLAGS := $(LIBDW_LDFLAGS) $(BASIC_LDFLAGS) + EXTLIBS += -lelf -ldw +endif # PERF_HAVE_DWARF_REGS +endif # NO_DWARF + endif # NO_LIBELF
Signature · 1 line
1.7.11.7
PATCH 5/27 perf tools: Move compiler and linker flags check into config/Makefile
In reply to Jiri OlsaMoving compiler and linker flags check into config/Makefile.
--- tools/perf/Makefile | 110 ++++++++------------------------------------- tools/perf/config/Makefile | 66 +++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 91 deletions(-)
tools/perf/Makefile +19 -91
@@ -52,6 +52,20 @@ include config/utilities.mak # # Define NO_LIBNUMA if you do not want numa perf benchmark +ifeq ($(srctree),) +srctree := $(patsubst %/,%,$(dir $(shell pwd))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +#$(info Determined 'srctree' to be $(srctree)) +endif + +ifneq ($(objtree),) +#$(info Determined 'objtree' to be $(objtree)) +endif + +ifneq ($(OUTPUT),) +#$(info Determined 'OUTPUT' to be $(OUTPUT)) +endif + $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -66,37 +80,17 @@ FLEX = flex BISON = bison STRIP ?= strip +LK_DIR = ../lib/lk/ +TRACE_EVENT_DIR = ../lib/traceevent/ + ifeq ($(filter clean tags,$(MAKECMDGOALS)),) include config/Makefile endif -# Treat warnings as errors unless directed not to -ifneq ($(WERROR),0) - CFLAGS_WERROR := -Werror -endif - -ifeq ("$(origin DEBUG)", "command line") - PERF_DEBUG = $(DEBUG) -endif -ifndef PERF_DEBUG - CFLAGS_OPTIMIZE = -O6 -endif - -ifdef PARSER_DEBUG - PARSER_DEBUG_BISON := -t - PARSER_DEBUG_FLEX := -d - PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG -endif - ifdef NO_NEWT NO_SLANG=1 endif -CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS) -EXTLIBS = -lpthread -lrt -lelf -lm -ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -ALL_LDFLAGS = $(LDFLAGS) - # Among the variables below, these: # perfexecdir # template_dir
@@ -136,71 +130,6 @@ export prefix bindir sharedir sysconfdir # explicitly what architecture to check for. Fix this up for yours.. SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),tags) --include config/feature-tests.mak - -ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) - CFLAGS := $(CFLAGS) -fstack-protector-all -endif - -ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y) - CFLAGS := $(CFLAGS) -Wstack-protector -endif - -ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y) - CFLAGS := $(CFLAGS) -Wvolatile-register-var -endif - -ifndef PERF_DEBUG - ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y) - CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2 - endif -endif - -### --- END CONFIGURATION SECTION --- - -ifeq ($(srctree),) -srctree := $(patsubst %/,%,$(dir $(shell pwd))) -srctree := $(patsubst %/,%,$(dir $(srctree))) -#$(info Determined 'srctree' to be $(srctree)) -endif - -ifneq ($(objtree),) -#$(info Determined 'objtree' to be $(objtree)) -endif - -ifneq ($(OUTPUT),) -#$(info Determined 'OUTPUT' to be $(OUTPUT)) -endif - -BASIC_CFLAGS = \ - -Iutil/include \ - -Iarch/$(ARCH)/include \ - $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \ - -I$(srctree)/arch/$(ARCH)/include/uapi \ - -I$(srctree)/arch/$(ARCH)/include \ - $(if $(objtree),-I$(objtree)/include/generated/uapi) \ - -I$(srctree)/include/uapi \ - -I$(srctree)/include \ - -I$(OUTPUT)util \ - -Iutil \ - -I. \ - -I$(TRACE_EVENT_DIR) \ - -I../lib/ \ - -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE - -BASIC_LDFLAGS = - -ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) - BIONIC := 1 - EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) - EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) - BASIC_CFLAGS += -I. -endif -endif # MAKECMDGOALS != tags -endif # MAKECMDGOALS != clean - # Guard against environment variables BUILTIN_OBJS = LIB_H =
@@ -213,9 +142,6 @@ SCRIPT_SH += perf-archive.sh grep-libs = $(filter -l%,$(1)) strip-libs = $(filter-out -l%,$(1)) -LK_DIR = ../lib/lk/ -TRACE_EVENT_DIR = ../lib/traceevent/ - LK_PATH=$(LK_DIR) ifneq ($(OUTPUT),)
@@ -529,6 +455,8 @@ PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT) ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),tags) +-include config/feature-tests.mak + # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If # we had "elif" things would have been much nicer...
tools/perf/config/Makefile +66 -0
69 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 9/27 perf tools: Move libaudit check config into config/Makefile
In reply to Jiri OlsaMoving libaudit check config into config/Makefile.
--- tools/perf/Makefile | 9 +-------- tools/perf/config/Makefile | 11 +++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-)
tools/perf/Makefile +1 -8
@@ -493,14 +493,7 @@ ifndef NO_LIBUNWIND endif ifndef NO_LIBAUDIT - FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit - ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y) - msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); - else - BASIC_CFLAGS += -DLIBAUDIT_SUPPORT - BUILTIN_OBJS += $(OUTPUT)builtin-trace.o - EXTLIBS += -laudit - endif + BUILTIN_OBJS += $(OUTPUT)builtin-trace.o endif ifndef NO_SLANG
tools/perf/config/Makefile +11 -0
@@ -197,3 +197,14 @@ ifndef NO_LIBUNWIND BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS) BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) endif # NO_LIBUNWIND + +ifndef NO_LIBAUDIT + FLAGS_LIBAUDIT = $(ALL_CFLAGS) $(ALL_LDFLAGS) -laudit + ifneq ($(call try-cc,$(SOURCE_LIBAUDIT),$(FLAGS_LIBAUDIT),libaudit),y) + msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev); + NO_LIBAUDIT := 1 + else + BASIC_CFLAGS += -DLIBAUDIT_SUPPORT + EXTLIBS += -laudit + endif +endif
Signature · 1 line
1.7.11.7
PATCH 4/27 perf tools: Move programs check into config/Makefile
In reply to Jiri OlsaMoving programs check into config/Makefile.
--- tools/perf/Makefile | 24 ++++++++---------------- tools/perf/config/Makefile | 10 ++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-)
tools/perf/Makefile +8 -16
@@ -58,6 +58,14 @@ $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE CC = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar +RM = rm -f +MKDIR = mkdir +FIND = find +INSTALL = install +FLEX = flex +BISON = bison +STRIP ?= strip + ifeq ($(filter clean tags,$(MAKECMDGOALS)),) include config/Makefile endif
@@ -88,7 +96,6 @@ CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 EXTLIBS = -lpthread -lrt -lelf -lm ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE ALL_LDFLAGS = $(LDFLAGS) -STRIP ?= strip # Among the variables below, these: # perfexecdir
@@ -125,13 +132,6 @@ lib = lib export prefix bindir sharedir sysconfdir -RM = rm -f -MKDIR = mkdir -FIND = find -INSTALL = install -FLEX = flex -BISON= bison - # sparse is architecture-neutral, which means that we need to tell it # explicitly what architecture to check for. Fix this up for yours.. SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
@@ -140,14 +140,6 @@ ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),tags) -include config/feature-tests.mak -ifeq ($(call get-executable,$(FLEX)),) - dummy := $(error Error: $(FLEX) is missing on this system, please install it) -endif - -ifeq ($(call get-executable,$(BISON)),) - dummy := $(error Error: $(BISON) is missing on this system, please install it) -endif - ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) CFLAGS := $(CFLAGS) -fstack-protector-all endif
tools/perf/config/Makefile +10 -0
@@ -32,3 +32,13 @@ endif ifeq ($(NO_PERF_REGS),0) BASIC_CFLAGS += -DHAVE_PERF_REGS endif + +-include config/feature-tests.mak + +ifeq ($(call get-executable,$(FLEX)),) + dummy := $(error Error: $(FLEX) is missing on this system, please install it) +endif + +ifeq ($(call get-executable,$(BISON)),) + dummy := $(error Error: $(BISON) is missing on this system, please install it) +endif
Signature · 1 line
1.7.11.7
cover perf tools: Build changes and kbuild support
hi,
sending RFC for build changes and kbuild support.
The build changes mostly consists of separating the config stuff into config/Makefile which is then used for kbuild.
I kept the original/current Makefile in place and put the kbuild support into Makefile.kbuild. The final touch would be to move Makefile.kbuild into Makefile. I kept the original one to have easy way of testing the old system.
To run the kbuild make:
$ make -f Makefile.kbuild
In pristine tree above command behaves as the current Makefile - does the system checks and builds perf.
After that '.config' and '.config-detected' files are created and managed as explained in last patch of this set.
It's published in:git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/kbuild7
I tested this so far on x86_64.
I'm CC-ing Michal Marek and linux-kbuild list on kbuild patches.
thanks for comments,
jirka
---
Jiri Olsa (27):
perf tools: Add automated make test suite
perf tools: Fix tab vs spaces issue in Makefile ifdef/endif perf tools: Move arch check into config/Makefile
perf tools: Move programs check into config/Makefile
perf tools: Move compiler and linker flags check into config/Makefile perf tools: Move libelf check config into config/Makefile perf tools: Move libdw check config into config/Makefile perf tools: Move libunwind check config into config/Makefile perf tools: Move libaudit check config into config/Makefile perf tools: Move slang check config into config/Makefile perf tools: Move gtk2 check config into config/Makefile perf tools: Move libperl check config into config/Makefile perf tools: Move libpython check config into config/Makefile perf tools: Move libbfd check config into config/Makefile perf tools: Move stdlib check config into config/Makefile perf tools: Move libnuma check config into config/Makefile perf tools: Move paths config into config/Makefile
perf tools: Final touches for CHK config move
perf tools: Merge all *CFLAGS* make variable into CFLAGS perf tools: Merge all *LDFLAGS* make variable into LDFLAGS perf tools: Switch to full patch C include directories perf tools: Add NO_BIONIC variable to confiure bionic setup
kbuild: Introduce KBUILD_AUTOCONF variable for auto.conf include
kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool perf tools: Kbuild builtin source related fixies
perf tools: Kbuild source related fixies
perf tools: Add kbuild support into Makefile.kbuild
scripts/Makefile.build | 3 +- scripts/kconfig/confdata.c | 11 +- scripts/kconfig/lkc.h | 1 + tools/perf/Kbuild | 47 ++ tools/perf/Kconfig | 256 ++++++++++ tools/perf/Makefile | 598 ++++------------------- tools/perf/Makefile.kbuild | 411 ++++++++++++++++ tools/perf/arch/Kbuild | 3 + tools/perf/arch/x86/Kbuild | 1 + tools/perf/arch/x86/util/Kbuild | 3 + tools/perf/bench/Kbuild | 9 + tools/perf/builtin-cmds.h | 31 ++ tools/perf/builtin-help.c | 1 + tools/perf/builtin-lock.c | 2 + tools/perf/builtin-report.c | 9 +- tools/perf/builtin-sched.c | 2 + tools/perf/config/Makefile | 528 ++++++++++++++++++++ tools/perf/config/Makefile.fix-config | 104 ++++ tools/perf/config/Makefile.fix-legacy | 46 ++ tools/perf/config/defconfig | 54 ++ tools/perf/perf.c | 51 +- tools/perf/perf.h | 2 + tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 3 + tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 4 + tools/perf/tests/Kbuild | 23 + tools/perf/tests/make | 122 +++++ tools/perf/ui/Kbuild | 14 + tools/perf/ui/browsers/Kbuild | 6 + tools/perf/ui/browsers/scripts.c | 4 + tools/perf/ui/gtk/Kbuild | 7 + tools/perf/ui/setup.c | 10 +- tools/perf/ui/stdio/Kbuild | 1 + tools/perf/ui/tui/Kbuild | 4 + tools/perf/util/Kbuild | 113 +++++ tools/perf/util/PERF-VERSION-GEN | 6 +- tools/perf/util/generate-cmdlist.sh | 18 +- tools/perf/util/scripting-engines/Kbuild | 7 + tools/perf/util/setup.py | 12 +- 38 files changed, 2002 insertions(+), 525 deletions(-) create mode 100644 tools/perf/Kbuild create mode 100644 tools/perf/Kconfig create mode 100644 tools/perf/Makefile.kbuild create mode 100644 tools/perf/arch/Kbuild create mode 100644 tools/perf/arch/x86/Kbuild create mode 100644 tools/perf/arch/x86/util/Kbuild create mode 100644 tools/perf/bench/Kbuild create mode 100644 tools/perf/builtin-cmds.h create mode 100644 tools/perf/config/Makefile create mode 100644 tools/perf/config/Makefile.fix-config create mode 100644 tools/perf/config/Makefile.fix-legacy create mode 100644 tools/perf/config/defconfig create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild create mode 100644 tools/perf/tests/Kbuild create mode 100644 tools/perf/tests/make create mode 100644 tools/perf/ui/Kbuild create mode 100644 tools/perf/ui/browsers/Kbuild create mode 100644 tools/perf/ui/gtk/Kbuild create mode 100644 tools/perf/ui/stdio/Kbuild create mode 100644 tools/perf/ui/tui/Kbuild create mode 100644 tools/perf/util/Kbuild create mode 100644 tools/perf/util/scripting-engines/Kbuild
PATCH 12/27 perf tools: Move libperl check config into config/Makefile
Moving libperl check config into config/Makefile.
--- tools/perf/Makefile | 20 +++----------------- tools/perf/config/Makefile | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 17 deletions(-)
tools/perf/Makefile +3 -17
@@ -518,23 +518,9 @@ ifndef NO_GTK2 LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o endif -ifdef NO_LIBPERL - BASIC_CFLAGS += -DNO_LIBPERL -else - PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) - PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) - PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) - PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` - FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) - - ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y) - BASIC_CFLAGS += -DNO_LIBPERL - else - ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) - EXTLIBS += $(PERL_EMBED_LIBADD) - LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o - LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o - endif +ifndef NO_LIBPERL + LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o + LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o endif disable-python = $(eval $(disable-python_code))
tools/perf/config/Makefile +21 -0
@@ -240,3 +240,24 @@ ifndef NO_GTK2 EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) endif endif + +grep-libs = $(filter -l%,$(1)) +strip-libs = $(filter-out -l%,$(1)) + +ifdef NO_LIBPERL + BASIC_CFLAGS += -DNO_LIBPERL +else + PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null) + PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS)) + PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS)) + PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null` + FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS) + + ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED),perl),y) + BASIC_CFLAGS += -DNO_LIBPERL + NO_LIBPERL := 1 + else + ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS) + EXTLIBS += $(PERL_EMBED_LIBADD) + endif +endif
Signature · 1 line
1.7.11.7
PATCH 15/27 perf tools: Move stdlib check config into config/Makefile
In reply to Jiri OlsaMoving stdlib check config into config/Makefile.
--- tools/perf/Makefile | 18 ------------------ tools/perf/config/Makefile | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-)
tools/perf/Makefile +0 -18
@@ -532,24 +532,6 @@ ifeq ($(NO_PERF_REGS),0) endif endif -ifndef NO_STRLCPY - ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) - BASIC_CFLAGS += -DHAVE_STRLCPY - endif -endif - -ifndef NO_ON_EXIT - ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y) - BASIC_CFLAGS += -DHAVE_ON_EXIT - endif -endif - -ifndef NO_BACKTRACE - ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y) - BASIC_CFLAGS += -DBACKTRACE_SUPPORT - endif -endif - ifndef NO_LIBNUMA FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y)
tools/perf/config/Makefile +18 -0
@@ -361,3 +361,21 @@ else endif endif endif + +ifndef NO_STRLCPY + ifeq ($(call try-cc,$(SOURCE_STRLCPY),,-DHAVE_STRLCPY),y) + BASIC_CFLAGS += -DHAVE_STRLCPY + endif +endif + +ifndef NO_ON_EXIT + ifeq ($(call try-cc,$(SOURCE_ON_EXIT),,-DHAVE_ON_EXIT),y) + BASIC_CFLAGS += -DHAVE_ON_EXIT + endif +endif + +ifndef NO_BACKTRACE + ifeq ($(call try-cc,$(SOURCE_BACKTRACE),,-DBACKTRACE_SUPPORT),y) + BASIC_CFLAGS += -DBACKTRACE_SUPPORT + endif +endif
Signature · 1 line
1.7.11.7
PATCH 16/27 perf tools: Move libnuma check config into config/Makefile
In reply to Jiri OlsaMoving libnuma check config into config/Makefile
--- tools/perf/Makefile | 9 +-------- tools/perf/config/Makefile | 11 +++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-)
tools/perf/Makefile +1 -8
@@ -533,14 +533,7 @@ ifeq ($(NO_PERF_REGS),0) endif ifndef NO_LIBNUMA - FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma - ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y) - msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); - else - BASIC_CFLAGS += -DLIBNUMA_SUPPORT - BUILTIN_OBJS += $(OUTPUT)bench/numa.o - EXTLIBS += -lnuma - endif + BUILTIN_OBJS += $(OUTPUT)bench/numa.o endif ifdef ASCIIDOC8
tools/perf/config/Makefile +11 -0
@@ -379,3 +379,14 @@ ifndef NO_BACKTRACE BASIC_CFLAGS += -DBACKTRACE_SUPPORT endif endif + +ifndef NO_LIBNUMA + FLAGS_LIBNUMA = $(ALL_CFLAGS) $(ALL_LDFLAGS) -lnuma + ifneq ($(call try-cc,$(SOURCE_LIBNUMA),$(FLAGS_LIBNUMA),libnuma),y) + msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev); + NO_LIBNUMA := 1 + else + BASIC_CFLAGS += -DLIBNUMA_SUPPORT + EXTLIBS += -lnuma + endif +endif
Signature · 1 line
1.7.11.7
PATCH 17/27 perf tools: Move paths config into config/Makefile
In reply to Jiri OlsaMoving paths config into config/Makefile.
--- tools/perf/Makefile | 58 ---------------------------------------------- tools/perf/config/Makefile | 52 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 58 deletions(-)
tools/perf/Makefile +0 -58
@@ -87,39 +87,6 @@ ifeq ($(filter clean tags,$(MAKECMDGOALS)),) include config/Makefile endif -# Among the variables below, these: -# perfexecdir -# template_dir -# mandir -# infodir -# htmldir -# ETC_PERFCONFIG (but not sysconfdir) -# can be specified as a relative path some/where/else; -# this is interpreted as relative to $(prefix) and "perf" at -# runtime figures out where they are based on the path to the executable. -# This can help installing the suite in a relocatable way. - -# Make the path relative to DESTDIR, not to prefix -ifndef DESTDIR -prefix = $(HOME) -endif -bindir_relative = bin -bindir = $(prefix)/$(bindir_relative) -mandir = share/man -infodir = share/info -perfexecdir = libexec/perf-core -sharedir = $(prefix)/share -template_dir = share/perf-core/templates -htmldir = share/doc/perf-doc -ifeq ($(prefix),/usr) -sysconfdir = /etc -ETC_PERFCONFIG = $(sysconfdir)/perfconfig -else -sysconfdir = $(prefix)/etc -ETC_PERFCONFIG = etc/perfconfig -endif -lib = lib - export prefix bindir sharedir sysconfdir # sparse is architecture-neutral, which means that we need to tell it
@@ -543,23 +510,6 @@ endif endif # MAKECMDGOALS != tags endif # MAKECMDGOALS != clean -# Shell quote (do not use $(call) to accommodate ancient setups); - -ETC_PERFCONFIG_SQ = $(subst ','\'',$(ETC_PERFCONFIG)) - -DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) -bindir_SQ = $(subst ','\'',$(bindir)) -bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) -mandir_SQ = $(subst ','\'',$(mandir)) -infodir_SQ = $(subst ','\'',$(infodir)) -perfexecdir_SQ = $(subst ','\'',$(perfexecdir)) -template_dir_SQ = $(subst ','\'',$(template_dir)) -htmldir_SQ = $(subst ','\'',$(htmldir)) -prefix_SQ = $(subst ','\'',$(prefix)) -sysconfdir_SQ = $(subst ','\'',$(sysconfdir)) - -SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) - LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group ALL_CFLAGS += $(BASIC_CFLAGS)
@@ -568,7 +518,6 @@ ALL_LDFLAGS += $(BASIC_LDFLAGS) export INSTALL SHELL_PATH - ### Build rules SHELL = $(SHELL_PATH)
@@ -810,13 +759,6 @@ check: $(OUTPUT)common-cmds.h ### Installation rules -ifneq ($(filter /%,$(firstword $(perfexecdir))),) -perfexec_instdir = $(perfexecdir) -else -perfexec_instdir = $(prefix)/$(perfexecdir) -endif -perfexec_instdir_SQ = $(subst ','\'',$(perfexec_instdir)) - install-bin: all $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'
tools/perf/config/Makefile +52 -0
55 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 18/27 perf tools: Final touches for CHK config move
In reply to Jiri OlsaRemoving no longer needed ifdefs.
--- tools/perf/Makefile | 11 ----------- 1 file changed, 11 deletions(-)
tools/perf/Makefile +0 -11
@@ -410,14 +410,6 @@ BUILTIN_OBJS += $(OUTPUT)builtin-mem.o PERFLIBS = $(LIB_FILE) $(LIBLK) $(LIBTRACEEVENT) -# -# Platform specific tweaks -# -ifneq ($(MAKECMDGOALS),clean) -ifneq ($(MAKECMDGOALS),tags) - --include config/feature-tests.mak - # We choose to avoid "if .. else if .. else .. endif endif" # because maintaining the nesting to match is a pain. If # we had "elif" things would have been much nicer...
@@ -507,9 +499,6 @@ ifdef ASCIIDOC8 export ASCIIDOC8 endif -endif # MAKECMDGOALS != tags -endif # MAKECMDGOALS != clean - LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group ALL_CFLAGS += $(BASIC_CFLAGS)
Signature · 1 line
1.7.11.7
PATCH 24/27 kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool
In reply to Jiri OlsaIntroducing KCONFIG_AUTOCONFIGDEP variable for conf tool allowing to specify custom auto.conf.cmd file.
--- scripts/kconfig/confdata.c | 11 ++++++++++- scripts/kconfig/lkc.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-)
scripts/kconfig/confdata.c +10 -1
@@ -75,6 +75,14 @@ const char *conf_get_autoconfig_name(void)return name ? name :"include/config/auto.conf" ; } +const char *conf_get_autoconfigdep_name (void ) +{ +char *name =getenv ("KCONFIG_AUTOCONFIGDEP" ); + +return name ? name :"include/config/auto.conf.cmd" ; +} + +static char *conf_expand_value (const char *in) {struct symbol *sym;
@@ -948,7 +956,8 @@ int conf_write_autoconf(void)sym_clear_all_valid (); -file_write_dep ("include/config/auto.conf.cmd" ); + name =conf_get_autoconfigdep_name (); +file_write_dep (name);if (conf_split_config ())return 1 ;
scripts/kconfig/lkc.h +1 -0
@@ -83,6 +83,7 @@ const char *zconf_curname(void);/* confdata.c */ const char *conf_get_configname (void );const char *conf_get_autoconfig_name (void ); +const char *conf_get_autoconfigdep_name (void );char *conf_get_default_confname (void );void sym_set_change_count (int count);void sym_add_change_count (int count);
Signature · 1 line
1.7.11.7
PATCH 14/27 perf tools: Move libbfd check config into config/Makefile
In reply to Jiri OlsaMoving libbfd check config into config/Makefile.
--- tools/perf/Makefile | 37 ------------------------------------- tools/perf/config/Makefile | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 37 deletions(-)
tools/perf/Makefile +0 -37
@@ -526,43 +526,6 @@ ifndef NO_LIBPYTHON LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o endif -ifdef NO_DEMANGLE - BASIC_CFLAGS += -DNO_DEMANGLE -else - ifdef HAVE_CPLUS_DEMANGLE - EXTLIBS += -liberty - BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE - else - FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd - has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) - ifeq ($(has_bfd),y) - EXTLIBS += -lbfd - else - FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty - has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) - ifeq ($(has_bfd_iberty),y) - EXTLIBS += -lbfd -liberty - else - FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz - has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz) - ifeq ($(has_bfd_iberty_z),y) - EXTLIBS += -lbfd -liberty -lz - else - FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty - has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle) - ifeq ($(has_cplus_demangle),y) - EXTLIBS += -liberty - BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE - else - msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) - BASIC_CFLAGS += -DNO_DEMANGLE - endif - endif - endif - endif - endif -endif - ifeq ($(NO_PERF_REGS),0) ifeq ($(ARCH),x86) LIB_H += arch/x86/include/perf_regs.h
tools/perf/config/Makefile +37 -0
@@ -324,3 +324,40 @@ else endif endif endif + +ifdef NO_DEMANGLE + BASIC_CFLAGS += -DNO_DEMANGLE +else + ifdef HAVE_CPLUS_DEMANGLE + EXTLIBS += -liberty + BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE + else + FLAGS_BFD=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -DPACKAGE='perf' -lbfd + has_bfd := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD),libbfd) + ifeq ($(has_bfd),y) + EXTLIBS += -lbfd + else + FLAGS_BFD_IBERTY=$(FLAGS_BFD) -liberty + has_bfd_iberty := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY),liberty) + ifeq ($(has_bfd_iberty),y) + EXTLIBS += -lbfd -liberty + else + FLAGS_BFD_IBERTY_Z=$(FLAGS_BFD_IBERTY) -lz + has_bfd_iberty_z := $(call try-cc,$(SOURCE_BFD),$(FLAGS_BFD_IBERTY_Z),libz) + ifeq ($(has_bfd_iberty_z),y) + EXTLIBS += -lbfd -liberty -lz + else + FLAGS_CPLUS_DEMANGLE=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -liberty + has_cplus_demangle := $(call try-cc,$(SOURCE_CPLUS_DEMANGLE),$(FLAGS_CPLUS_DEMANGLE),demangle) + ifeq ($(has_cplus_demangle),y) + EXTLIBS += -liberty + BASIC_CFLAGS += -DHAVE_CPLUS_DEMANGLE + else + msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling) + BASIC_CFLAGS += -DNO_DEMANGLE + endif + endif + endif + endif + endif +endif
Signature · 1 line
1.7.11.7
PATCH 23/27 kbuild: Introduce KBUILD_AUTOCONF variable for auto.conf include
In reply to Jiri OlsaIntroducing KBUILD_AUTOCONF variable for auto.conf include allowing to specify custom auto.conf file.
--- scripts/Makefile.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/Makefile.build +2 -1
@@ -31,7 +31,8 @@ subdir-asflags-y := subdir-ccflags-y := # Read auto.conf if it exists, otherwise ignore --include include/config/auto.conf +kbuild-autoconf := $(if $(KBUILD_AUTOCONF),$(KBUILD_AUTOCONF),include/config/auto.conf) +-include $(kbuild-autoconf) include scripts/Kbuild.include
Signature · 1 line
1.7.11.7
PATCH 25/27 perf tools: Kbuild builtin source related fixies
In reply to Jiri OlsaAdding CONFIG_BUILTIN_* defines to govern builtin commands. This will be usefull for kbuild process switch.
--- tools/perf/builtin-cmds.h | 27 ++++++++++++++++++++++ tools/perf/builtin-help.c | 1 + tools/perf/perf.c | 45 +++++++++++++++++++++++++++++++++++-- tools/perf/util/generate-cmdlist.sh | 10 +++++++++ 4 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 tools/perf/builtin-cmds.h
tools/perf/builtin-cmds.h new file +27 -0
@@ -0,0 +1,27 @@ +#ifndef BUILTIN_CMDS_H +#define BUILTIN_CMDS_H + +#define CONFIG_BUILTIN_REPORT 1 +#define CONFIG_BUILTIN_SCRIPT 1 +#define CONFIG_BUILTIN_BENCH 1 +#define CONFIG_BUILTIN_SCHED 1 +#define CONFIG_BUILTIN_TRACE 1 +#define CONFIG_BUILTIN_TOP 1 +#define CONFIG_BUILTIN_RECORD 1 +#define CONFIG_BUILTIN_BUILDID_LIST 1 +#define CONFIG_BUILTIN_INJECT 1 +#define CONFIG_BUILTIN_LOCK 1 +#define CONFIG_BUILTIN_KVM 1 +#define CONFIG_BUILTIN_BUILDID_CACHE 1 +#define CONFIG_BUILTIN_EVLIST 1 +#define CONFIG_BUILTIN_KMEM 1 +#define CONFIG_BUILTIN_STAT 1 +#define CONFIG_BUILTIN_DIFF 1 +#define CONFIG_BUILTIN_ANNOTATE 1 +#define CONFIG_BUILTIN_TIMECHART 1 +#define CONFIG_BUILTIN_LIST 1 +#define CONFIG_BUILTIN_HELP 1 +#define CONFIG_BUILTIN_PROBE 1 +#define CONFIG_BUILTIN_MEM 1 + +#endif /* BUILTIN_CMDS_H */
tools/perf/builtin-help.c +1 -0
@@ -7,6 +7,7 @@#include "util/cache.h" #include "builtin.h" #include "util/exec_cmd.h" +#include "builtin-cmds.h" #include "common-cmds.h" #include "util/parse-options.h" #include "util/run-command.h"
tools/perf/perf.c +43 -2
83 lines not on this page · raw message
tools/perf/util/generate-cmdlist.sh +10 -0
@@ -1,5 +1,11 @@ #!/bin/sh +function cfg() +{ + cfg=`echo $1 | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'` + echo "$cfg" +} + echo "/* Automatically generated by $0 */ struct cmdname_help {
@@ -13,6 +19,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt | sort | while read cmd do + echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)" sed -n ' /^NAME/,/perf-'"$cmd"'/H ${
@@ -20,6 +27,7 @@ do s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ p }' "Documentation/perf-$cmd.txt" + echo "#endif" done echo "#ifdef LIBELF_SUPPORT"
@@ -27,6 +35,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt | sort | while read cmd do + echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)" sed -n ' /^NAME/,/perf-'"$cmd"'/H ${
@@ -34,6 +43,7 @@ do s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ p }' "Documentation/perf-$cmd.txt" + echo "#endif" done echo "#endif /* LIBELF_SUPPORT */" echo "};"
Signature · 1 line
1.7.11.7
PATCH 26/27 perf tools: Kbuild source related fixies
In reply to Jiri OlsaFixing several sources config dependencies to allow separate config builds.
--- tools/perf/builtin-lock.c | 2 ++ tools/perf/builtin-report.c | 9 ++++++++- tools/perf/builtin-sched.c | 2 ++ tools/perf/perf.c | 6 ++++++ tools/perf/perf.h | 2 ++ tools/perf/ui/browsers/scripts.c | 4 ++++ tools/perf/ui/setup.c | 10 +++++++++- 7 files changed, 33 insertions(+), 2 deletions(-)
tools/perf/builtin-lock.c +2 -0
@@ -972,9 +972,11 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)usage_with_options (report_usage, report_options); }__cmd_report (); +#ifdef CONFIG_BULTIN_SCRIPT }else if (!strcmp (argv[0 ],"script" )) {/* Aliased to 'perf script' */ return cmd_script (argc, argv, prefix); +#endif }else if (!strcmp (argv[0 ],"info" )) {if (argc) { argc = parse_options(argc, argv,
tools/perf/builtin-report.c +8 -1
@@ -573,6 +573,7 @@ static int __cmd_report(struct perf_report *rep)if (use_browser >0 ) {if (use_browser ==1 ) { +#ifdef CONFIG_TUI ret = perf_evlist__tui_browse_hists(session->evlist, help, NULL,
@@ -583,10 +584,16 @@ static int __cmd_report(struct perf_report *rep)*/ if (ret !=K_SWITCH_INPUT_DATA ) ret =0 ; - +#else + ret =-1 ; +#endif }else if (use_browser ==2 ) { +#ifdef CONFIG_GUI perf_evlist__gtk_browse_hists (session->evlist, help,NULL ); +#else + ret =-1 ; +#endif } }else perf_evlist__tty_browse_hists (session->evlist, rep, help);
tools/perf/builtin-sched.c +2 -0
@@ -1747,11 +1747,13 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)if (!argc)usage_with_options (sched_usage, sched_options); +#ifdef CONFIG_BULTIN_SCRIPT /* * Aliased to 'perf script' for now: */ if (!strcmp (argv[0 ],"script" ))return cmd_script (argc, argv, prefix); +#endif symbol__init ();if (!strncmp (argv[0 ],"rec" ,3 )) {
tools/perf/perf.c +6 -0
@@ -92,7 +92,9 @@ static struct cmd_struct commands[] = { #ifdef CONFIG_BUILTIN_KVM { "kvm", cmd_kvm, 0 }, #endif +#ifdef CONFIG_BUILTIN_TEST { "test", cmd_test, 0 }, +#endif #if defined LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE { "trace", cmd_trace, 0 }, #endif
@@ -535,13 +537,17 @@ int main(int argc, const char **argv) }else {/* The user didn't specify a command; give them help */ printf ("\n usage: %s\n\n" , perf_usage_string); +#ifdef CONFIG_BUILTIN_HELP list_common_cmds_help ();printf ("\n %s\n\n" , perf_more_info_string); +#endif goto out; } cmd = argv[0 ]; +#ifdef CONFIG_BUILTIN_TEST test_attr__init (); +#endif /* * We use PATH to find perf commands, but we prepend some higher
tools/perf/perf.h +2 -0
@@ -162,8 +162,10 @@ sys_perf_event_open(struct perf_event_attr *attr, fd =syscall (__NR_perf_event_open, attr, pid, cpu, group_fd, flags); +#ifdef CONFIG_BUILTIN_TEST if (unlikely (test_attr__enabled))test_attr__open (attr, pid, cpu, fd, group_fd, flags); +#endif return fd; }
tools/perf/ui/browsers/scripts.c +4 -0
@@ -59,7 +59,11 @@ static int list_scripts(char *script_name) paths[i] = names[i] +SCRIPT_NAMELEN ; } +#ifdef CONFIG_BUILTIN_SCRIPT num =find_scripts (names, paths); +#else + num =0 ; +#endif if (num >0 ) { choice =ui__popup_menu (num, names);if (choice < num && choice >=0 ) {
tools/perf/ui/setup.c +9 -1
@@ -17,13 +17,17 @@ void setup_browser(bool fallback_to_pager)switch (use_browser) {case 2 : +#ifdef CONFIG_GUI if (perf_gtk__init () ==0 )break ; +#endif /* fall through */ +#ifdef CONFIG_TUI case 1 : use_browser =1 ;if (ui__init () ==0 )break ; +#endif /* fall through */ default : use_browser =0 ;
@@ -36,16 +40,20 @@ void setup_browser(bool fallback_to_pager) } } -void exit_browser (bool wait_for_ok) +void exit_browser (bool wait_for_ok__maybe_unused ) {switch (use_browser) {case 2 : +#ifdef CONFIG_GUI perf_gtk__exit (wait_for_ok);break ; +#endif +#ifdef CONFIG_TUI case 1 :ui__exit (wait_for_ok);break ; +#endif default :break ;
Signature · 1 line
1.7.11.7
PATCH 27/27 perf tools: Add kbuild support into Makefile.kbuild
In reply to Jiri OlsaAdding kbuild support into Makefile.kbuild. The 'legacy' Makefile still stays untouched as it was.
It's possible to use kbuild by running 'make -f Makefile.kbuild' with any option supported by 'legacy' Makefile.
We now have 2 config files:
'.config' - user configured setup
'.config-detected' - system detected setup
The '.config-detected' affects '.config' and if there's configured feature in '.config' which was not detected it is automatically disabled.
The '.config-detected' is re/created if:
- there's no '.config-detected'
- '.config' was changed
In a cleaned tree the perf is built with 'allyesconfig' having disabled all non-detected features, just as it is done now.
You can change '.config' via:
make -f Makefile.kbuild menuconfig
There's difference for O=DIR build. The DIR is populated based on kernel source tree, so the final binary is created under DIR/tools/perf.
--- tools/perf/Kbuild | 47 +++ tools/perf/Kconfig | 256 ++++++++++++++ tools/perf/Makefile | 2 +- tools/perf/Makefile.kbuild | 411 +++++++++++++++++++++++ tools/perf/arch/Kbuild | 3 + tools/perf/arch/x86/Kbuild | 1 + tools/perf/arch/x86/util/Kbuild | 3 + tools/perf/bench/Kbuild | 9 + tools/perf/builtin-cmds.h | 4 + tools/perf/config/Makefile | 46 +++ tools/perf/config/Makefile.fix-config | 104 ++++++ tools/perf/config/Makefile.fix-legacy | 46 +++ tools/perf/config/defconfig | 54 +++ tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 3 + tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 4 + tools/perf/tests/Kbuild | 23 ++ tools/perf/ui/Kbuild | 14 + tools/perf/ui/browsers/Kbuild | 6 + tools/perf/ui/gtk/Kbuild | 7 + tools/perf/ui/stdio/Kbuild | 1 + tools/perf/ui/tui/Kbuild | 4 + tools/perf/util/Kbuild | 113 +++++++ tools/perf/util/PERF-VERSION-GEN | 6 +- tools/perf/util/generate-cmdlist.sh | 8 +- tools/perf/util/scripting-engines/Kbuild | 7 + tools/perf/util/setup.py | 10 +- 26 files changed, 1183 insertions(+), 9 deletions(-) create mode 100644 tools/perf/Kbuild create mode 100644 tools/perf/Kconfig create mode 100644 tools/perf/Makefile.kbuild create mode 100644 tools/perf/arch/Kbuild create mode 100644 tools/perf/arch/x86/Kbuild create mode 100644 tools/perf/arch/x86/util/Kbuild create mode 100644 tools/perf/bench/Kbuild create mode 100644 tools/perf/config/Makefile.fix-config create mode 100644 tools/perf/config/Makefile.fix-legacy create mode 100644 tools/perf/config/defconfig create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild create mode 100644 tools/perf/tests/Kbuild create mode 100644 tools/perf/ui/Kbuild create mode 100644 tools/perf/ui/browsers/Kbuild create mode 100644 tools/perf/ui/gtk/Kbuild create mode 100644 tools/perf/ui/stdio/Kbuild create mode 100644 tools/perf/ui/tui/Kbuild create mode 100644 tools/perf/util/Kbuild create mode 100644 tools/perf/util/scripting-engines/Kbuild
tools/perf/Kbuild new file +47 -0
@@ -0,0 +1,47 @@ +obj-y += perf.o + +obj-$(CONFIG_BUILTIN_ANNOTATE) += builtin-annotate.o +obj-$(CONFIG_BUILTIN_BENCH) += builtin-bench.o +obj-$(CONFIG_BUILTIN_BENCH) += bench/ +obj-$(CONFIG_BUILTIN_BUILDID_CACHE) += builtin-buildid-cache.o +obj-$(CONFIG_BUILTIN_BUILDID_LIST) += builtin-buildid-list.o +obj-$(CONFIG_BUILTIN_DIFF) += builtin-diff.o +obj-$(CONFIG_BUILTIN_EVLIST) += builtin-evlist.o +obj-$(CONFIG_BUILTIN_HELP) += builtin-help.o +obj-$(CONFIG_BUILTIN_INJECT) += builtin-inject.o +obj-$(CONFIG_BUILTIN_KMEM) += builtin-kmem.o +obj-$(CONFIG_BUILTIN_KVM) += builtin-kvm.o +obj-$(CONFIG_BUILTIN_LIST) += builtin-list.o +obj-$(CONFIG_BUILTIN_LOCK) += builtin-lock.o +obj-$(CONFIG_BUILTIN_PROBE) += builtin-probe.o +obj-$(CONFIG_BUILTIN_RECORD) += builtin-record.o +obj-$(CONFIG_BUILTIN_REPORT) += builtin-report.o +obj-$(CONFIG_BUILTIN_SCHED) += builtin-sched.o +obj-$(CONFIG_BUILTIN_SCRIPT) += builtin-script.o +obj-$(CONFIG_BUILTIN_STAT) += builtin-stat.o +obj-$(CONFIG_BUILTIN_TIMECHART) += builtin-timechart.o +obj-$(CONFIG_BUILTIN_TOP) += builtin-top.o +obj-$(CONFIG_BUILTIN_TRACE) += builtin-trace.o +obj-$(CONFIG_BUILTIN_MEM) += builtin-mem.o +obj-$(CONFIG_BUILTIN_TEST) += tests/ + +obj-y += ../../lib/rbtree.o + +obj-y += util/ +obj-y += ui/ +obj-y += arch/ + +obj-$(CONFIG_LIBPERL) += scripts/perl/Perf-Trace-Util/ +obj-$(CONFIG_LIBPYTHON) += scripts/python/Perf-Trace-Util/ + + +CFLAGS_rbtree.o += -Wno-unused-parameter + +CFLAGS_perf.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))" +CFLAGS_perf.o += -include PERF-VERSION-FILE + +$(obj)/perf.o: $(obj)/PERF-VERSION-FILE + +CFLAGS_builtin-help.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))" +CFLAGS_builtin-help.o += -D"PERF_INFO_PATH=KBUILD_STR($(infodir_SQ))" +CFLAGS_builtin-help.o += -D"PERF_MAN_PATH=KBUILD_STR($(mandir_SQ))"
tools/perf/Kconfig new file +256 -0
256 lines not on this page · raw message
tools/perf/Makefile +1 -1
@@ -545,7 +545,7 @@ $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPU $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt) - $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@ + $(QUIET_GEN). util/generate-cmdlist.sh ./ > $@+ && mv $@+ $@ $(SCRIPTS) : % : %.sh $(QUIET_GEN)$(INSTALL) '[email protected]' '$(OUTPUT)$@'
tools/perf/Makefile.kbuild new file +411 -0
411 lines not on this page · raw message
tools/perf/arch/Kbuild new file +3 -0
@@ -0,0 +1,3 @@ +obj-y += common.o + +obj-y += $(CONFIG_ARCH)/
tools/perf/arch/x86/Kbuild new file +1 -0
@@ -0,0 +1 @@ +obj-y += util/
tools/perf/arch/x86/util/Kbuild new file +3 -0
@@ -0,0 +1,3 @@ +obj-y += dwarf-regs.o +obj-y += header.o +obj-$(CONFIG_LIBUNWIND) += unwind.o
tools/perf/bench/Kbuild new file +9 -0
@@ -0,0 +1,9 @@ +obj-y += mem-memcpy.o +obj-y += mem-memset.o +obj-y += sched-messaging.o +obj-y += sched-pipe.o + +obj-$(CONFIG_NUMA) += numa.o + +obj-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o +obj-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
tools/perf/builtin-cmds.h +4 -0
@@ -1,6 +1,7 @@#ifndef BUILTIN_CMDS_H #define BUILTIN_CMDS_H +#ifndef CONFIG_KBUILD #define CONFIG_BUILTIN_REPORT 1#define CONFIG_BUILTIN_SCRIPT 1#define CONFIG_BUILTIN_BENCH 1
@@ -23,5 +24,8 @@#define CONFIG_BUILTIN_HELP 1#define CONFIG_BUILTIN_PROBE 1#define CONFIG_BUILTIN_MEM 1 +#else +#include <generated/autoconf.h> +#endif /* CONFIG_KBUILD */ #endif /* BUILTIN_CMDS_H */
tools/perf/config/Makefile +46 -0
67 lines not on this page · raw message
tools/perf/config/Makefile.fix-config new file +104 -0
104 lines not on this page · raw message
tools/perf/config/Makefile.fix-legacy new file +46 -0
46 lines not on this page · raw message
tools/perf/config/defconfig new file +54 -0
54 lines not on this page · raw message
tools/perf/scripts/perl/Perf-Trace-Util/Kbuild new file +3 -0
@@ -0,0 +1,3 @@ +obj-y += Context.o + +CFLAGS_Context.o += $(PERL_EMBED_CCOPTS)
tools/perf/scripts/python/Perf-Trace-Util/Kbuild new file +4 -0
@@ -0,0 +1,4 @@ +obj-y += Context.o + +CFLAGS_Context.o := $(PYTHON_EMBED_CCOPTS) +CFLAGS_Context.o += -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs
tools/perf/tests/Kbuild new file +23 -0
@@ -0,0 +1,23 @@ +obj-y += builtin-test.o +obj-y += attr.o +obj-y += dso-data.o +obj-y += evsel-roundtrip-name.o +obj-y += evsel-tp-sched.o +obj-y += hists_link.o +obj-y += mmap-basic.o +obj-y += open-syscall-all-cpus.o +obj-y += open-syscall.o +obj-y += open-syscall-tp-fields.o +obj-y += parse-events.o +obj-y += perf-record.o +obj-y += pmu.o +obj-y += python-use.o +obj-y += rdpmc.o +obj-y += vmlinux-kallsyms.o +obj-y += bp_signal.o +obj-y += bp_signal_overflow.o +obj-y += sw-clock.o +obj-y += task-exit.o + +CFLAGS_python-use.o += -DPYTHON='"$(PYTHON_WORD)"' -DPYTHONPATH='"python"' +CFLAGS_attr.o += -DPYTHON='"$(PYTHON_WORD)"' -DBINDIR='"$(bindir_SQ)"'
tools/perf/ui/Kbuild new file +14 -0
@@ -0,0 +1,14 @@ +obj-$(CONFIG_TUI) += browser.o +obj-y += helpline.o +obj-y += hist.o +obj-y += progress.o +obj-y += setup.o +obj-y += util.o + +obj-y += browsers/ +obj-y += stdio/ + +obj-$(CONFIG_TUI) += tui/ +obj-$(CONFIG_GTK2) += gtk/ + +CFLAGS_browser.o += -DENABLE_SLFUTURE_CONST
tools/perf/ui/browsers/Kbuild new file +6 -0
@@ -0,0 +1,6 @@ +obj-$(CONFIG_TUI) += annotate.o +obj-$(CONFIG_TUI) += hists.o +obj-$(CONFIG_TUI) += map.o +obj-$(CONFIG_TUI) += scripts.o + +CFLAGS_hists.o += -DENABLE_SLFUTURE_CONST
tools/perf/ui/gtk/Kbuild new file +7 -0
@@ -0,0 +1,7 @@ +obj-y += browser.o +obj-y += hists.o +obj-y += setup.o +obj-y += util.o +obj-y += helpline.o +obj-y += progress.o +obj-y += annotate.o
tools/perf/ui/stdio/Kbuild new file +1 -0
@@ -0,0 +1 @@ +obj-y += hist.o
tools/perf/ui/tui/Kbuild new file +4 -0
@@ -0,0 +1,4 @@ +obj-y += helpline.o +obj-y += progress.o +obj-y += setup.o +obj-y += util.o
tools/perf/util/Kbuild new file +113 -0
113 lines not on this page · raw message
tools/perf/util/PERF-VERSION-GEN +5 -1
@@ -9,6 +9,10 @@ GVF=${OUTPUT}PERF-VERSION-FILE LF=' ' +if [ "${srctree}x" = "x" ]; then +srctree=../.. +fi + # # First check if there is a .git to get the version from git describe # otherwise try to get the version from the kernel Makefile
@@ -19,7 +23,7 @@ then VN=$(echo $VN"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD)) VN=$(echo "$VN" | sed -e 's/-/./g'); else - VN=$(MAKEFLAGS= make -sC ../.. kernelversion) + VN=$(MAKEFLAGS= make -sC $srctree kernelversion) fi VN=$(expr "$VN" : v*'\(.*\)')
tools/perf/util/generate-cmdlist.sh +4 -4
@@ -15,7 +15,7 @@ struct cmdname_help static struct cmdname_help common_cmds[] = {" -sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt | +sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' $1/command-list.txt | sort | while read cmd do
@@ -26,12 +26,12 @@ do x s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ p - }' "Documentation/perf-$cmd.txt" + }' "$1/Documentation/perf-$cmd.txt" echo "#endif" done echo "#ifdef LIBELF_SUPPORT" -sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt | +sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' $1/command-list.txt | sort | while read cmd do
@@ -42,7 +42,7 @@ do x s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ p - }' "Documentation/perf-$cmd.txt" + }' "$1/Documentation/perf-$cmd.txt" echo "#endif" done echo "#endif /* LIBELF_SUPPORT */"
tools/perf/util/scripting-engines/Kbuild new file +7 -0
@@ -0,0 +1,7 @@ +obj-$(CONFIG_LIBPERL) += trace-event-perl.o +obj-$(CONFIG_LIBPYTHON) += trace-event-python.o + +CFLAGS_trace-event-perl.o := $(PERL_EMBED_CCOPTS) + +CFLAGS_trace-event-python.o := $(PYTHON_EMBED_CCOPTS) +CFLAGS_trace-event-python.o += -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow
tools/perf/util/setup.py +7 -3
@@ -2,6 +2,7 @@ from distutils.core import setup, Extension from os import getenv +from os import environ from distutils.command.build_ext import build_ext as _build_ext from distutils.command.install_lib import install_lib as _install_lib
@@ -18,16 +19,19 @@ class install_lib(_install_lib): self.build_dir = build_lib +cflags = getenv('CFLAGS', '').split() cflags = ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ] -cflags += getenv('CFLAGS', '').split() build_lib = getenv('PYTHON_EXTBUILD_LIB') build_tmp = getenv('PYTHON_EXTBUILD_TMP') libtraceevent = getenv('LIBTRACEEVENT') liblk = getenv('LIBLK') -ext_sources = [f.strip() for f in file('util/python-ext-sources') - if len(f.strip()) > 0 and f[0] != '#'] +if environ.has_key('PYTHON_EXT_SRCS'): + ext_sources = getenv('PYTHON_EXT_SRCS').split() +else: + ext_sources = [f.strip() for f in file('util/python-ext-sources') + if len(f.strip()) > 0 and f[0] != '#'] perf = Extension('perf', sources = ext_sources,
Signature · 1 line
1.7.11.7
PATCH 22/27 perf tools: Add NO_BIONIC variable to confiure bionic setup
In reply to Jiri OlsaAdding NO_BIONIC variable to confiure bionic setup
--- tools/perf/Makefile | 4 ++++ tools/perf/config/Makefile | 2 ++ 2 files changed, 6 insertions(+)
tools/perf/Makefile +4 -0
@@ -51,6 +51,10 @@ include config/utilities.mak # Define NO_BACKTRACE if you do not want stack backtrace debug feature # # Define NO_LIBNUMA if you do not want numa perf benchmark +# +# Define NO_LIBAUDIT if you do not want libaudit support +# +# Define NO_LIBBIONIC if you do not want bionic support ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(shell pwd)))
tools/perf/config/Makefile +2 -0
@@ -131,11 +131,13 @@ CFLAGS += \ CFLAGS += \ -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE +ifndef NO_BIONIC ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) BIONIC := 1 EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) endif +endif # NO_BIONIC ifdef NO_LIBELF NO_DWARF := 1
Signature · 1 line
1.7.11.7
PATCH 13/27 perf tools: Move libpython check config into config/Makefile
In reply to Jiri OlsaMoving libpython check config into config/Makefile.
--- tools/perf/Makefile | 68 ++-------------------------------------------- tools/perf/config/Makefile | 63 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 65 deletions(-)
tools/perf/Makefile +3 -65
@@ -184,8 +184,6 @@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) # PROGRAMS += $(OUTPUT)perf -LANG_BINDINGS = - # what 'all' will build and 'install' will install, in perfexecdir ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
@@ -523,69 +521,9 @@ ifndef NO_LIBPERL LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o endif -disable-python = $(eval $(disable-python_code)) -define disable-python_code - BASIC_CFLAGS += -DNO_LIBPYTHON - $(if $(1),$(warning No $(1) was found)) - $(warning Python support will not be built) -endef - -override PYTHON := \ - $(call get-executable-or-default,PYTHON,python) - -ifndef PYTHON - $(call disable-python,python interpreter) -else - - PYTHON_WORD := $(call shell-wordify,$(PYTHON)) - - ifdef NO_LIBPYTHON - $(call disable-python) - else - - override PYTHON_CONFIG := \ - $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config) - - ifndef PYTHON_CONFIG - $(call disable-python,python-config tool) - else - - PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) - - PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) - PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) - PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) - PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) - FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) - - ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED),python),y) - $(call disable-python,Python.h (for Python 2.x)) - else - - ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED),python version),y) - $(warning Python 3 is not yet supported; please set) - $(warning PYTHON and/or PYTHON_CONFIG appropriately.) - $(warning If you also have Python 2 installed, then) - $(warning try something like:) - $(warning $(and ,)) - $(warning $(and ,) make PYTHON=python2) - $(warning $(and ,)) - $(warning Otherwise, disable Python support entirely:) - $(warning $(and ,)) - $(warning $(and ,) make NO_LIBPYTHON=1) - $(warning $(and ,)) - $(error $(and ,)) - else - ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS) - EXTLIBS += $(PYTHON_EMBED_LIBADD) - LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o - LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o - LANG_BINDINGS += $(OUTPUT)python/perf.so - endif - - endif - endif - endif +ifndef NO_LIBPYTHON + LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o + LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o endif ifdef NO_DEMANGLE
tools/perf/config/Makefile +63 -0
66 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 21/27 perf tools: Switch to full patch C include directories
In reply to Jiri OlsaSwitching to full patch C include directories, to make the includes clear. Plus little include cleanup.
--- tools/perf/Makefile | 4 ++-- tools/perf/config/Makefile | 49 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 14 deletions(-)
tools/perf/Makefile +2 -2
@@ -80,8 +80,8 @@ FLEX = flex BISON = bison STRIP ?= strip -LK_DIR = ../lib/lk/ -TRACE_EVENT_DIR = ../lib/traceevent/ +LK_DIR = $(srctree)/tools/lib/lk/ +TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/ ifeq ($(filter clean tags,$(MAKECMDGOALS)),) include config/Makefile
tools/perf/config/Makefile +37 -12
77 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 10/27 perf tools: Move slang check config into config/Makefile
In reply to Jiri OlsaMoving slang check config into config/Makefile.
--- tools/perf/Makefile | 39 +++++++++++++-------------------------- tools/perf/config/Makefile | 17 +++++++++++++++++ 2 files changed, 30 insertions(+), 26 deletions(-)
tools/perf/Makefile +13 -26
@@ -87,10 +87,6 @@ ifeq ($(filter clean tags,$(MAKECMDGOALS)),) include config/Makefile endif -ifdef NO_NEWT - NO_SLANG=1 -endif - # Among the variables below, these: # perfexecdir # template_dir
@@ -497,28 +493,19 @@ ifndef NO_LIBAUDIT endif ifndef NO_SLANG - FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang - ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y) - msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); - else - # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h - BASIC_CFLAGS += -I/usr/include/slang - BASIC_CFLAGS += -DSLANG_SUPPORT - EXTLIBS += -lslang - LIB_OBJS += $(OUTPUT)ui/browser.o - LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o - LIB_OBJS += $(OUTPUT)ui/browsers/hists.o - LIB_OBJS += $(OUTPUT)ui/browsers/map.o - LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o - LIB_OBJS += $(OUTPUT)ui/tui/setup.o - LIB_OBJS += $(OUTPUT)ui/tui/util.o - LIB_OBJS += $(OUTPUT)ui/tui/helpline.o - LIB_OBJS += $(OUTPUT)ui/tui/progress.o - LIB_H += ui/browser.h - LIB_H += ui/browsers/map.h - LIB_H += ui/keysyms.h - LIB_H += ui/libslang.h - endif + LIB_OBJS += $(OUTPUT)ui/browser.o + LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o + LIB_OBJS += $(OUTPUT)ui/browsers/hists.o + LIB_OBJS += $(OUTPUT)ui/browsers/map.o + LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o + LIB_OBJS += $(OUTPUT)ui/tui/setup.o + LIB_OBJS += $(OUTPUT)ui/tui/util.o + LIB_OBJS += $(OUTPUT)ui/tui/helpline.o + LIB_OBJS += $(OUTPUT)ui/tui/progress.o + LIB_H += ui/browser.h + LIB_H += ui/browsers/map.h + LIB_H += ui/keysyms.h + LIB_H += ui/libslang.h endif ifndef NO_GTK2
tools/perf/config/Makefile +17 -0
@@ -208,3 +208,20 @@ ifndef NO_LIBAUDIT EXTLIBS += -laudit endif endif + +ifdef NO_NEWT + NO_SLANG=1 +endif + +ifndef NO_SLANG + FLAGS_SLANG=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) -I/usr/include/slang -lslang + ifneq ($(call try-cc,$(SOURCE_SLANG),$(FLAGS_SLANG),libslang),y) + msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev); + NO_SLANG := 1 + else + # Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h + BASIC_CFLAGS += -I/usr/include/slang + BASIC_CFLAGS += -DSLANG_SUPPORT + EXTLIBS += -lslang + endif +endif
Signature · 1 line
1.7.11.7
PATCH 11/27 perf tools: Move gtk2 check config into config/Makefile
In reply to Jiri OlsaMoving gtk2 check config into config/Makefile.
--- tools/perf/Makefile | 25 +++++++------------------ tools/perf/config/Makefile | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 18 deletions(-)
tools/perf/Makefile +7 -18
@@ -509,24 +509,13 @@ ifndef NO_SLANG endif ifndef NO_GTK2 - FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) - ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y) - msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); - else - ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y) - BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR - endif - BASIC_CFLAGS += -DGTK2_SUPPORT - BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) - EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) - LIB_OBJS += $(OUTPUT)ui/gtk/browser.o - LIB_OBJS += $(OUTPUT)ui/gtk/hists.o - LIB_OBJS += $(OUTPUT)ui/gtk/setup.o - LIB_OBJS += $(OUTPUT)ui/gtk/util.o - LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o - LIB_OBJS += $(OUTPUT)ui/gtk/progress.o - LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o - endif + LIB_OBJS += $(OUTPUT)ui/gtk/browser.o + LIB_OBJS += $(OUTPUT)ui/gtk/hists.o + LIB_OBJS += $(OUTPUT)ui/gtk/setup.o + LIB_OBJS += $(OUTPUT)ui/gtk/util.o + LIB_OBJS += $(OUTPUT)ui/gtk/helpline.o + LIB_OBJS += $(OUTPUT)ui/gtk/progress.o + LIB_OBJS += $(OUTPUT)ui/gtk/annotate.o endif ifdef NO_LIBPERL
tools/perf/config/Makefile +15 -0
@@ -225,3 +225,18 @@ ifndef NO_SLANG EXTLIBS += -lslang endif endif + +ifndef NO_GTK2 + FLAGS_GTK2=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) + ifneq ($(call try-cc,$(SOURCE_GTK2),$(FLAGS_GTK2),gtk2),y) + msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev); + NO_GTK2 := 1 + else + ifeq ($(call try-cc,$(SOURCE_GTK2_INFOBAR),$(FLAGS_GTK2),-DHAVE_GTK_INFO_BAR),y) + BASIC_CFLAGS += -DHAVE_GTK_INFO_BAR + endif + BASIC_CFLAGS += -DGTK2_SUPPORT + BASIC_CFLAGS += $(shell pkg-config --cflags gtk+-2.0 2>/dev/null) + EXTLIBS += $(shell pkg-config --libs gtk+-2.0 2>/dev/null) + endif +endif
Signature · 1 line
1.7.11.7
PATCH 8/27 perf tools: Move libunwind check config into config/Makefile
In reply to Jiri OlsaMoving libunwind check config into config/Makefile.
--- tools/perf/Makefile | 24 ------------------------ tools/perf/config/Makefile | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 24 deletions(-)
tools/perf/Makefile +0 -24
@@ -461,26 +461,6 @@ ifneq ($(MAKECMDGOALS),tags) # because maintaining the nesting to match is a pain. If # we had "elif" things would have been much nicer... -# There's only x86 (both 32 and 64) support for CFI unwind so far -ifneq ($(ARCH),x86) - NO_LIBUNWIND := 1 -endif - -ifndef NO_LIBUNWIND -# for linking with debug library, run like: -# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ -ifdef LIBUNWIND_DIR - LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include - LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib -endif - -FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) -ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) - msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); - NO_LIBUNWIND := 1 -endif # Libunwind support -endif # NO_LIBUNWIND - -include arch/$(ARCH)/Makefile ifneq ($(OUTPUT),)
@@ -509,10 +489,6 @@ endif # NO_DWARF endif # NO_LIBELF ifndef NO_LIBUNWIND - BASIC_CFLAGS += -DLIBUNWIND_SUPPORT - EXTLIBS += $(LIBUNWIND_LIBS) - BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS) - BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) LIB_OBJS += $(OUTPUT)util/unwind.o endif
tools/perf/config/Makefile +27 -0
@@ -170,3 +170,30 @@ endif # PERF_HAVE_DWARF_REGS endif # NO_DWARF endif # NO_LIBELF + +# There's only x86 (both 32 and 64) support for CFI unwind so far +ifneq ($(ARCH),x86) + NO_LIBUNWIND := 1 +endif + +ifndef NO_LIBUNWIND +# for linking with debug library, run like: +# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/ +ifdef LIBUNWIND_DIR + LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include + LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib +endif + +FLAGS_UNWIND=$(LIBUNWIND_CFLAGS) $(ALL_CFLAGS) $(LIBUNWIND_LDFLAGS) $(ALL_LDFLAGS) $(EXTLIBS) $(LIBUNWIND_LIBS) +ifneq ($(call try-cc,$(SOURCE_LIBUNWIND),$(FLAGS_UNWIND),libunwind),y) + msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99); + NO_LIBUNWIND := 1 +endif # Libunwind support +endif # NO_LIBUNWIND + +ifndef NO_LIBUNWIND + BASIC_CFLAGS += -DLIBUNWIND_SUPPORT + EXTLIBS += $(LIBUNWIND_LIBS) + BASIC_CFLAGS := $(LIBUNWIND_CFLAGS) $(BASIC_CFLAGS) + BASIC_LDFLAGS := $(LIBUNWIND_LDFLAGS) $(BASIC_LDFLAGS) +endif # NO_LIBUNWIND
Signature · 1 line
1.7.11.7
PATCH 20/27 perf tools: Merge all *LDFLAGS* make variable into LDFLAGS
In reply to Jiri OlsaMerging all *LDFLAGS* make variable into LDFLAGS to eliminate all special *LDFLAGS* variables and make the setup clear.
--- tools/perf/Makefile | 6 ++---- tools/perf/config/Makefile | 41 +++++++++++++++++++++++------------------ 2 files changed, 25 insertions(+), 22 deletions(-)
tools/perf/Makefile +2 -4
@@ -501,8 +501,6 @@ endif LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group -ALL_LDFLAGS += $(BASIC_LDFLAGS) - export INSTALL SHELL_PATH ### Build rules
@@ -525,7 +523,7 @@ $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS $(CFLAGS) -c $(filter %.c,$^) -o $@ $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) - $(QUIET_LINK)$(CC) $(CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \ + $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \ $(BUILTIN_OBJS) $(LIBS) -o $@ $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
@@ -630,7 +628,7 @@ $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Uti $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< $(OUTPUT)perf-%: %.o $(PERFLIBS) - $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) + $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS) $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
tools/perf/config/Makefile +23 -18
141 lines not on this page · raw message
Signature · 1 line
1.7.11.7
PATCH 19/27 perf tools: Merge all *CFLAGS* make variable into CFLAGS
In reply to Jiri OlsaMerging all *CFLAGS* make variable into CFLAGS to eliminate all special *_CFLAGS_* variables and make the setup clear.
--- tools/perf/Makefile | 62 +++++++++++++-------------- tools/perf/config/Makefile | 104 ++++++++++++++++++++++++--------------------- tools/perf/util/setup.py | 2 +- 3 files changed, 86 insertions(+), 82 deletions(-)
tools/perf/Makefile +30 -32
@@ -136,7 +136,7 @@ PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources) PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) - $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ + $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \ --quiet build_ext; \ mkdir -p $(OUTPUT)python && \ cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
@@ -501,8 +501,6 @@ endif LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group -ALL_CFLAGS += $(BASIC_CFLAGS) -ALL_CFLAGS += $(ARCH_CFLAGS) ALL_LDFLAGS += $(BASIC_LDFLAGS) export INSTALL SHELL_PATH
@@ -524,20 +522,20 @@ strip: $(PROGRAMS) $(OUTPUT)perf $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS $(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \ '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ - $(ALL_CFLAGS) -c $(filter %.c,$^) -o $@ + $(CFLAGS) -c $(filter %.c,$^) -o $@ $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) - $(QUIET_LINK)$(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \ + $(QUIET_LINK)$(CC) $(CFLAGS) $(ALL_LDFLAGS) $(OUTPUT)perf.o \ $(BUILTIN_OBJS) $(LIBS) -o $@ $(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ '-DPERF_MAN_PATH="$(mandir_SQ)"' \ '-DPERF_INFO_PATH="$(infodir_SQ)"' $< $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ '-DPERF_HTML_PATH="$(htmldir_SQ)"' \ '-DPERF_MAN_PATH="$(mandir_SQ)"' \ '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
@@ -562,77 +560,77 @@ $(OUTPUT)perf.o perf.spec \ # over the general rule for .o $(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -w $< + $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -w $< $(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $< + $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $< $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $< $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $< + $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $< $(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -S $(ALL_CFLAGS) $< + $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $< $(OUTPUT)%.o: %.S - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $< $(OUTPUT)%.s: %.S - $(QUIET_CC)$(CC) -o $@ -E $(ALL_CFLAGS) $< + $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $< $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \ '-DPREFIX="$(prefix_SQ)"' \ $< $(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \ $< $(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) \ + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \ -DPYTHONPATH='"$(OUTPUT)python"' \ -DPYTHON='"$(PYTHON_WORD)"' \ $< $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< $(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< $(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< $(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< $(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DENABLE_SLFUTURE_CONST $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $< $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< $(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-redundant-decls $< $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< $(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS - $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< + $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $< $(OUTPUT)perf-%: %.o $(PERFLIBS) - $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) + $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H) $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
@@ -719,7 +717,7 @@ cscope: $(FIND) . -name '*.[hcS]' -print | xargs cscope -b ### Detect prefix changes -TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ +TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\ $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) $(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
@@ -740,7 +738,7 @@ check: $(OUTPUT)common-cmds.h then \ for i in *.c */*.c; \ do \ - sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ + sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \ done; \ else \ exit 1; \
tools/perf/config/Makefile +55 -49
298 lines not on this page · raw message
tools/perf/util/setup.py +1 -1
@@ -18,7 +18,7 @@ class install_lib(_install_lib): self.build_dir = build_lib -cflags = ['-fno-strict-aliasing', '-Wno-write-strings'] +cflags = ['-fno-strict-aliasing', '-Wno-write-strings', '-Wno-unused-parameter' ] cflags += getenv('CFLAGS', '').split() build_lib = getenv('PYTHON_EXTBUILD_LIB')
Signature · 1 line
1.7.11.7
Re: [PATCH 02/27] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif
In reply to Jiri OlsaQuoted 4 lines · Jiri Olsa
Unmatched spaces/tabs
Makefileindentation could make theMakefilefails. While the tabed line could be considered sometimes as follow up for rule command, the mixed space tab meses up with makefile if conditions.
I have too many times been beaten that asssignments was ignored because I used tabs to indendt the assignmnet. So in all Makefile I edit spaces are used for indent. Tabs are only used for commands.
Sam
Re: [PATCH 01/27] perf tools: Add automated make test suite
In reply to Jiri OlsaQuoted 19 lines · Jiri Olsa
Adding automatd test for testing the build process. To run it you needto be in perf directory or specify one with PERF variable. It's also possible to specify optional
Makefileto test via MK variable.Whole suite is executed twice, the second time with O=/tmp/xxx option added.
To run the whole suite:
$ make -f tests/make MAKE_PURE: cd . && make -f Makefile TEST: test -x ./perf MAKE_DEBUG: cd . && make -f Makefile DEBUG=1 TEST: test -x ./perf ...You see command line for '
MAKE_PURE' test right away, and the output is stored intoMAKE_PUREfile.
Quoted 8 lines
To run simple test:
$ make -f tests/make MAKE_DEBUG MAKE_DEBUG: cd . && make -f Makefile DEBUG=1 TEST: test -x ./perfAt this moment tests checks for succesfull build and for existence of several built files. Additional after-build checks could be added.
Some nit-picks.
I did not try to find out how this works.
tools/perf/tests/make line 10
Quoted 3 lines
tools/perf/tests/make new file +3
-0+ +MAKE_DEBUG := DEBUG=1 +MAKE_NO_LIBPERL := NO_LIBPERL=1
Why all these ugly UPPERCASE names?
In kbuild files the unwritten rule is that variables with global scope are upper-case.
And variables with local scope are lower case.
You can find many examples where this is not followed - but this is the general approach.
Quoted 1 line
+MAKE_MINIMAL := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
Keeping lines less than 120 chars long is good.
Some people swer to 80 chars.
tools/perf/tests/make line 35
Quoted 4 lines
tools/perf/tests/make new file +4
-0+RUN := \ + MAKE_PURE \ + MAKE_DEBUG \ + MAKE_NO_LIBPERL \
RUN += MAKE_PURE
RUN += MAKE_DEBUG
RUN += MAKE_NO_LIBPERL
Is so much more readable.
As a general rule - use \
to continue lines only when you really have to.
Sam
Re: [PATCH 03/27] perf tools: Move arch check into config/Makefile
In reply to Jiri OlsaQuoted 76 lines · Jiri Olsa
Moving arch check into config/Makefile.
Signed-off-by Jiri Olsa <[email protected]>Cc Arnaldo Carvalho de Melo <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Ingo Molnar <[email protected]>Cc Paul Mackerras <[email protected]>Cc Corey Ashford <[email protected]>Cc Frederic Weisbecker <[email protected]>Cc Namhyung Kim <[email protected]>Cc Borislav Petkov <[email protected]>Cc Stephane Eranian <[email protected]>--- tools/perf/Makefile | 31 ++----------------------------- tools/perf/config/Makefile | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 29 deletions(-) create mode 100644 tools/perf/config/Makefiletools/perf/Makefile +2
-29@@ -55,37 +55,11 @@ include config/utilities.mak $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT) -uname_M := $(shell uname -m 2>/dev/null || echo not) - -ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ - -e s/arm.*/arm/ -e s/sa110/arm/ \ - -e s/s390x/s390/ -e s/parisc64/parisc/ \ - -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) -NO_PERF_REGS := 1 - CC = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar -# Additional ARCH settings for x86 -ifeq ($(ARCH),i386) - override ARCH := x86 - NO_PERF_REGS := 0 - LIBUNWIND_LIBS = -lunwind -lunwind-x86 -endif -ifeq ($(ARCH),x86_64) - override ARCH := x86 - IS_X86_64 := 0 - ifeq (, $(findstring m32,$(EXTRA_CFLAGS))) - IS_X86_64 := $(shell echo __x86_64__ | ${CC} -E -x c - | tail -n 1) - endif - ifeq (${IS_X86_64}, 1) - RAW_ARCH := x86_64 - ARCH_CFLAGS := -DARCH_X86_64 - ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S - endif - NO_PERF_REGS := 0 - LIBUNWIND_LIBS = -lunwind -lunwind-x86_64 +ifeq ($(filter clean tags,$(MAKECMDGOALS)),) +include config/Makefile endif # Treat warnings as errors unless directed not to@@ -857,7 +831,6 @@ ifeq ($(NO_PERF_REGS),0) ifeq ($(ARCH),x86) LIB_H += arch/x86/include/perf_regs.h endif - BASIC_CFLAGS += -DHAVE_PERF_REGS endif ifndef NO_STRLCPYtools/perf/config/Makefile new file +0
-0
tools/perf/config/Makefile line 7
Quoted 7 lines
tools/perf/config/Makefile new file +7
-0@@ -0,0 +1,34 @@ +uname_M := $(shell uname -m 2>/dev/null || echo not) + +ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ + -e s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/s390x/s390/ -e s/parisc64/parisc/ \ + -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
this is shared with the top-level kernel Makefile. Could we find a way to share this?
Sam
Re: [PATCH 27/27] perf tools: Add kbuild support into Makefile.kbuild
In reply to Jiri OlsaQuoted 2 lines · Jiri Olsa
Adding kbuild support into Makefile.kbuild. The 'legacy'
Makefilestill stays untouched as it was.
When readign the Kbuild file I get confused.
the obj-y syntax is used for kernel built-in stuff,
and obj-m for modules.
I had expected either a perf specific syntax or something like the syntax used for host programs.
Sam
Hi Jiri:
Quoted 2 lines · Jiri Olsa
hi,
sending RFC for build changes and kbuild support.
Have you seen this patch set:
https://lkml.org/lkml/2012/8/20/59
It hooks into the conf commands to generate a .config file. Coincidentally I updated and expanded the patch series this morning to include dependencies and such. Latest Pconfig attached to give you an idea. I need to collapse a few patches and send them out tonight.
David
config ARCH
string
option env="ARCH"
config X86
def_bool y if ARCH = "x86"
select HAVE_CFI_UNWIND_SUPPORT
config HAVE_CFI_UNWIND_SUPPORT
bool
config BIONIC
bool "Enable support for Bionic (e.g., Android platform)" default n
select LIBC
config NEWT
bool "Enable newt-based TUI"
config GTK2
bool "Enable GTK-based UI"
config LIBC
bool "Development support for libc is available - glibc or bionic"
config LIBELF
bool "Enable support for libelf"
depends on !BIONIC && LIBC
config LIBUNWIND
bool "Enable support for libunwind"
depends on HAVE_CFI_UNWIND_SUPPORT
depends on LIBELF
config DEMANGLE
bool "Enable support for demangle"
depends on LIBELF
config DWARF
bool "Enable support for dwarf"
depends on LIBELF
config LIBAUDIT
bool "Enable support for libaudit"
help
Used for perf trace tool.
config LIBNUMA
bool "Enable support for libnuma"
help
Used for 'perf bench numa mem' benchmark
config BACKTRACE
bool "Enable support for stack backtrace debugging"
config LIBPERL
bool "Enable support for perl scripting engine"
config LIBPYTHON
bool "Enable support for python scripting engine"
Re: [PATCH 27/27] perf tools: Add kbuild support into Makefile.kbuild
In reply to Sam RavnborgQuoted 9 lines · Sam Ravnborg
Quoted 2 lines · Jiri Olsa
Adding kbuild support into Makefile.kbuild. The 'legacy'
Makefilestill stays untouched as it was.When readign the
Kbuildfile I get confused.
the obj-y syntax is used for kernel built-in stuff,
and obj-m for modules.
I had expected either a perf specific syntax or something like the syntax used for host programs.
While building kernel you need to have separate flags for internal objects and for host programs.
First, I thought I need to separate it as you say, but perf build is separated from kernel built process, so AFAICS we can use obj-y with no harm in perf.
It's quite possible I missed something and kbuild folks prove me wrong ;-)
The Makefile.kbuild defines flags to be used for obj-y.
jirka
Re: [PATCH 03/27] perf tools: Move arch check into config/Makefile
In reply to Sam RavnborgOn Mon, Apr 01, 2013 at 09:54:46PM +0200, Sam Ravnborg wrote:
SNIP
Quoted 8 lines
Quoted 8 lines
tools/perf/config/Makefile new file +2
-0@@ -0,0 +1,34 @@ +uname_M := $(shell uname -m 2>/dev/null || echo not) +
Quoted 8 lines
tools/perf/config/Makefile line 7
Quoted 5 lines
tools/perf/config/Makefile new file +5
-0+ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ + -e s/arm.*/arm/ -e s/sa110/arm/ \ + -e s/s390x/s390/ -e s/parisc64/parisc/ \ + -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )this is shared with the top-level kernel
Makefile. Could we find a way to share this?
right, maybe we could place it under somescripts/ lib file, I'll check
thanks,
jirka
Re: [PATCH 01/27] perf tools: Add automated make test suite
In reply to Sam RavnborgOn Mon, Apr 01, 2013 at 09:53:18PM +0200, Sam Ravnborg wrote:
SNIP
Quoted 11 lines
tools/perf/tests/make line 10
Quoted 3 lines
tools/perf/tests/make new file +3
-0+ +MAKE_DEBUG := DEBUG=1 +MAKE_NO_LIBPERL := NO_LIBPERL=1Why all these ugly UPPERCASE names?
In kbuild files the unwritten rule is that variables with global scope are upper-case.
And variables with local scope are lower case.You can find many examples where this is not followed - but this is the general approach.
ok, for some reason I'm used to use capitals for makefile variables ;)
Quoted 5 lines
Quoted 2 lines
+MAKE_MINIMAL := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
Keeping lines less than 120 chars long is good.
Some people swer to 80 chars.
ok
Quoted 10 lines
tools/perf/tests/make line 35
Quoted 5 lines
tools/perf/tests/make new file +4
-0+RUN := \ + MAKE_PURE \ + MAKE_DEBUG \ + MAKE_NO_LIBPERL \RUN +=
MAKE_PURE
RUN +=MAKE_DEBUG
RUN +=MAKE_NO_LIBPERL
Quoted 3 lines
Is so much more readable.
As a general rule - use \
to continue lines only when you really have to.
ok
thanks,
jirka
Re: [PATCH 02/27] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif
In reply to Sam RavnborgQuoted 10 lines · Sam Ravnborg
Quoted 4 lines · Jiri Olsa
Unmatched spaces/tabs
Makefileindentation could make theMakefilefails. While the tabed line could be considered sometimes as follow up for rule command, the mixed space tab meses up with makefile if conditions.I have too many times been beaten that asssignments was ignored because I used tabs to indendt the assignmnet. So in all
MakefileI edit spaces are used for indent. Tabs are only used for commands.
sounds like good idea, I'll make separate patch for that
thanks,
jirka
Quoted 8 lines · David Ahern
Hi Jiri:
Quoted 2 lines · Jiri Olsa
hi,
sending RFC for build changes and kbuild support.Have you seen this patch set:
https://lkml.org/lkml/2012/8/20/59
yep, I remember checking it.. but I decided to start over because I wanted to use kbuild build support as well
Now when I'm checking that I see you made also some source changes to make the build separation possible. I haven't done much on this part and some of the libraries/features/builtins could not be disabled at the moment, because the code is not properly separated.
Quoted 6 lines
It hooks into the conf commands to generate a .config file. Coincidentally I updated and expanded the patch series this morning to include dependencies and such. Latest Pconfig attached to give you an idea. I need to collapse a few patches and send them out tonight.
I'll check your repost
thanks,
jirka
Namhyung Kim
maintainerRe: [PATCH 03/27] perf tools: Move arch check into config/Makefile
In reply to Jiri OlsaHi, Jiri
2013-04-01 (월), 21:18 +0200, Jiri Olsa:
Quoted 1 line
Moving arch check into config/Makefile.
[SNIP]
tools/perf/Makefile include config/utilities.mak · line 63
Quoted 3 lines
tools/perf/Makefile +2
-0+ifeq ($(filter clean tags,$(MAKECMDGOALS)),) +include config/Makefile endif
Problem with this approach is that people (including me) sometimes give multiple targets in one go - like "make clean all".
Thanks,
Namhyung
Namhyung Kim
maintainerRe: [PATCH 04/27] perf tools: Move programs check into config/Makefile
In reply to Jiri Olsa2013-04-01 (월), 21:18 +0200, Jiri Olsa:
Quoted 1 line
Moving programs check into config/Makefile.
[SNIP]
tools/perf/Makefile $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE · line 67
Quoted 7 lines
tools/perf/Makefile +7
-0+RM = rm -f +MKDIR = mkdir +FIND = find +INSTALL = install +FLEX = flex +BISON = bison +STRIP ?= strip
Why does STRIP use "?=" form?
I know you just moved the line, but AFAICS it can be converted to a normal variable assignment, right?
Quoted 20 lines
tools/perf/Makefile +0
-8@@ -140,14 +140,6 @@ ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),tags) -include config/feature-tests.mak -ifeq ($(call get-executable,$(FLEX)),) - dummy := $(error Error: $(FLEX) is missing on this system, please install it) -endif - -ifeq ($(call get-executable,$(BISON)),) - dummy := $(error Error: $(BISON) is missing on this system, please install it) -endif - ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) CFLAGS := $(CFLAGS) -fstack-protector-all endiftools/perf/config/Makefile +0
-0
tools/perf/config/Makefile endif · line 36
Quoted 5 lines
tools/perf/config/Makefile +2
-0@@ -32,3 +32,13 @@ endif ifeq ($(NO_PERF_REGS),0) BASIC_CFLAGS += -DHAVE_PERF_REGS endif + +-include config/feature-tests.mak
It seems now it's redundant to include this file?
Thanks,
Namhyung
Re: [PATCH 03/27] perf tools: Move arch check into config/Makefile
In reply to Namhyung KimQuoted 5 lines · Namhyung Kim
Hi, Jiri
2013-04-01 (월), 21:18 +0200, Jiri Olsa:
Quoted 1 line
Moving arch check into config/Makefile.
Quoted 8 lines
[SNIP]
tools/perf/Makefile include config/utilities.mak · line 63
Quoted 3 lines
tools/perf/Makefile +2
-0+ifeq ($(filter clean tags,$(MAKECMDGOALS)),) +include config/Makefile endifProblem with this approach is that people (including me) sometimes give multiple targets in one go - like "make clean all".
ok, haven't thought of that ;-) I think this could be fixed
thanks,
jirka
Namhyung Kim
maintainerRe: [PATCH 05/27] perf tools: Move compiler and linker flags check into config/Makefile
In reply to Jiri Olsa2013-04-01 (월), 21:18 +0200, Jiri Olsa:
Quoted 1 line
Moving compiler and linker flags check into config/Makefile.
[SNIP]
Quoted 12 lines
tools/perf/Makefile +4
-0@@ -52,6 +52,20 @@ include config/utilities.mak # # Define NO_LIBNUMA if you do not want numa perf benchmark +ifeq ($(srctree),) +srctree := $(patsubst %/,%,$(dir $(shell pwd))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +#$(info Determined 'srctree' to be $(srctree))
tools/perf/Makefile include config/utilities.mak · line 68
Quoted 10 lines
tools/perf/Makefile +10
-0+endif + +ifneq ($(objtree),) +#$(info Determined 'objtree' to be $(objtree)) +endif + +ifneq ($(OUTPUT),) +#$(info Determined 'OUTPUT' to be $(OUTPUT)) +endif +
Question, what's the difference between objtree and OUTPUT?
tools/perf/Makefile include config/utilities.mak · line 71
Quoted 3 lines
tools/perf/Makefile +3
-0+ifndef PERF_DEBUG + CFLAGS_OPTIMIZE = -O6 +endif
Is this -O6 really supported by gcc?
tools/perf/Makefile include config/utilities.mak
Quoted 8 lines
tools/perf/Makefile +8
-0+ +ifdef PARSER_DEBUG + PARSER_DEBUG_BISON := -t + PARSER_DEBUG_FLEX := -d + PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG +endif + +CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)
Please break this line into multiple CFLAGS += ... lines as Sam said.
Quoted 27 lines
tools/perf/Makefile +27
-0+EXTLIBS = -lpthread -lrt -lelf -lmmktemp +ALL_CFLAGS = $(CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE +ALL_LDFLAGS = $(LDFLAGS) + +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) + CFLAGS := $(CFLAGS) -fstack-protector-all +endif + +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wstack-protector,-Wstack-protector),y) + CFLAGS := $(CFLAGS) -Wstack-protector +endif + +ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -Wvolatile-register-var,-Wvolatile-register-var),y) + CFLAGS := $(CFLAGS) -Wvolatile-register-var +endif + +ifndef PERF_DEBUG + ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -D_FORTIFY_SOURCE=2,-D_FORTIFY_SOURCE=2),y) + CFLAGS := $(CFLAGS) -D_FORTIFY_SOURCE=2 + endif +endif + +BASIC_CFLAGS = \ + -Iutil/include \ + -Iarch/$(ARCH)/include \ + $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \ + -I$(srctree)/arch/$(ARCH)/include/uapi \
tools/perf/Makefile
Quoted 10 lines
tools/perf/Makefile +10
-0+ -I$(srctree)/arch/$(ARCH)/include \ + $(if $(objtree),-I$(objtree)/include/generated/uapi) \ + -I$(srctree)/include/uapi \ + -I$(srctree)/include \ + -I$(OUTPUT)util \ + -Iutil \ + -I. \ + -I$(TRACE_EVENT_DIR) \ + -I../lib/ \mktemp + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
And this too. Btw do we really need this many include directories?
Thanks,
Namhyung
Quoted 9 lines
tools/perf/Makefile +9
-0+ +BASIC_LDFLAGS = + +ifeq ($(call try-cc,$(SOURCE_BIONIC),$(CFLAGS),bionic),y) + BIONIC := 1 + EXTLIBS := $(filter-out -lrt,$(EXTLIBS)) + EXTLIBS := $(filter-out -lpthread,$(EXTLIBS)) + BASIC_CFLAGS += -I. +endif
Re: [PATCH 04/27] perf tools: Move programs check into config/Makefile
In reply to Namhyung KimQuoted 15 lines · Namhyung Kim
2013-04-01 (월), 21:18 +0200, Jiri Olsa:
Quoted 1 line
Moving programs check into config/Makefile.
[SNIP]
tools/perf/Makefile $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE · line 67
Quoted 7 lines
tools/perf/Makefile +7
-0+RM = rm -f +MKDIR = mkdir +FIND = find +INSTALL = install +FLEX = flex +BISON = bison +STRIP ?= stripWhy does STRIP use "?=" form?
Quoted 2 lines
I know you just moved the line, but AFAICS it can be converted to a normal variable assignment, right?
not sure, I guess someone found usefull to use custom strip
Quoted 21 lines
Quoted 21 lines
tools/perf/Makefile +0
-8@@ -140,14 +140,6 @@ ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),tags) -include config/feature-tests.mak -ifeq ($(call get-executable,$(FLEX)),) - dummy := $(error Error: $(FLEX) is missing on this system, please install it) -endif - -ifeq ($(call get-executable,$(BISON)),) - dummy := $(error Error: $(BISON) is missing on this system, please install it) -endif - ifeq ($(call try-cc,$(SOURCE_HELLO),$(CFLAGS) -Werror -fstack-protector-all,-fstack-protector-all),y) CFLAGS := $(CFLAGS) -fstack-protector-all endiftools/perf/config/Makefile +0
-0
Quoted 8 lines
tools/perf/config/Makefile endif · line 36
Quoted 6 lines
tools/perf/config/Makefile +2
-0@@ -32,3 +32,13 @@ endif ifeq ($(NO_PERF_REGS),0) BASIC_CFLAGS += -DHAVE_PERF_REGS endif + +-include config/feature-tests.makIt seems now it's redundant to include this file?
The 'config/feature-tests.mak' stuff is still needed for the rest of the Makefile at this point. Althought all the checking stuff is moved with final patch into config/Makefile, I wanted middle commit to stay functional.
Now I wonder if I include 'config/feature-tests.mak' from 'config/Makefile' wether it afects top level Makefile environment or not (my initial thought). I'll double check that and remove if necessary.
thanks,
jirka
Re: [PATCH 05/27] perf tools: Move compiler and linker flags check into config/Makefile
In reply to Namhyung KimQuoted 13 lines · Namhyung Kim
2013-04-01 (월), 21:18 +0200, Jiri Olsa:
Quoted 1 line
Moving compiler and linker flags check into config/Makefile.
[SNIP]
Quoted 8 lines
tools/perf/Makefile +0
-0@@ -52,6 +52,20 @@ include config/utilities.mak # # Define NO_LIBNUMA if you do not want numa perf benchmark
Quoted 16 lines
Quoted 4 lines
tools/perf/Makefile +4
-0+ifeq ($(srctree),) +srctree := $(patsubst %/,%,$(dir $(shell pwd))) +srctree := $(patsubst %/,%,$(dir $(srctree))) +#$(info Determined 'srctree' to be $(srctree))tools/perf/Makefile include config/utilities.mak · line 68
Quoted 10 lines
tools/perf/Makefile +10
-0+endif + +ifneq ($(objtree),) +#$(info Determined 'objtree' to be $(objtree)) +endif + +ifneq ($(OUTPUT),) +#$(info Determined 'OUTPUT' to be $(OUTPUT)) +endif +Question, what's the difference between objtree and OUTPUT?
check top stuff at 'tools/scripts/Makefile.include'
OUTPUT ties with $(subdir), while objtree is pure $(O)
I didn't use the 'tools/scripts/Makefile.include' include the Makefile.kbuild, just defined OUTPUT variable
The Makefile.kbuild processing is allways based on git tree root, and all binaries are prefixed $(objtree) or $(obj-perf) and all source code is prefixed with $(srctree) or $(src-perf)
Quoted 7 lines
tools/perf/Makefile include config/utilities.mak · line 71
Quoted 5 lines
tools/perf/Makefile +3
-0+ifndef PERF_DEBUG + CFLAGS_OPTIMIZE = -O6 +endifIs this -O6 really supported by gcc?
hmm, no doc.. and quick google found just your question ;)
Quoted 12 lines
tools/perf/Makefile include config/utilities.mak
Quoted 9 lines
tools/perf/Makefile +8
-0+ +ifdef PARSER_DEBUG + PARSER_DEBUG_BISON := -t + PARSER_DEBUG_FLEX := -d + PARSER_DEBUG_CFLAGS := -DPARSER_DEBUG +endif + +CFLAGS = -fno-omit-frame-pointer -ggdb3 -funwind-tables -Wall -Wextra -std=gnu99 $(CFLAGS_WERROR) $(CFLAGS_OPTIMIZE) $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) $(PARSER_DEBUG_CFLAGS)Please break this line into multiple CFLAGS += ... lines as Sam said.
ok
SNIP
Quoted 10 lines
Quoted 10 lines
tools/perf/Makefile +10
-0+ +BASIC_CFLAGS = \ + -Iutil/include \ + -Iarch/$(ARCH)/include \ + $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \ + -I$(srctree)/arch/$(ARCH)/include/uapi \ + -I$(srctree)/arch/$(ARCH)/include \ + $(if $(objtree),-I$(objtree)/include/generated/uapi) \ + -I$(srctree)/include/uapi \ + -I$(srctree)/include \
Quoted 9 lines
tools/perf/Makefile
Quoted 6 lines
tools/perf/Makefile +6
-0+ -I$(OUTPUT)util \ + -Iutil \ + -I. \ + -I$(TRACE_EVENT_DIR) \ + -I../lib/ \mktemp + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCEAnd this too. Btw do we really need this many include directories?
ok, I tried to sort it out in another patch:
perf tools: Switch to full patch C include directories
thanks,
jirka
Namhyung Kim
maintainerRe: [PATCH 04/27] perf tools: Move programs check into config/Makefile
In reply to Jiri OlsaQuoted 16 lines · Jiri Olsa
Quoted 15 lines · Namhyung Kim
2013-04-01 (월), 21:18 +0200, Jiri Olsa:
Quoted 1 line
Moving programs check into config/Makefile.
[SNIP]
tools/perf/Makefile $(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE · line 67
Quoted 7 lines
tools/perf/Makefile +7
-0+RM = rm -f +MKDIR = mkdir +FIND = find +INSTALL = install +FLEX = flex +BISON = bison +STRIP ?= stripWhy does STRIP use "?=" form?
Quoted 4 lines
Quoted 2 lines
I know you just moved the line, but AFAICS it can be converted to a normal variable assignment, right?
not sure, I guess someone found usefull to use custom strip
AFAIK one can override those variables on a cmdline even if it's set via normal variable assignment.
Thanks,
Namhyung
Re: [PATCH 24/27] kbuild: Introduce KCONFIG_AUTOCONFIGDEP variable for conf tool
In reply to Jiri OlsaQuoted 2 lines · Jiri Olsa
Introducing
KCONFIG_AUTOCONFIGDEPvariable for conf tool allowing to specify custom auto.conf.cmd file.
I suggest to just append .cmd to the auto.conf name, instead of introducing a new environment variable.
(I haven't looked at the rest of the patches yet).
Michal