All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC/PATCHSET 00/30] perf tools: New build framework
@ 2015-01-02 15:35 Jiri Olsa
  2015-01-02 15:35 ` [PATCH 01/30] perf tools: Add new build framework support Jiri Olsa
                   ` (30 more replies)
  0 siblings, 31 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Adrian Hunter, Alexis Berlemont, Andi Kleen,
	Anton Blanchard, Arnaldo Carvalho de Melo, Borislav Petkov,
	Borislav Petkov, Cody P Schafer, Corey Ashford, David Ahern,
	Florian Fainelli, Frederic Weisbecker, Ingo Molnar, Jean Pihet,
	Mark Salter, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Sam Ravnborg, Stephane Eranian, Sukadev Bhattiprolu, Will Deacon

hi,
I'm following up on latest post from Alexis:
  http://marc.info/?l=linux-kernel&m=141427580405357&w=2

Since it's actually small portion of kbuild that perf needs,
I realized it's actually better to steal it than 'reconfigure'
kbuild to be usable for perf.

Also this patchset is kind of incremental version of the latest:
  perf tools: Add kbuild support into Makefile.kbuild
so it should be easier to review.

NOTE I couldn't find any copyright/credit messages in the kbuild
system, but would be happy to include it if someone suggests one.

The stolen parts are in files:
  Makefile.kbuild
  Build.include

The idea and more details are explained in the 'Documentation/Build'
file. The basic idea is the same as in kbuild system, with some minor
changes to allow for multiple binaries build definitions.

User provides 'Build' files with objects definitions like:
  perf-y += perf.o
  perf-y += builtin-bench.o
  ...

  libperf-y += util/
  ...

and the build framework outputs files:
  perf-in.o
  libperf-in.o

which are then linked into appropriate binaries/libraries.
(perf libperf.a libperf-gtk.so)


This patchset does not include the user configuration changes
support (which is the ultimate goal), but last 2 patches shows
how easy it's now to disable some parts of the perf code:
      perf tools: Add support to configure builtin commands inclusion
      perf tools: Disable test code

Also now we have the full dependency check ((gcc -Wp,-MD,... stuff) and
build command line is stored/checked automatically by the build system.

The patchset is also available in:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  perf/build

All tests/make tests pass. I tested only x86_64 arch.. any
feedback from other archs would be great ;-)

thanks for comments,
jirka


Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Cody P Schafer <cody@linux.vnet.ibm.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Mark Salter <msalter@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
Jiri Olsa (30):
      perf tools: Add new build framework support
      perf build: Add detected config framework support
      perf build: Add subdir framework support
      perf build: Add bench objects building
      perf build: Add tests objects building
      perf build: Add builtin objects building
      perf build: Add libperf objects building
      perf build: Add probe objects building
      perf build: Add dwarf objects building
      perf build: Add dwarf unwind objects building
      perf build: Add ui objects building
      perf build: Add slang objects building
      perf build: Add gtk objects building
      perf build: Add scripts objects building
      perf build: Add perf regs objects building
      perf build: Add zlib objects building
      perf build: Add perf.o object building
      perf build: Add arch x86 objects building
      perf build: Add arch arm objects building
      perf build: Add arch arm64 objects building
      perf build: Add arch powerpc objects building
      perf build: Add arch s390 objects building
      perf build: Add arch sh objects building
      perf build: Add arch sparc objects building
      perf build: Add single target build framework support
      perf make: Remove directory dependency rules
      perf make: Remove uneeded variables
      perf make: Remove PERF-CFLAGS file
      perf tools: Add support to configure builtin commands inclusion
      perf tools: Disable test code

 tools/perf/Build                                |  48 ++
 tools/perf/Build.include                        |  75 ++++
 tools/perf/Documentation/Build                  | 123 +++++
 tools/perf/Makefile.build                       | 122 +++++
 tools/perf/Makefile.perf                        | 566 +++---------------------
 tools/perf/arch/Build                           |   2 +
 tools/perf/arch/arm/Build                       |   2 +
 tools/perf/arch/arm/Makefile                    |  11 -
 tools/perf/arch/arm/tests/Build                 |   2 +
 tools/perf/arch/arm/util/Build                  |   4 +
 tools/perf/arch/arm64/Build                     |   3 +
 tools/perf/arch/arm64/Makefile                  |   4 -
 tools/perf/arch/arm64/util/Build                |   2 +
 tools/perf/arch/powerpc/Build                   |   1 +
 tools/perf/arch/powerpc/Makefile                |   3 -
 tools/perf/arch/powerpc/util/Build              |   4 +
 tools/perf/arch/s390/Build                      |   1 +
 tools/perf/arch/s390/Makefile                   |   3 -
 tools/perf/arch/s390/util/Build                 |   4 +
 tools/perf/arch/sh/Build                        |   1 +
 tools/perf/arch/sh/Makefile                     |   1 -
 tools/perf/arch/sh/util/Build                   |   1 +
 tools/perf/arch/sparc/Build                     |   1 +
 tools/perf/arch/sparc/Makefile                  |   1 -
 tools/perf/arch/sparc/util/Build                |   1 +
 tools/perf/arch/x86/Build                       |   2 +
 tools/perf/arch/x86/Makefile                    |  15 -
 tools/perf/arch/x86/tests/Build                 |   2 +
 tools/perf/arch/x86/util/Build                  |   8 +
 tools/perf/bench/Build                          |  11 +
 tools/perf/builtin-cmds.h                       |  29 ++
 tools/perf/builtin-help.c                       |   1 +
 tools/perf/config.default                       |  23 +
 tools/perf/config/Makefile                      |  43 ++
 tools/perf/perf-sys.h                           |   2 +-
 tools/perf/perf.c                               |   5 +
 tools/perf/scripts/Build                        |   2 +
 tools/perf/scripts/perl/Perf-Trace-Util/Build   |   3 +
 tools/perf/scripts/python/Perf-Trace-Util/Build |   3 +
 tools/perf/tests/Build                          |  43 ++
 tools/perf/ui/Build                             |  14 +
 tools/perf/ui/browsers/Build                    |  10 +
 tools/perf/ui/gtk/Build                         |   9 +
 tools/perf/ui/tui/Build                         |   4 +
 tools/perf/util/Build                           | 137 ++++++
 tools/perf/util/generate-cmdlist.sh             |  10 +
 tools/perf/util/scripting-engines/Build         |   6 +
 47 files changed, 827 insertions(+), 541 deletions(-)
 create mode 100644 tools/perf/Build
 create mode 100644 tools/perf/Build.include
 create mode 100644 tools/perf/Documentation/Build
 create mode 100644 tools/perf/Makefile.build
 create mode 100644 tools/perf/arch/Build
 create mode 100644 tools/perf/arch/arm/Build
 create mode 100644 tools/perf/arch/arm/tests/Build
 create mode 100644 tools/perf/arch/arm/util/Build
 create mode 100644 tools/perf/arch/arm64/Build
 create mode 100644 tools/perf/arch/arm64/util/Build
 create mode 100644 tools/perf/arch/powerpc/Build
 create mode 100644 tools/perf/arch/powerpc/util/Build
 create mode 100644 tools/perf/arch/s390/Build
 create mode 100644 tools/perf/arch/s390/util/Build
 create mode 100644 tools/perf/arch/sh/Build
 create mode 100644 tools/perf/arch/sh/util/Build
 create mode 100644 tools/perf/arch/sparc/Build
 create mode 100644 tools/perf/arch/sparc/util/Build
 create mode 100644 tools/perf/arch/x86/Build
 create mode 100644 tools/perf/arch/x86/tests/Build
 create mode 100644 tools/perf/arch/x86/util/Build
 create mode 100644 tools/perf/bench/Build
 create mode 100644 tools/perf/builtin-cmds.h
 create mode 100644 tools/perf/config.default
 create mode 100644 tools/perf/scripts/Build
 create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Build
 create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Build
 create mode 100644 tools/perf/tests/Build
 create mode 100644 tools/perf/ui/Build
 create mode 100644 tools/perf/ui/browsers/Build
 create mode 100644 tools/perf/ui/gtk/Build
 create mode 100644 tools/perf/ui/tui/Build
 create mode 100644 tools/perf/util/Build
 create mode 100644 tools/perf/util/scripting-engines/Build

^ permalink raw reply	[flat|nested] 44+ messages in thread

* [PATCH 01/30] perf tools: Add new build framework support
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-05 10:57   ` Borislav Petkov
  2015-01-08  6:18   ` Namhyung Kim
  2015-01-02 15:35 ` [PATCH 02/30] perf build: Add detected config " Jiri Olsa
                   ` (29 subsequent siblings)
  30 siblings, 2 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Adding new build framework. There's no change for actual
building at this point, it comes in the next patches.

The idea and more details are explained in the
'Documentation/Build' file.

I stole everything from the kernel build system, with some
changes to allow for multiple binaries build definitions.

While the kernel's build output is single image (forget modules)
we need to be able to build several binaries/libraries.

The basic idea is that sser provides 'Build' files with objects
definitions like:
  perf-y += a.o
  perf-y += b.o
  libperf-y += c.o
  libperf-y += d.o

and the build framework outputs files:
  perf-in.o    # a.o, b.o compiled in
  libperf-in.o # c.o, d.o compiled in

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build               |   0
 tools/perf/Build.include       |  73 ++++++++++++++++++++++++
 tools/perf/Documentation/Build | 123 +++++++++++++++++++++++++++++++++++++++++
 tools/perf/Makefile.build      |  89 +++++++++++++++++++++++++++++
 tools/perf/Makefile.perf       |  14 ++++-
 5 files changed, 298 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/Build
 create mode 100644 tools/perf/Build.include
 create mode 100644 tools/perf/Documentation/Build
 create mode 100644 tools/perf/Makefile.build

diff --git a/tools/perf/Build b/tools/perf/Build
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/perf/Build.include b/tools/perf/Build.include
new file mode 100644
index 000000000000..5947f8a5a6b1
--- /dev/null
+++ b/tools/perf/Build.include
@@ -0,0 +1,73 @@
+###
+# build: Generic definitions
+
+###
+# Convenient variables
+comma   := ,
+squote  := '
+
+###
+# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
+dot-target = $(dir $@).$(notdir $@)
+
+###
+# filename of target with directory and extension stripped
+basetarget = $(basename $(notdir $@))
+
+###
+# The temporary file to save gcc -MD generated dependencies must not
+# contain a comma
+depfile = $(subst $(comma),_,$(dot-target).d)
+
+###
+# Check if both arguments has same arguments. Result is empty string if equal.
+arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
+                    $(filter-out $(cmd_$@),   $(cmd_$(1))) )
+
+###
+# Escape single quote for use in echo statements
+escsq = $(subst $(squote),'\$(squote)',$1)
+
+# Echo command
+# Short version is used, if $(quiet) equals `quiet_', otherwise full one.
+echo-cmd = $(if $($(quiet)cmd_$(1)),\
+           echo '  $(call escsq,$($(quiet)cmd_$(1)))';)
+
+###
+# Replace >$< with >$$< to preserve $ when reloading the .cmd file
+# (needed for make)
+# Replace >#< with >\#< to avoid starting a comment in the .cmd file
+# (needed for make)
+# Replace >'< with >'\''< to be able to enclose the whole string in '...'
+# (needed for the shell)
+make-cmd = $(call escsq,$(subst \#,\\\#,$(subst $$,$$$$,$(cmd_$(1)))))
+
+###
+# Find any prerequisites that is newer than target or that does not exist.
+# PHONY targets skipped in both cases.
+any-prereq = $(filter-out $(PHONY),$?) $(filter-out $(PHONY) $(wildcard $^),$^)
+
+###
+# if_changed_dep  - execute command if any prerequisite is newer than
+#                   target, or command line has changed and update
+#                   dependencies in the cmd file
+if_changed_dep = $(if $(strip $(any-prereq) $(arg-check)),         \
+	@set -e;                                                   \
+	$(echo-cmd) $(cmd_$(1));                                   \
+	cat $(depfile) > $(dot-target).cmd;                        \
+	printf '%s\n' 'cmd_$@ := $(make-cmd)' >> $(dot-target).cmd)
+
+###
+# if_changed      - execute command if any prerequisite is newer than
+#                   target, or command line has changed
+if_changed = $(if $(strip $(any-prereq) $(arg-check)),             \
+	@set -e;                                                   \
+	$(echo-cmd) $(cmd_$(1));                                   \
+	printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd)
+
+###
+# C flags to be used in rule definitions, includes:
+# - depfile generation
+# - global $(CFLAGS)
+# - per target C flags
+c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) $(CFLAGS_$(basetarget).o)
diff --git a/tools/perf/Documentation/Build b/tools/perf/Documentation/Build
new file mode 100644
index 000000000000..7008520600eb
--- /dev/null
+++ b/tools/perf/Documentation/Build
@@ -0,0 +1,123 @@
+
+1) perf build
+=============
+The perf build process consists of several separated building blocks,
+which are linked together to form the perf binary:
+  - libperf library (static)
+  - perf builtin commands
+  - traceevent library (static)
+  - GTK ui library
+
+Several makefiles govern the perf build:
+
+  - Makefile
+    top level Makefile working as a wrapper that calls the main
+    Makefile.perf with a -j option to do parallel builds.
+
+  - Makefile.perf
+    main makefile that triggers build of all perf objects including
+    installation and documentation processing.
+
+  - Makefile.build
+    main makefile of the build framework
+
+  - Build.include
+    build framework generic definitions
+
+  - Build makefiles
+    makefiles that defines build objects
+
+
+2) build framework
+==================
+The perf build framework is stolen from kernel build system,
+so the idea and the way how objects are built is the same.
+
+
+a) Build makefiles
+------------------
+User supplies 'Build' makefiles that contains objects summary,
+like for example following 'krava/Build' file:
+
+  perf-y += a.o
+  perf-y += b.o
+
+The build framework is triggered by:
+  $ make -f Makefile.build dir=krava obj=perf
+
+which produces 'krava/perf-in.o' object file that has both
+a.o and b.o objects compiled in linked together.
+
+The 'Build' makefile can contains multiple objects definitions
+to allow building separated binaries, like:
+
+  perf-y += a.o
+  perf-y += b.o
+
+  libperf-y += c.o
+  libperf-y += d.o
+
+If the build framework is triggered by:
+  $ make -f Makefile.build dir=krava obj=libperf
+
+it produces 'krava/libperf-in.o' object file that has both
+a.o and b.o objects compiled in linked together.
+
+
+b) rules
+--------
+The build framework provides standard compilation rules
+to handle .S and .c compilation.
+
+It's possible to include special rule if needed (like we
+do for flex or bison code generation).
+
+
+c) cflags
+---------
+It's possible to alter standard object C flags in following way:
+  CFLAGS_perf.o += '...' - alters CFLAGS for perf.o object
+  CFLAGS_gtk += '...'    - alters CFLAGS for gtk build object
+
+This C flags changes has the scope of the Build makefile they
+are defined in.
+
+
+d) dependencies
+---------------
+For each built object file 'a.o' the '.a.cmd' is created and
+holds:
+  - command line used to built that object
+    (for each object)
+  - dependency rules generated by 'gcc -Wp,-MD,...'
+    (for compiled object)
+
+All existing '.cmd' files are included in the Build process
+to follow properly the dependencies and trigger rebuild when
+necessary.
+
+e) single rules
+---------------
+It's possible to build single object file by choice, like:
+
+  $ make util/map.o    # objects
+  $ make util/map.i    # preprocessor
+  $ make util/map.s    # assembly
+
+
+3) perf build
+=============
+The Makefile.perf triggers the build framework for build objects:
+   perf, libperf, gtk
+
+resulting in following objects:
+  $ ls  *-in.o
+  gtk-in.o  libperf-in.o  perf-in.o
+
+Those objects are then used in final linking:
+  libperf-gtk.so <- gtk-in.o  libperf-in.o
+  perf           <- perf-in.o libperf-in.o
+
+
+NOTE omitting other libraries involved, only focusing on build
+     framework outcomes
diff --git a/tools/perf/Makefile.build b/tools/perf/Makefile.build
new file mode 100644
index 000000000000..123de33e163d
--- /dev/null
+++ b/tools/perf/Makefile.build
@@ -0,0 +1,89 @@
+###
+# This code is stolen from kernel kbuild system. I haven't
+# found any copyright message in kbuild code to give credits
+# to in here so.. just wanted to say thanks ;-)
+
+PHONY := __build
+__build:
+
+ifeq ($(V),1)
+  quiet =
+else
+  quiet=quiet_
+endif
+
+# Generic definitions
+include Build.include
+
+# Init all relevant variables used in build files so
+# 1) they have correct type
+# 2) they do not inherit any value from the environment
+subdir-y     :=
+obj-y        :=
+subdir-y     :=
+subdir-obj-y :=
+
+# Build definitions
+build-file := $(dir)/Build
+include $(build-file)
+
+# Compile command
+quiet_cmd_cc_o_c = CC       $@
+      cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
+
+# Link agregate command
+quiet_cmd_ld_multi = LD       $@
+      cmd_ld_multi = $(LD) -r -o $@ $^
+
+# Build rules
+$(OUTPUT)%.o: %.c FORCE
+	$(call if_changed_dep,cc_o_c)
+
+$(OUTPUT)%.o: %.S FORCE
+	$(call if_changed_dep,cc_o_c)
+
+# Gather build data:
+#   obj-y        - list of build objects
+#   subdir-y     - list of directories to nest
+#   subdir-obj-y - list of directories objects 'dir/$(obj)-in.o'
+obj-y        := $($(obj)-y)
+subdir-y     := $(patsubst %/,%,$(filter %/, $(obj-y)))
+obj-y        := $(patsubst %/, %/$(obj)-in.o, $(obj-y))
+subdir-obj-y := $(filter %/$(obj)-in.o, $(obj-y))
+
+# '$(OUTPUT)/dir' prefix to all objects
+prefix       := $(subst ./,,$(OUTPUT)$(dir)/)
+obj-y        := $(addprefix $(prefix),$(obj-y))
+subdir-obj-y := $(addprefix $(prefix),$(subdir-obj-y))
+
+# Final '$(obj)-in.o' object
+ifneq ($(strip $(obj-y)),)
+  in-target := $(prefix)$(obj)-in.o
+endif
+
+PHONY += $(subdir-y)
+
+$(subdir-y):
+	@$(MAKE) -f Makefile.build dir=$(dir)/$@ obj=$(obj)
+
+$(sort $(subdir-obj-y)): $(subdir-y) ;
+
+$(in-target): $(obj-y)
+	$(call if_changed,ld_multi)
+
+__build: $(in-target)
+	@:
+
+PHONY += FORCE
+FORCE:
+
+# Include all cmd files to get all the dependency rules
+# for all objects included
+targets   := $(wildcard $(sort $(obj-y)))
+cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
+
+ifneq ($(cmd_files),)
+  include $(cmd_files)
+endif
+
+.PHONY: $(PHONY)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 67a03a825b3c..54edd4ac9409 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -89,6 +89,7 @@ $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
 	@touch $(OUTPUT)PERF-VERSION-FILE
 
 CC = $(CROSS_COMPILE)gcc
+LD = $(CROSS_COMPILE)ld
 AR = $(CROSS_COMPILE)ar
 PKG_CONFIG = $(CROSS_COMPILE)pkg-config
 
@@ -619,6 +620,14 @@ shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
 strip: $(PROGRAMS) $(OUTPUT)perf
 	$(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
 
+PERF_IN := $(OUTPUT)perf-in.o
+
+export OUTPUT RM CC LD CFLAGS V
+build := -f Makefile.build dir=. obj
+
+$(PERF_IN): FORCE
+	@$(MAKE) $(build)=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)"' \
@@ -978,6 +987,7 @@ config-clean:
 
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
+	@find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
@@ -993,7 +1003,9 @@ else
     GIT-HEAD-PHONY =
 endif
 
+FORCE:
+
 .PHONY: all install clean config-clean strip install-gtk
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
-.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS
+.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS FORCE
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 02/30] perf build: Add detected config framework support
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
  2015-01-02 15:35 ` [PATCH 01/30] perf tools: Add new build framework support Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 03/30] perf build: Add subdir " Jiri Olsa
                   ` (28 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Adding support to include detected configuration makefile
into the build process. This will allow the Build objects
to be configurable based on the config data, like:

  perf-$(CONFIG_KRAVA) += krava.o

The configuration is stored in '.config-detected' file,
which is generated for each compilation.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.build  | 3 +++
 tools/perf/Makefile.perf   | 1 +
 tools/perf/config/Makefile | 4 ++++
 3 files changed, 8 insertions(+)

diff --git a/tools/perf/Makefile.build b/tools/perf/Makefile.build
index 123de33e163d..68556874ea86 100644
--- a/tools/perf/Makefile.build
+++ b/tools/perf/Makefile.build
@@ -15,6 +15,9 @@ endif
 # Generic definitions
 include Build.include
 
+# do not force detected configuration
+-include .config-detected
+
 # Init all relevant variables used in build files so
 # 1) they have correct type
 # 2) they do not inherit any value from the environment
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 54edd4ac9409..f578e1a91250 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -988,6 +988,7 @@ config-clean:
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
 	@find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
+	@$(RM) .config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5d4b039fe1ed..f6538544c740 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -11,6 +11,10 @@ ifneq ($(obj-perf),)
 obj-perf := $(abspath $(obj-perf))/
 endif
 
+$(shell echo -n > .config-detected)
+detected     = $(shell echo "$(1)=y"       >> .config-detected)
+detected_var = $(shell echo "$(1)=$($(1))" >> .config-detected)
+
 LIB_INCLUDE := $(srctree)/tools/lib/
 CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 03/30] perf build: Add subdir framework support
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
  2015-01-02 15:35 ` [PATCH 01/30] perf tools: Add new build framework support Jiri Olsa
  2015-01-02 15:35 ` [PATCH 02/30] perf build: Add detected config " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 04/30] perf build: Add bench objects building Jiri Olsa
                   ` (27 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Add support to make directory any time we build objects
out of the tree (O=/tmp/krava) and the output directory
does not exist.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/perf/Makefile.build b/tools/perf/Makefile.build
index 68556874ea86..cbd4d416a237 100644
--- a/tools/perf/Makefile.build
+++ b/tools/perf/Makefile.build
@@ -30,6 +30,10 @@ subdir-obj-y :=
 build-file := $(dir)/Build
 include $(build-file)
 
+# Create directory unless it exists
+quiet_cmd_mkdir = MKDIR    $(dir $@)
+      cmd_mkdir = $(if $(wildcard $(dir $@)),,@$(call echo-cmd,mkdir) mkdir -p $(dir $@))
+
 # Compile command
 quiet_cmd_cc_o_c = CC       $@
       cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
@@ -40,9 +44,11 @@ quiet_cmd_ld_multi = LD       $@
 
 # Build rules
 $(OUTPUT)%.o: %.c FORCE
+	$(call cmd_mkdir)
 	$(call if_changed_dep,cc_o_c)
 
 $(OUTPUT)%.o: %.S FORCE
+	$(call cmd_mkdir)
 	$(call if_changed_dep,cc_o_c)
 
 # Gather build data:
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 04/30] perf build: Add bench objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (2 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 03/30] perf build: Add subdir " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 05/30] perf build: Add tests " Jiri Olsa
                   ` (26 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move bench objects building under build framework
and enable perf-in.o rule.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build           |  2 ++
 tools/perf/Makefile.perf   | 21 ++-------------------
 tools/perf/bench/Build     | 11 +++++++++++
 tools/perf/config/Makefile |  2 ++
 4 files changed, 17 insertions(+), 19 deletions(-)
 create mode 100644 tools/perf/bench/Build

diff --git a/tools/perf/Build b/tools/perf/Build
index e69de29bb2d1..9ea828de3fde 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -0,0 +1,2 @@
+perf-y += builtin-bench.o
+perf-y += bench/
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index f578e1a91250..6d0be78763ec 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -459,19 +459,6 @@ LIB_OBJS += $(OUTPUT)tests/thread-mg-share.o
 LIB_OBJS += $(OUTPUT)tests/switch-tracking.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
-BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
-# Benchmark modules
-BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
-BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
-ifeq ($(RAW_ARCH),x86_64)
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
-endif
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-requeue.o
-
 BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
 BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o
 BUILTIN_OBJS += $(OUTPUT)builtin-help.o
@@ -590,10 +577,6 @@ ifeq ($(NO_PERF_REGS),0)
   LIB_OBJS += $(OUTPUT)util/perf_regs.o
 endif
 
-ifndef NO_LIBNUMA
-  BUILTIN_OBJS += $(OUTPUT)bench/numa.o
-endif
-
 ifndef NO_ZLIB
   LIB_OBJS += $(OUTPUT)util/zlib.o
 endif
@@ -633,9 +616,9 @@ $(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
 		'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
 		$(CFLAGS) -c $(filter %.c,$^) -o $@
 
-$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
+$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) $(PERF_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
-               $(BUILTIN_OBJS) $(LIBS) -o $@
+               $(BUILTIN_OBJS) $(PERF_IN) $(LIBS) -o $@
 
 $(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H)
 	$(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $<
diff --git a/tools/perf/bench/Build b/tools/perf/bench/Build
new file mode 100644
index 000000000000..5ce98023d518
--- /dev/null
+++ b/tools/perf/bench/Build
@@ -0,0 +1,11 @@
+perf-y += sched-messaging.o
+perf-y += sched-pipe.o
+perf-y += mem-memcpy.o
+perf-y += futex-hash.o
+perf-y += futex-wake.o
+perf-y += futex-requeue.o
+
+perf-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
+perf-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
+
+perf-$(CONFIG_NUMA) += numa.o
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f6538544c740..3c73e11954ea 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -28,6 +28,7 @@ ifeq ($(ARCH),x86)
     CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
     ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
     LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
+    $(call detected,CONFIG_X86_64)
   else
     LIBUNWIND_LIBS = -lunwind -lunwind-x86
   endif
@@ -633,6 +634,7 @@ ifndef NO_LIBNUMA
   else
     CFLAGS += -DHAVE_LIBNUMA_SUPPORT
     EXTLIBS += -lnuma
+    $(call detected,CONFIG_NUMA)
   endif
 endif
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 05/30] perf build: Add tests objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (3 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 04/30] perf build: Add bench objects building Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 06/30] perf build: Add builtin " Jiri Olsa
                   ` (25 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move test objects building under build framework.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build           |  1 +
 tools/perf/Build.include   |  3 ++-
 tools/perf/Makefile.perf   | 55 ----------------------------------------------
 tools/perf/config/Makefile | 10 +++++++++
 tools/perf/tests/Build     | 43 ++++++++++++++++++++++++++++++++++++
 5 files changed, 56 insertions(+), 56 deletions(-)
 create mode 100644 tools/perf/tests/Build

diff --git a/tools/perf/Build b/tools/perf/Build
index 9ea828de3fde..b4b6a7ca760b 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -1,2 +1,3 @@
 perf-y += builtin-bench.o
 perf-y += bench/
+perf-y += tests/
diff --git a/tools/perf/Build.include b/tools/perf/Build.include
index 5947f8a5a6b1..a3f325397fc7 100644
--- a/tools/perf/Build.include
+++ b/tools/perf/Build.include
@@ -70,4 +70,5 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)),             \
 # - depfile generation
 # - global $(CFLAGS)
 # - per target C flags
-c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) $(CFLAGS_$(basetarget).o)
+# - BUILD_STR macro to allow '-D"$(variable)"' constructs
+c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 6d0be78763ec..48f614c57246 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -419,45 +419,6 @@ LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
 
 LIB_OBJS += $(OUTPUT)arch/common.o
 
-LIB_OBJS += $(OUTPUT)tests/parse-events.o
-LIB_OBJS += $(OUTPUT)tests/dso-data.o
-LIB_OBJS += $(OUTPUT)tests/attr.o
-LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
-LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
-LIB_OBJS += $(OUTPUT)tests/perf-record.o
-LIB_OBJS += $(OUTPUT)tests/rdpmc.o
-LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
-LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
-LIB_OBJS += $(OUTPUT)tests/fdarray.o
-LIB_OBJS += $(OUTPUT)tests/pmu.o
-LIB_OBJS += $(OUTPUT)tests/hists_common.o
-LIB_OBJS += $(OUTPUT)tests/hists_link.o
-LIB_OBJS += $(OUTPUT)tests/hists_filter.o
-LIB_OBJS += $(OUTPUT)tests/hists_output.o
-LIB_OBJS += $(OUTPUT)tests/hists_cumulate.o
-LIB_OBJS += $(OUTPUT)tests/python-use.o
-LIB_OBJS += $(OUTPUT)tests/bp_signal.o
-LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
-LIB_OBJS += $(OUTPUT)tests/task-exit.o
-LIB_OBJS += $(OUTPUT)tests/sw-clock.o
-ifeq ($(ARCH),x86)
-LIB_OBJS += $(OUTPUT)tests/perf-time-to-tsc.o
-endif
-LIB_OBJS += $(OUTPUT)tests/code-reading.o
-LIB_OBJS += $(OUTPUT)tests/sample-parsing.o
-LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o
-ifndef NO_DWARF_UNWIND
-ifeq ($(ARCH),$(filter $(ARCH),x86 arm))
-LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o
-endif
-endif
-LIB_OBJS += $(OUTPUT)tests/mmap-thread-lookup.o
-LIB_OBJS += $(OUTPUT)tests/thread-mg-share.o
-LIB_OBJS += $(OUTPUT)tests/switch-tracking.o
-
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
 BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o
@@ -477,7 +438,6 @@ BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
 BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
 BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
 BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
-BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
 BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
 
 PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
@@ -519,7 +479,6 @@ endif
 ifndef NO_LIBUNWIND
   LIB_OBJS += $(OUTPUT)util/unwind-libunwind.o
 endif
-LIB_OBJS += $(OUTPUT)tests/keep-tracking.o
 
 ifndef NO_LIBAUDIT
   BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
@@ -694,20 +653,6 @@ $(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
 		'-DPREFIX="$(prefix_SQ)"' \
 		$<
 
-$(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-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 $(CFLAGS) \
-		-DPYTHONPATH='"$(OUTPUT)python"' \
-		-DPYTHON='"$(PYTHON_WORD)"' \
-		$<
-
-$(OUTPUT)tests/dwarf-unwind.o: tests/dwarf-unwind.c
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -fno-optimize-sibling-calls $<
-
 $(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 3c73e11954ea..af41fcf91edf 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -20,10 +20,13 @@ CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)
 
 include $(src-perf)/config/Makefile.arch
 
+$(call detected_var,ARCH)
+
 NO_PERF_REGS := 1
 
 # Additional ARCH settings for x86
 ifeq ($(ARCH),x86)
+  $(call detected,CONFIG_X86)
   ifeq (${IS_X86_64}, 1)
     CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
     ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
@@ -418,6 +421,7 @@ endif
 
 ifeq ($(dwarf-post-unwind),1)
   CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
+  $(call detected,CONFIG_DWARF_UNWIND)
 else
   NO_DWARF_UNWIND := 1
 endif
@@ -815,3 +819,9 @@ endif
 ifeq ($(display_lib),1)
   $(info )
 endif
+
+$(call detected_var,bindir_SQ)
+$(call detected_var,PYTHON_WORD)
+ifneq ($(OUTPUT),)
+$(call detected_var,OUTPUT)
+endif
diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
new file mode 100644
index 000000000000..06d82b0311de
--- /dev/null
+++ b/tools/perf/tests/Build
@@ -0,0 +1,43 @@
+perf-y += builtin-test.o
+
+perf-y += parse-events.o
+perf-y += dso-data.o
+perf-y += attr.o
+perf-y += vmlinux-kallsyms.o
+perf-y += open-syscall.o
+perf-y += open-syscall-all-cpus.o
+perf-y += open-syscall-tp-fields.o
+perf-y += mmap-basic.o
+perf-y += perf-record.o
+perf-y += rdpmc.o
+perf-y += evsel-roundtrip-name.o
+perf-y += evsel-tp-sched.o
+perf-y += fdarray.o
+perf-y += pmu.o
+perf-y += hists_common.o
+perf-y += hists_link.o
+perf-y += hists_filter.o
+perf-y += hists_output.o
+perf-y += hists_cumulate.o
+perf-y += python-use.o
+perf-y += bp_signal.o
+perf-y += bp_signal_overflow.o
+perf-y += task-exit.o
+perf-y += sw-clock.o
+perf-y += mmap-thread-lookup.o
+perf-y += thread-mg-share.o
+perf-y += switch-tracking.o
+perf-y += keep-tracking.o
+perf-y += code-reading.o
+perf-y += sample-parsing.o
+perf-y += parse-no-sample-id-all.o
+
+perf-$(CONFIG_X86) += perf-time-to-tsc.o
+
+ifeq ($(ARCH),$(filter $(ARCH),x86 arm))
+perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
+endif
+
+CFLAGS_attr.o         += -DBINDIR="BUILD_STR($(bindir_SQ))" -DPYTHON="BUILD_STR($(PYTHON_WORD))"
+CFLAGS_python-use.o   += -DPYTHONPATH="BUILD_STR($(OUTPUT)python)" -DPYTHON="BUILD_STR($(PYTHON_WORD))"
+CFLAGS_dwarf-unwind.o += -fno-optimize-sibling-calls
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 06/30] perf build: Add builtin objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (4 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 05/30] perf build: Add tests " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 07/30] perf build: Add libperf " Jiri Olsa
                   ` (24 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the rest of builtin objects (bench and test are
already in) building under build framework.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build           | 29 +++++++++++++++++++++++++++++
 tools/perf/Makefile.perf   | 35 -----------------------------------
 tools/perf/config/Makefile |  4 ++++
 3 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/tools/perf/Build b/tools/perf/Build
index b4b6a7ca760b..80a944b929da 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -1,3 +1,32 @@
 perf-y += builtin-bench.o
+perf-y += builtin-annotate.o
+perf-y += builtin-diff.o
+perf-y += builtin-evlist.o
+perf-y += builtin-help.o
+perf-y += builtin-sched.o
+perf-y += builtin-buildid-list.o
+perf-y += builtin-buildid-cache.o
+perf-y += builtin-list.o
+perf-y += builtin-record.o
+perf-y += builtin-report.o
+perf-y += builtin-stat.o
+perf-y += builtin-timechart.o
+perf-y += builtin-top.o
+perf-y += builtin-script.o
+perf-y += builtin-kmem.o
+perf-y += builtin-lock.o
+perf-y += builtin-kvm.o
+perf-y += builtin-inject.o
+perf-y += builtin-mem.o
+
+perf-$(CONFIG_AUDIT) += builtin-trace.o
+
 perf-y += bench/
 perf-y += tests/
+
+paths += -DPERF_HTML_PATH="BUILD_STR($(htmldir_SQ))"
+paths += -DPERF_INFO_PATH="BUILD_STR($(infodir_SQ))"
+paths += -DPERF_MAN_PATH="BUILD_STR($(mandir_SQ))"
+
+CFLAGS_builtin-help.o      += $(paths)
+CFLAGS_builtin-timechart.o += $(paths)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 48f614c57246..5ac487c959cf 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -419,26 +419,7 @@ LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
 
 LIB_OBJS += $(OUTPUT)arch/common.o
 
-BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
-BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
-BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o
-BUILTIN_OBJS += $(OUTPUT)builtin-help.o
-BUILTIN_OBJS += $(OUTPUT)builtin-sched.o
-BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o
-BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o
-BUILTIN_OBJS += $(OUTPUT)builtin-list.o
-BUILTIN_OBJS += $(OUTPUT)builtin-record.o
-BUILTIN_OBJS += $(OUTPUT)builtin-report.o
-BUILTIN_OBJS += $(OUTPUT)builtin-stat.o
-BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o
-BUILTIN_OBJS += $(OUTPUT)builtin-top.o
-BUILTIN_OBJS += $(OUTPUT)builtin-script.o
 BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
-BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
-BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
-BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
-BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
-BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
 
 PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
 
@@ -480,10 +461,6 @@ ifndef NO_LIBUNWIND
   LIB_OBJS += $(OUTPUT)util/unwind-libunwind.o
 endif
 
-ifndef NO_LIBAUDIT
-  BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
-endif
-
 ifndef NO_SLANG
   LIB_OBJS += $(OUTPUT)ui/browser.o
   LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
@@ -585,18 +562,6 @@ $(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H)
 $(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS)
 	$(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
 
-$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-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 $(CFLAGS) \
-		'-DPERF_HTML_PATH="$(htmldir_SQ)"' \
-		'-DPERF_MAN_PATH="$(mandir_SQ)"' \
-		'-DPERF_INFO_PATH="$(infodir_SQ)"' $<
-
 $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
 
 $(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index af41fcf91edf..d2717af9ed0b 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -450,6 +450,7 @@ ifndef NO_LIBAUDIT
   else
     CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
     EXTLIBS += -laudit
+    $(call detected,CONFIG_AUDIT)
   endif
 endif
 
@@ -825,3 +826,6 @@ $(call detected_var,PYTHON_WORD)
 ifneq ($(OUTPUT),)
 $(call detected_var,OUTPUT)
 endif
+$(call detected_var,htmldir_SQ)
+$(call detected_var,infodir_SQ)
+$(call detected_var,mandir_SQ)
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 07/30] perf build: Add libperf objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (5 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 06/30] perf build: Add builtin " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-08  6:15   ` Namhyung Kim
  2015-01-02 15:35 ` [PATCH 08/30] perf build: Add probe " Jiri Olsa
                   ` (23 subsequent siblings)
  30 siblings, 1 reply; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the util objects building under build framework.

Add new libperf build object so it's separated from
the rest of the perf code and could be librarized.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build           |   3 +
 tools/perf/Makefile.build  |   3 +
 tools/perf/Makefile.perf   | 145 +++++++--------------------------------------
 tools/perf/arch/Build      |   1 +
 tools/perf/config/Makefile |   4 ++
 tools/perf/util/Build      | 112 ++++++++++++++++++++++++++++++++++
 6 files changed, 144 insertions(+), 124 deletions(-)
 create mode 100644 tools/perf/arch/Build
 create mode 100644 tools/perf/util/Build

diff --git a/tools/perf/Build b/tools/perf/Build
index 80a944b929da..31c4c555cc81 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -30,3 +30,6 @@ paths += -DPERF_MAN_PATH="BUILD_STR($(mandir_SQ))"
 
 CFLAGS_builtin-help.o      += $(paths)
 CFLAGS_builtin-timechart.o += $(paths)
+
+libperf-y += util/
+libperf-y += arch/
diff --git a/tools/perf/Makefile.build b/tools/perf/Makefile.build
index cbd4d416a237..e5d4e4fe5077 100644
--- a/tools/perf/Makefile.build
+++ b/tools/perf/Makefile.build
@@ -30,6 +30,9 @@ subdir-obj-y :=
 build-file := $(dir)/Build
 include $(build-file)
 
+quiet_cmd_flex  = FLEX     $@
+quiet_cmd_bison = BISON    $@
+
 # Create directory unless it exists
 quiet_cmd_mkdir = MKDIR    $(dir $@)
       cmd_mkdir = $(if $(wildcard $(dir $@)),,@$(call echo-cmd,mkdir) mkdir -p $(dir $@))
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5ac487c959cf..b1e0b9e9462d 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -82,7 +82,18 @@ endif
 
 ifneq ($(OUTPUT),)
 #$(info Determined 'OUTPUT' to be $(OUTPUT))
-endif
+
+# Adding $(OUTPUT) as a directory to look for source files,
+# because use generated output files as sources dependency
+# for flex/bison parsers.
+VPATH += $(OUTPUT)
+export VPATH
+
+endif # OUTPUT
+
+# Do not use make's built-in rules and variables
+# (this increases performance and avoids hard-to-debug behaviour);
+MAKEFLAGS += -rR
 
 $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
 	@$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
@@ -207,21 +218,6 @@ endif
 
 export PERL_PATH
 
-$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
-	$(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
-
-$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
-	$(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
-
-$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
-	$(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
-
-$(OUTPUT)util/pmu-bison.c: util/pmu.y
-	$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
-
-$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
-$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
-
 LIB_FILE=$(OUTPUT)libperf.a
 
 LIB_H += ../lib/symbol/kallsyms.h
@@ -331,84 +327,8 @@ LIB_H += util/data.h
 LIB_H += util/kvm-stat.h
 LIB_H += util/thread-stack.h
 
-LIB_OBJS += $(OUTPUT)util/abspath.o
-LIB_OBJS += $(OUTPUT)util/alias.o
-LIB_OBJS += $(OUTPUT)util/annotate.o
-LIB_OBJS += $(OUTPUT)util/build-id.o
-LIB_OBJS += $(OUTPUT)util/config.o
-LIB_OBJS += $(OUTPUT)util/ctype.o
-LIB_OBJS += $(OUTPUT)util/db-export.o
-LIB_OBJS += $(OUTPUT)util/pmu.o
-LIB_OBJS += $(OUTPUT)util/environment.o
-LIB_OBJS += $(OUTPUT)util/event.o
-LIB_OBJS += $(OUTPUT)util/evlist.o
-LIB_OBJS += $(OUTPUT)util/evsel.o
-LIB_OBJS += $(OUTPUT)util/exec_cmd.o
-LIB_OBJS += $(OUTPUT)util/find_next_bit.o
-LIB_OBJS += $(OUTPUT)util/help.o
-LIB_OBJS += $(OUTPUT)util/kallsyms.o
-LIB_OBJS += $(OUTPUT)util/levenshtein.o
-LIB_OBJS += $(OUTPUT)util/parse-options.o
-LIB_OBJS += $(OUTPUT)util/parse-events.o
-LIB_OBJS += $(OUTPUT)util/path.o
-LIB_OBJS += $(OUTPUT)util/rbtree.o
-LIB_OBJS += $(OUTPUT)util/bitmap.o
-LIB_OBJS += $(OUTPUT)util/hweight.o
-LIB_OBJS += $(OUTPUT)util/run-command.o
-LIB_OBJS += $(OUTPUT)util/quote.o
-LIB_OBJS += $(OUTPUT)util/strbuf.o
-LIB_OBJS += $(OUTPUT)util/string.o
-LIB_OBJS += $(OUTPUT)util/strlist.o
-LIB_OBJS += $(OUTPUT)util/strfilter.o
-LIB_OBJS += $(OUTPUT)util/top.o
-LIB_OBJS += $(OUTPUT)util/usage.o
-LIB_OBJS += $(OUTPUT)util/wrapper.o
-LIB_OBJS += $(OUTPUT)util/sigchain.o
-LIB_OBJS += $(OUTPUT)util/dso.o
-LIB_OBJS += $(OUTPUT)util/symbol.o
 LIB_OBJS += $(OUTPUT)util/symbol-elf.o
-LIB_OBJS += $(OUTPUT)util/color.o
-LIB_OBJS += $(OUTPUT)util/pager.o
-LIB_OBJS += $(OUTPUT)util/header.o
-LIB_OBJS += $(OUTPUT)util/callchain.o
-LIB_OBJS += $(OUTPUT)util/values.o
-LIB_OBJS += $(OUTPUT)util/debug.o
-LIB_OBJS += $(OUTPUT)util/machine.o
-LIB_OBJS += $(OUTPUT)util/map.o
-LIB_OBJS += $(OUTPUT)util/pstack.o
-LIB_OBJS += $(OUTPUT)util/session.o
-LIB_OBJS += $(OUTPUT)util/ordered-events.o
-LIB_OBJS += $(OUTPUT)util/comm.o
-LIB_OBJS += $(OUTPUT)util/thread.o
-LIB_OBJS += $(OUTPUT)util/thread_map.o
-LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
-LIB_OBJS += $(OUTPUT)util/parse-events-flex.o
-LIB_OBJS += $(OUTPUT)util/parse-events-bison.o
-LIB_OBJS += $(OUTPUT)util/pmu-flex.o
-LIB_OBJS += $(OUTPUT)util/pmu-bison.o
-LIB_OBJS += $(OUTPUT)util/trace-event-read.o
-LIB_OBJS += $(OUTPUT)util/trace-event-info.o
-LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
-LIB_OBJS += $(OUTPUT)util/trace-event.o
-LIB_OBJS += $(OUTPUT)util/svghelper.o
-LIB_OBJS += $(OUTPUT)util/sort.o
-LIB_OBJS += $(OUTPUT)util/hist.o
 LIB_OBJS += $(OUTPUT)util/probe-event.o
-LIB_OBJS += $(OUTPUT)util/util.o
-LIB_OBJS += $(OUTPUT)util/xyarray.o
-LIB_OBJS += $(OUTPUT)util/cpumap.o
-LIB_OBJS += $(OUTPUT)util/cgroup.o
-LIB_OBJS += $(OUTPUT)util/target.o
-LIB_OBJS += $(OUTPUT)util/rblist.o
-LIB_OBJS += $(OUTPUT)util/intlist.o
-LIB_OBJS += $(OUTPUT)util/vdso.o
-LIB_OBJS += $(OUTPUT)util/stat.o
-LIB_OBJS += $(OUTPUT)util/record.o
-LIB_OBJS += $(OUTPUT)util/srcline.o
-LIB_OBJS += $(OUTPUT)util/data.o
-LIB_OBJS += $(OUTPUT)util/tsc.o
-LIB_OBJS += $(OUTPUT)util/cloexec.o
-LIB_OBJS += $(OUTPUT)util/thread-stack.o
 
 LIB_OBJS += $(OUTPUT)ui/setup.o
 LIB_OBJS += $(OUTPUT)ui/helpline.o
@@ -417,8 +337,6 @@ LIB_OBJS += $(OUTPUT)ui/util.o
 LIB_OBJS += $(OUTPUT)ui/hist.o
 LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
 
-LIB_OBJS += $(OUTPUT)arch/common.o
-
 BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
 
 PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
@@ -541,7 +459,8 @@ strip: $(PROGRAMS) $(OUTPUT)perf
 
 PERF_IN := $(OUTPUT)perf-in.o
 
-export OUTPUT RM CC LD CFLAGS V
+export OUTPUT RM CC LD CFLAGS V BISON FLEX
+
 build := -f Makefile.build dir=. obj
 
 $(PERF_IN): FORCE
@@ -595,12 +514,6 @@ endif
 # These two need to be here so that when O= is not used they take precedence
 # over the general rule for .o
 
-$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
-	$(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/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
-
 $(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
 $(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
@@ -612,15 +525,6 @@ $(OUTPUT)%.o: %.S
 $(OUTPUT)%.s: %.S
 	$(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
 
-$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
-		'-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
-		'-DPREFIX="$(prefix_SQ)"' \
-		$<
-
-$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
-
 $(OUTPUT)ui/setup.o: ui/setup.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DLIBDIR='"$(libdir_SQ)"' $<
 
@@ -639,18 +543,6 @@ $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
 $(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
-$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-
-$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
-
-$(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c $(OUTPUT)PERF-CFLAGS
-	$(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 $(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 $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default $<
 
@@ -694,8 +586,13 @@ $(DIRECTORY_DEPS): | $(OUTPUT_DIRECTORIES)
 $(OUTPUT_DIRECTORIES):
 	$(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null
 
-$(LIB_FILE): $(LIB_OBJS)
-	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
+LIBPERF_IN := $(OUTPUT)libperf-in.o
+
+$(LIBPERF_IN): FORCE
+	@$(MAKE) $(build)=libperf
+
+$(LIB_FILE): $(LIB_OBJS) $(LIBPERF_IN)
+	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIB_OBJS)
 
 # libtraceevent.a
 TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch])
diff --git a/tools/perf/arch/Build b/tools/perf/arch/Build
new file mode 100644
index 000000000000..304f5e76c613
--- /dev/null
+++ b/tools/perf/arch/Build
@@ -0,0 +1 @@
+libperf-y += common.o
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index d2717af9ed0b..57e6f21c81f9 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -122,6 +122,8 @@ ifdef PARSER_DEBUG
   PARSER_DEBUG_BISON := -t
   PARSER_DEBUG_FLEX  := -d
   CFLAGS             += -DPARSER_DEBUG
+  $(call detected_var,PARSER_DEBUG_BISON)
+  $(call detected_var,PARSER_DEBUG_FLEX)
 endif
 
 ifndef NO_LIBPYTHON
@@ -829,3 +831,5 @@ endif
 $(call detected_var,htmldir_SQ)
 $(call detected_var,infodir_SQ)
 $(call detected_var,mandir_SQ)
+$(call detected_var,ETC_PERFCONFIG_SQ)
+$(call detected_var,prefix_SQ)
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
new file mode 100644
index 000000000000..895d250f3192
--- /dev/null
+++ b/tools/perf/util/Build
@@ -0,0 +1,112 @@
+libperf-y += abspath.o
+libperf-y += alias.o
+libperf-y += annotate.o
+libperf-y += build-id.o
+libperf-y += config.o
+libperf-y += ctype.o
+libperf-y += db-export.o
+libperf-y += environment.o
+libperf-y += event.o
+libperf-y += evlist.o
+libperf-y += evsel.o
+libperf-y += exec_cmd.o
+libperf-y += find_next_bit.o
+libperf-y += help.o
+libperf-y += kallsyms.o
+libperf-y += levenshtein.o
+libperf-y += parse-options.o
+libperf-y += parse-events.o
+libperf-y += path.o
+libperf-y += rbtree.o
+libperf-y += bitmap.o
+libperf-y += hweight.o
+libperf-y += run-command.o
+libperf-y += quote.o
+libperf-y += strbuf.o
+libperf-y += string.o
+libperf-y += strlist.o
+libperf-y += strfilter.o
+libperf-y += top.o
+libperf-y += usage.o
+libperf-y += wrapper.o
+libperf-y += sigchain.o
+libperf-y += dso.o
+libperf-y += symbol.o
+libperf-y += color.o
+libperf-y += pager.o
+libperf-y += header.o
+libperf-y += callchain.o
+libperf-y += values.o
+libperf-y += debug.o
+libperf-y += machine.o
+libperf-y += map.o
+libperf-y += pstack.o
+libperf-y += session.o
+libperf-y += ordered-events.o
+libperf-y += comm.o
+libperf-y += thread.o
+libperf-y += thread_map.o
+libperf-y += trace-event-parse.o
+libperf-y += parse-events-flex.o
+libperf-y += parse-events-bison.o
+libperf-y += pmu.o
+libperf-y += pmu-flex.o
+libperf-y += pmu-bison.o
+libperf-y += trace-event-read.o
+libperf-y += trace-event-info.o
+libperf-y += trace-event-scripting.o
+libperf-y += trace-event.o
+libperf-y += svghelper.o
+libperf-y += sort.o
+libperf-y += hist.o
+libperf-y += util.o
+libperf-y += xyarray.o
+libperf-y += cpumap.o
+libperf-y += cgroup.o
+libperf-y += target.o
+libperf-y += rblist.o
+libperf-y += intlist.o
+libperf-y += vdso.o
+libperf-y += stat.o
+libperf-y += record.o
+libperf-y += srcline.o
+libperf-y += data.o
+libperf-y += tsc.o
+libperf-y += cloexec.o
+libperf-y += thread-stack.o
+
+CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
+CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
+
+$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
+	@$(call echo-cmd,bison)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
+
+$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
+	@$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
+
+$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
+	@$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
+
+$(OUTPUT)util/pmu-bison.c: util/pmu.y
+	@$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
+
+CFLAGS_parse-events-flex.o  += -w
+CFLAGS_pmu-flex.o           += -w
+CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+CFLAGS_pmu-bison.o          += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+
+$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
+$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
+
+CFLAGS_find_next_bit.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
+CFLAGS_rbtree.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
+CFLAGS_parse-events.o  += -Wno-redundant-decls
+
+$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c FORCE
+	$(call if_changed_dep,cc_o_c)
+
+$(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c FORCE
+	$(call if_changed_dep,cc_o_c)
+
+$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c FORCE
+	$(call if_changed_dep,cc_o_c)
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 08/30] perf build: Add probe objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (6 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 07/30] perf build: Add libperf " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 09/30] perf build: Add dwarf " Jiri Olsa
                   ` (22 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the probe objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build           |  1 +
 tools/perf/Makefile.perf   | 19 +------------------
 tools/perf/config/Makefile |  1 +
 tools/perf/util/Build      |  7 +++++++
 4 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/tools/perf/Build b/tools/perf/Build
index 31c4c555cc81..170e4563bb24 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -20,6 +20,7 @@ perf-y += builtin-inject.o
 perf-y += builtin-mem.o
 
 perf-$(CONFIG_AUDIT) += builtin-trace.o
+perf-$(CONFIG_LIBELF) += builtin-probe.o
 
 perf-y += bench/
 perf-y += tests/
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index b1e0b9e9462d..d0e316beebc6 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -327,9 +327,6 @@ LIB_H += util/data.h
 LIB_H += util/kvm-stat.h
 LIB_H += util/thread-stack.h
 
-LIB_OBJS += $(OUTPUT)util/symbol-elf.o
-LIB_OBJS += $(OUTPUT)util/probe-event.o
-
 LIB_OBJS += $(OUTPUT)ui/setup.o
 LIB_OBJS += $(OUTPUT)ui/helpline.o
 LIB_OBJS += $(OUTPUT)ui/progress.o
@@ -337,8 +334,6 @@ LIB_OBJS += $(OUTPUT)ui/util.o
 LIB_OBJS += $(OUTPUT)ui/hist.o
 LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
 
-BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
-
 PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
 
 # We choose to avoid "if .. else if .. else .. endif endif"
@@ -351,19 +346,7 @@ ifneq ($(OUTPUT),)
   CFLAGS += -I$(OUTPUT)
 endif
 
-ifdef NO_LIBELF
-# Remove ELF/DWARF dependent codes
-LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
-
-BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
-
-# Use minimal symbol handling
-LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
-
-else # NO_LIBELF
+ifndef NO_LIBELF
 ifndef NO_DWARF
   LIB_OBJS += $(OUTPUT)util/probe-finder.o
   LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 57e6f21c81f9..8c64db4e2493 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -365,6 +365,7 @@ endif # NO_LIBELF
 ifndef NO_LIBELF
   CFLAGS += -DHAVE_LIBELF_SUPPORT
   EXTLIBS += -lelf
+  $(call detected,CONFIG_LIBELF)
 
   ifeq ($(feature-libelf-mmap), 1)
     CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 895d250f3192..6f2551dcc2be 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -75,6 +75,13 @@ libperf-y += tsc.o
 libperf-y += cloexec.o
 libperf-y += thread-stack.o
 
+libperf-$(CONFIG_LIBELF) += symbol-elf.o
+libperf-$(CONFIG_LIBELF) += probe-event.o
+
+ifndef CONFIG_LIBELF
+libperf-y += symbol-minimal.o
+endif
+
 CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 09/30] perf build: Add dwarf objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (7 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 08/30] perf build: Add probe " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 10/30] perf build: Add dwarf unwind " Jiri Olsa
                   ` (21 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the dwarf objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.perf   | 7 -------
 tools/perf/config/Makefile | 1 +
 tools/perf/util/Build      | 3 +++
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index d0e316beebc6..3dcba16660ca 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -346,13 +346,6 @@ ifneq ($(OUTPUT),)
   CFLAGS += -I$(OUTPUT)
 endif
 
-ifndef NO_LIBELF
-ifndef NO_DWARF
-  LIB_OBJS += $(OUTPUT)util/probe-finder.o
-  LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
-endif # NO_DWARF
-endif # NO_LIBELF
-
 ifndef NO_LIBDW_DWARF_UNWIND
   LIB_OBJS += $(OUTPUT)util/unwind-libdw.o
   LIB_H += util/unwind-libdw.h
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 8c64db4e2493..37200996cd98 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -386,6 +386,7 @@ ifndef NO_LIBELF
       CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
       LDFLAGS += $(LIBDW_LDFLAGS)
       EXTLIBS += -ldw
+      $(call detected,CONFIG_DWARF)
     endif # PERF_HAVE_DWARF_REGS
   endif # NO_DWARF
 endif # NO_LIBELF
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 6f2551dcc2be..3f8ef8b32ada 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -82,6 +82,9 @@ ifndef CONFIG_LIBELF
 libperf-y += symbol-minimal.o
 endif
 
+libperf-$(CONFIG_DWARF) += probe-finder.o
+libperf-$(CONFIG_DWARF) += dwarf-aux.o
+
 CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 10/30] perf build: Add dwarf unwind objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (8 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 09/30] perf build: Add dwarf " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 11/30] perf build: Add ui " Jiri Olsa
                   ` (20 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the dwarf unwind objects building under build
framework to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.perf   | 9 ---------
 tools/perf/config/Makefile | 2 ++
 tools/perf/util/Build      | 3 +++
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 3dcba16660ca..92a1b2538ccd 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -346,15 +346,6 @@ ifneq ($(OUTPUT),)
   CFLAGS += -I$(OUTPUT)
 endif
 
-ifndef NO_LIBDW_DWARF_UNWIND
-  LIB_OBJS += $(OUTPUT)util/unwind-libdw.o
-  LIB_H += util/unwind-libdw.h
-endif
-
-ifndef NO_LIBUNWIND
-  LIB_OBJS += $(OUTPUT)util/unwind-libunwind.o
-endif
-
 ifndef NO_SLANG
   LIB_OBJS += $(OUTPUT)ui/browser.o
   LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 37200996cd98..f71e16008ee3 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -414,9 +414,11 @@ ifdef NO_LIBUNWIND
     dwarf-post-unwind := 0
   else
     dwarf-post-unwind-text := libdw
+    $(call detected,CONFIG_LIBDW_DWARF_UNWIND)
   endif
 else
   dwarf-post-unwind-text := libunwind
+  $(call detected,CONFIG_LIBUNWIND)
   # Enable libunwind support by default.
   ifndef NO_LIBDW_DWARF_UNWIND
     NO_LIBDW_DWARF_UNWIND := 1
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 3f8ef8b32ada..0302566002f5 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -85,6 +85,9 @@ endif
 libperf-$(CONFIG_DWARF) += probe-finder.o
 libperf-$(CONFIG_DWARF) += dwarf-aux.o
 
+libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
+libperf-$(CONFIG_LIBUNWIND)          += unwind-libunwind.o
+
 CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 11/30] perf build: Add ui objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (9 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 10/30] perf build: Add dwarf unwind " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 12/30] perf build: Add slang " Jiri Olsa
                   ` (19 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the ui objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build           |  1 +
 tools/perf/Makefile.perf   | 10 ----------
 tools/perf/config/Makefile |  1 +
 tools/perf/ui/Build        |  8 ++++++++
 4 files changed, 10 insertions(+), 10 deletions(-)
 create mode 100644 tools/perf/ui/Build

diff --git a/tools/perf/Build b/tools/perf/Build
index 170e4563bb24..e84ced325147 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -34,3 +34,4 @@ CFLAGS_builtin-timechart.o += $(paths)
 
 libperf-y += util/
 libperf-y += arch/
+libperf-y += ui/
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 92a1b2538ccd..5f46fe25d725 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -327,13 +327,6 @@ LIB_H += util/data.h
 LIB_H += util/kvm-stat.h
 LIB_H += util/thread-stack.h
 
-LIB_OBJS += $(OUTPUT)ui/setup.o
-LIB_OBJS += $(OUTPUT)ui/helpline.o
-LIB_OBJS += $(OUTPUT)ui/progress.o
-LIB_OBJS += $(OUTPUT)ui/util.o
-LIB_OBJS += $(OUTPUT)ui/hist.o
-LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
-
 PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
 
 # We choose to avoid "if .. else if .. else .. endif endif"
@@ -492,9 +485,6 @@ $(OUTPUT)%.o: %.S
 $(OUTPUT)%.s: %.S
 	$(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
 
-$(OUTPUT)ui/setup.o: ui/setup.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DLIBDIR='"$(libdir_SQ)"' $<
-
 $(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f71e16008ee3..0da571594a5b 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -837,3 +837,4 @@ $(call detected_var,infodir_SQ)
 $(call detected_var,mandir_SQ)
 $(call detected_var,ETC_PERFCONFIG_SQ)
 $(call detected_var,prefix_SQ)
+$(call detected_var,LIBDIR)
diff --git a/tools/perf/ui/Build b/tools/perf/ui/Build
new file mode 100644
index 000000000000..077b6a448ddc
--- /dev/null
+++ b/tools/perf/ui/Build
@@ -0,0 +1,8 @@
+libperf-y += setup.o
+libperf-y += helpline.o
+libperf-y += progress.o
+libperf-y += util.o
+libperf-y += hist.o
+libperf-y += stdio/hist.o
+
+CFLAGS_setup.o += -DLIBDIR="BUILD_STR($(LIBDIR))"
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 12/30] perf build: Add slang objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (10 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 11/30] perf build: Add ui " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 13/30] perf build: Add gtk " Jiri Olsa
                   ` (18 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the slang objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.perf     | 33 ---------------------------------
 tools/perf/config/Makefile   |  1 +
 tools/perf/ui/Build          |  6 ++++++
 tools/perf/ui/browsers/Build | 10 ++++++++++
 tools/perf/ui/tui/Build      |  4 ++++
 5 files changed, 21 insertions(+), 33 deletions(-)
 create mode 100644 tools/perf/ui/browsers/Build
 create mode 100644 tools/perf/ui/tui/Build

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5f46fe25d725..64836605a116 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -339,24 +339,6 @@ ifneq ($(OUTPUT),)
   CFLAGS += -I$(OUTPUT)
 endif
 
-ifndef NO_SLANG
-  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/browsers/header.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/tui/tui.h
-  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
   ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
 
@@ -485,21 +467,6 @@ $(OUTPUT)%.o: %.S
 $(OUTPUT)%.s: %.S
 	$(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
 
-$(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
-	$(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 $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
-	$(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 $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
 $(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default $<
 
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 0da571594a5b..db4957af8569 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -473,6 +473,7 @@ ifndef NO_SLANG
     CFLAGS += -I/usr/include/slang
     CFLAGS += -DHAVE_SLANG_SUPPORT
     EXTLIBS += -lslang
+    $(call detected,CONFIG_SLANG)
   endif
 endif
 
diff --git a/tools/perf/ui/Build b/tools/perf/ui/Build
index 077b6a448ddc..0a73538c0441 100644
--- a/tools/perf/ui/Build
+++ b/tools/perf/ui/Build
@@ -6,3 +6,9 @@ libperf-y += hist.o
 libperf-y += stdio/hist.o
 
 CFLAGS_setup.o += -DLIBDIR="BUILD_STR($(LIBDIR))"
+
+libperf-$(CONFIG_SLANG) += browser.o
+libperf-$(CONFIG_SLANG) += browsers/
+libperf-$(CONFIG_SLANG) += tui/
+
+CFLAGS_browser.o += -DENABLE_SLFUTURE_CONST
diff --git a/tools/perf/ui/browsers/Build b/tools/perf/ui/browsers/Build
new file mode 100644
index 000000000000..de223f5bed58
--- /dev/null
+++ b/tools/perf/ui/browsers/Build
@@ -0,0 +1,10 @@
+libperf-y += annotate.o
+libperf-y += hists.o
+libperf-y += map.o
+libperf-y += scripts.o
+libperf-y += header.o
+
+CFLAGS_annotate.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_hists.o    += -DENABLE_SLFUTURE_CONST
+CFLAGS_map.o      += -DENABLE_SLFUTURE_CONST
+CFLAGS_scripts.o  += -DENABLE_SLFUTURE_CONST
diff --git a/tools/perf/ui/tui/Build b/tools/perf/ui/tui/Build
new file mode 100644
index 000000000000..9e4c6ca41a9f
--- /dev/null
+++ b/tools/perf/ui/tui/Build
@@ -0,0 +1,4 @@
+libperf-y += setup.o
+libperf-y += util.o
+libperf-y += helpline.o
+libperf-y += progress.o
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 13/30] perf build: Add gtk objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (11 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 12/30] perf build: Add slang " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 14/30] perf build: Add scripts " Jiri Olsa
                   ` (17 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the gtk objects building under build framework.

Add new gtk build object so it's separated from
the rest of the code and could be librarized.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build           |  2 ++
 tools/perf/Build.include   |  3 ++-
 tools/perf/Makefile.perf   | 17 +++++------------
 tools/perf/config/Makefile |  1 +
 tools/perf/ui/gtk/Build    |  9 +++++++++
 5 files changed, 19 insertions(+), 13 deletions(-)
 create mode 100644 tools/perf/ui/gtk/Build

diff --git a/tools/perf/Build b/tools/perf/Build
index e84ced325147..a9ff8fd0bff9 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -35,3 +35,5 @@ CFLAGS_builtin-timechart.o += $(paths)
 libperf-y += util/
 libperf-y += arch/
 libperf-y += ui/
+
+gtk-y += ui/gtk/
diff --git a/tools/perf/Build.include b/tools/perf/Build.include
index a3f325397fc7..6a990b018e6d 100644
--- a/tools/perf/Build.include
+++ b/tools/perf/Build.include
@@ -70,5 +70,6 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)),             \
 # - depfile generation
 # - global $(CFLAGS)
 # - per target C flags
+# - per object C flags
 # - BUILD_STR macro to allow '-D"$(variable)"' constructs
-c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o)
+c_flags = -Wp,-MD,$(depfile),-MT,$@ $(CFLAGS) -D"BUILD_STR(s)=\#s" $(CFLAGS_$(basetarget).o) $(CFLAGS_$(obj))
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 64836605a116..686e28073898 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -341,14 +341,7 @@ endif
 
 ifndef NO_GTK2
   ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
-
-  GTK_OBJS += $(OUTPUT)ui/gtk/browser.o
-  GTK_OBJS += $(OUTPUT)ui/gtk/hists.o
-  GTK_OBJS += $(OUTPUT)ui/gtk/setup.o
-  GTK_OBJS += $(OUTPUT)ui/gtk/util.o
-  GTK_OBJS += $(OUTPUT)ui/gtk/helpline.o
-  GTK_OBJS += $(OUTPUT)ui/gtk/progress.o
-  GTK_OBJS += $(OUTPUT)ui/gtk/annotate.o
+  GTK_IN := $(OUTPUT)gtk-in.o
 
 install-gtk: $(OUTPUT)libperf-gtk.so
 	$(call QUIET_INSTALL, 'GTK UI') \
@@ -417,10 +410,10 @@ $(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) $(PERF_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
                $(BUILTIN_OBJS) $(PERF_IN) $(LIBS) -o $@
 
-$(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H)
-	$(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $<
+$(GTK_IN): FORCE
+	@$(MAKE) $(build)=gtk
 
-$(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS)
+$(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
 	$(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
 
 $(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
@@ -700,7 +693,7 @@ config-clean:
 	@$(MAKE) -C config/feature-checks clean >/dev/null
 
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
-	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
+	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS)
 	@find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
 	@$(RM) .config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index db4957af8569..b1320ef2ca9b 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -839,3 +839,4 @@ $(call detected_var,mandir_SQ)
 $(call detected_var,ETC_PERFCONFIG_SQ)
 $(call detected_var,prefix_SQ)
 $(call detected_var,LIBDIR)
+$(call detected_var,GTK_CFLAGS)
diff --git a/tools/perf/ui/gtk/Build b/tools/perf/ui/gtk/Build
new file mode 100644
index 000000000000..ec22e899a224
--- /dev/null
+++ b/tools/perf/ui/gtk/Build
@@ -0,0 +1,9 @@
+CFLAGS_gtk += -fPIC $(GTK_CFLAGS)
+
+gtk-y += browser.o
+gtk-y += hists.o
+gtk-y += setup.o
+gtk-y += util.o
+gtk-y += helpline.o
+gtk-y += progress.o
+gtk-y += annotate.o
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 14/30] perf build: Add scripts objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (12 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 13/30] perf build: Add gtk " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 15/30] perf build: Add perf regs " Jiri Olsa
                   ` (16 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the scripts objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build                                |  1 +
 tools/perf/Makefile.perf                        | 22 ----------------------
 tools/perf/config/Makefile                      |  7 +++++++
 tools/perf/scripts/Build                        |  2 ++
 tools/perf/scripts/perl/Perf-Trace-Util/Build   |  3 +++
 tools/perf/scripts/python/Perf-Trace-Util/Build |  3 +++
 tools/perf/util/Build                           |  2 ++
 tools/perf/util/scripting-engines/Build         |  6 ++++++
 8 files changed, 24 insertions(+), 22 deletions(-)
 create mode 100644 tools/perf/scripts/Build
 create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Build
 create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Build
 create mode 100644 tools/perf/util/scripting-engines/Build

diff --git a/tools/perf/Build b/tools/perf/Build
index a9ff8fd0bff9..7035a51deff8 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -35,5 +35,6 @@ CFLAGS_builtin-timechart.o += $(paths)
 libperf-y += util/
 libperf-y += arch/
 libperf-y += ui/
+libperf-$(CONFIG_SCRIPT) += scripts/
 
 gtk-y += ui/gtk/
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 686e28073898..9793dd61931e 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -349,16 +349,6 @@ install-gtk: $(OUTPUT)libperf-gtk.so
 		$(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
 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
-
-ifndef NO_LIBPYTHON
-  LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
-  LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
-endif
-
 ifeq ($(NO_PERF_REGS),0)
   ifeq ($(ARCH),x86)
     LIB_H += arch/x86/include/perf_regs.h
@@ -460,18 +450,6 @@ $(OUTPUT)%.o: %.S
 $(OUTPUT)%.s: %.S
 	$(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
 
-$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default $<
-
-$(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-undef -Wno-switch-default $<
-
-$(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS
-	$(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 $(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 $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
 
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index b1320ef2ca9b..9392ce9d2e63 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -512,6 +512,8 @@ else
   else
     LDFLAGS += $(PERL_EMBED_LDFLAGS)
     EXTLIBS += $(PERL_EMBED_LIBADD)
+    $(call detected,CONFIG_LIBPERL)
+    CONFIG_SCRIPT := y
   endif
 endif
 
@@ -571,6 +573,8 @@ else
           LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
           EXTLIBS += $(PYTHON_EMBED_LIBADD)
           LANG_BINDINGS += $(obj-perf)python/perf.so
+          $(call detected,CONFIG_LIBPYTHON)
+          CONFIG_SCRIPT := y
         endif
       endif
     endif
@@ -840,3 +844,6 @@ $(call detected_var,ETC_PERFCONFIG_SQ)
 $(call detected_var,prefix_SQ)
 $(call detected_var,LIBDIR)
 $(call detected_var,GTK_CFLAGS)
+$(call detected_var,PERL_EMBED_CCOPTS)
+$(call detected_var,PYTHON_EMBED_CCOPTS)
+$(call detected_var,CONFIG_SCRIPT)
diff --git a/tools/perf/scripts/Build b/tools/perf/scripts/Build
new file mode 100644
index 000000000000..41efd7e368b3
--- /dev/null
+++ b/tools/perf/scripts/Build
@@ -0,0 +1,2 @@
+libperf-$(CONFIG_LIBPERL)   += perl/Perf-Trace-Util/
+libperf-$(CONFIG_LIBPYTHON) += python/Perf-Trace-Util/
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Build b/tools/perf/scripts/perl/Perf-Trace-Util/Build
new file mode 100644
index 000000000000..928e110179cb
--- /dev/null
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Build
@@ -0,0 +1,3 @@
+libperf-y += Context.o
+
+CFLAGS_Context.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-undef -Wno-switch-default
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Build b/tools/perf/scripts/python/Perf-Trace-Util/Build
new file mode 100644
index 000000000000..aefc15c9444a
--- /dev/null
+++ b/tools/perf/scripts/python/Perf-Trace-Util/Build
@@ -0,0 +1,3 @@
+libperf-y += Context.o
+
+CFLAGS_Context.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 0302566002f5..a9e7a97ea7b7 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -88,6 +88,8 @@ libperf-$(CONFIG_DWARF) += dwarf-aux.o
 libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
 libperf-$(CONFIG_LIBUNWIND)          += unwind-libunwind.o
 
+libperf-$(CONFIG_SCRIPT) += scripting-engines/
+
 CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
 
diff --git a/tools/perf/util/scripting-engines/Build b/tools/perf/util/scripting-engines/Build
new file mode 100644
index 000000000000..6516e220c247
--- /dev/null
+++ b/tools/perf/util/scripting-engines/Build
@@ -0,0 +1,6 @@
+libperf-$(CONFIG_LIBPERL)   += trace-event-perl.o
+libperf-$(CONFIG_LIBPYTHON) += trace-event-python.o
+
+CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default
+
+CFLAGS_trace-event-python.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 15/30] perf build: Add perf regs objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (13 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 14/30] perf build: Add scripts " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 16/30] perf build: Add zlib " Jiri Olsa
                   ` (15 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the regs objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.perf   | 7 -------
 tools/perf/config/Makefile | 4 ++++
 tools/perf/util/Build      | 2 ++
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 9793dd61931e..039add2ba49a 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -349,13 +349,6 @@ install-gtk: $(OUTPUT)libperf-gtk.so
 		$(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
 endif
 
-ifeq ($(NO_PERF_REGS),0)
-  ifeq ($(ARCH),x86)
-    LIB_H += arch/x86/include/perf_regs.h
-  endif
-  LIB_OBJS += $(OUTPUT)util/perf_regs.o
-endif
-
 ifndef NO_ZLIB
   LIB_OBJS += $(OUTPUT)util/zlib.o
 endif
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 9392ce9d2e63..385a46fd8343 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -48,6 +48,10 @@ ifeq ($(ARCH),arm64)
   LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
 endif
 
+ifeq ($(NO_PERF_REGS),0)
+$(call detected,CONFIG_PERF_REGS)
+endif
+
 # So far there's only x86 and arm libdw unwind support merged in perf.
 # Disable it on all other architectures in case libdw unwind
 # support is detected in system. Add supported architectures
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index a9e7a97ea7b7..bf981c4321b1 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -90,6 +90,8 @@ libperf-$(CONFIG_LIBUNWIND)          += unwind-libunwind.o
 
 libperf-$(CONFIG_SCRIPT) += scripting-engines/
 
+libperf-$(CONFIG_PERF_REGS) += perf_regs.o
+
 CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 16/30] perf build: Add zlib objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (14 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 15/30] perf build: Add perf regs " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:35 ` [PATCH 17/30] perf build: Add perf.o object building Jiri Olsa
                   ` (14 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the zlib objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.perf   | 4 ----
 tools/perf/config/Makefile | 1 +
 tools/perf/util/Build      | 1 +
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 039add2ba49a..1d1fc9e3cae6 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -349,10 +349,6 @@ install-gtk: $(OUTPUT)libperf-gtk.so
 		$(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
 endif
 
-ifndef NO_ZLIB
-  LIB_OBJS += $(OUTPUT)util/zlib.o
-endif
-
 ifdef ASCIIDOC8
   export ASCIIDOC8
 endif
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 385a46fd8343..e1867f25cf60 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -636,6 +636,7 @@ ifndef NO_ZLIB
   ifeq ($(feature-zlib), 1)
     CFLAGS += -DHAVE_ZLIB_SUPPORT
     EXTLIBS += -lz
+    $(call detected,CONFIG_ZLIB)
   else
     NO_ZLIB := 1
   endif
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index bf981c4321b1..0583ac820f28 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -91,6 +91,7 @@ libperf-$(CONFIG_LIBUNWIND)          += unwind-libunwind.o
 libperf-$(CONFIG_SCRIPT) += scripting-engines/
 
 libperf-$(CONFIG_PERF_REGS) += perf_regs.o
+libperf-$(CONFIG_ZLIB) += zlib.o
 
 CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 17/30] perf build: Add perf.o object building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (15 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 16/30] perf build: Add zlib " Jiri Olsa
@ 2015-01-02 15:35 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 18/30] perf build: Add arch x86 objects building Jiri Olsa
                   ` (13 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the perf object building under build framework
to be included in the perf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build         |  3 +++
 tools/perf/Makefile.perf | 16 +++++-----------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/tools/perf/Build b/tools/perf/Build
index 7035a51deff8..c95d6378ad65 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -25,12 +25,15 @@ perf-$(CONFIG_LIBELF) += builtin-probe.o
 perf-y += bench/
 perf-y += tests/
 
+perf-y += perf.o
+
 paths += -DPERF_HTML_PATH="BUILD_STR($(htmldir_SQ))"
 paths += -DPERF_INFO_PATH="BUILD_STR($(infodir_SQ))"
 paths += -DPERF_MAN_PATH="BUILD_STR($(mandir_SQ))"
 
 CFLAGS_builtin-help.o      += $(paths)
 CFLAGS_builtin-timechart.o += $(paths)
+CFLAGS_perf.o += -DPERF_HTML_PATH="BUILD_STR($(htmldir_SQ))" -include $(OUTPUT)PERF-VERSION-FILE
 
 libperf-y += util/
 libperf-y += arch/
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 1d1fc9e3cae6..1393f34a01c2 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -377,16 +377,11 @@ export OUTPUT RM CC LD CFLAGS V BISON FLEX
 
 build := -f Makefile.build dir=. obj
 
-$(PERF_IN): FORCE
+$(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
 	@$(MAKE) $(build)=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)"' \
-		$(CFLAGS) -c $(filter %.c,$^) -o $@
-
-$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS) $(PERF_IN)
-	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
+$(OUTPUT)perf: $(BUILTIN_OBJS) $(PERFLIBS) $(PERF_IN)
+	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \
                $(BUILTIN_OBJS) $(PERF_IN) $(LIBS) -o $@
 
 $(GTK_IN): FORCE
@@ -404,8 +399,7 @@ $(SCRIPTS) : % : %.sh
 	$(QUIET_GEN)$(INSTALL) '$@.sh' '$(OUTPUT)$@'
 
 # These can record PERF_VERSION
-$(OUTPUT)perf.o perf.spec \
-	$(SCRIPTS) \
+perf.spec $(SCRIPTS) \
 	: $(OUTPUT)PERF-VERSION-FILE
 
 .SUFFIXES:
@@ -660,7 +654,7 @@ config-clean:
 	@$(MAKE) -C config/feature-checks clean >/dev/null
 
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
-	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS)
+	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
 	@find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
 	@$(RM) .config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 18/30] perf build: Add arch x86 objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (16 preceding siblings ...)
  2015-01-02 15:35 ` [PATCH 17/30] perf build: Add perf.o object building Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 19/30] perf build: Add arch arm " Jiri Olsa
                   ` (12 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the x86 arch objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/Build           |  1 +
 tools/perf/arch/arm/Build       |  0
 tools/perf/arch/arm64/Build     |  0
 tools/perf/arch/powerpc/Build   |  0
 tools/perf/arch/s390/Build      |  0
 tools/perf/arch/sh/Build        |  0
 tools/perf/arch/sparc/Build     |  0
 tools/perf/arch/x86/Build       |  2 ++
 tools/perf/arch/x86/Makefile    | 15 ---------------
 tools/perf/arch/x86/tests/Build |  2 ++
 tools/perf/arch/x86/util/Build  |  8 ++++++++
 11 files changed, 13 insertions(+), 15 deletions(-)
 create mode 100644 tools/perf/arch/arm/Build
 create mode 100644 tools/perf/arch/arm64/Build
 create mode 100644 tools/perf/arch/powerpc/Build
 create mode 100644 tools/perf/arch/s390/Build
 create mode 100644 tools/perf/arch/sh/Build
 create mode 100644 tools/perf/arch/sparc/Build
 create mode 100644 tools/perf/arch/x86/Build
 create mode 100644 tools/perf/arch/x86/tests/Build
 create mode 100644 tools/perf/arch/x86/util/Build

diff --git a/tools/perf/arch/Build b/tools/perf/arch/Build
index 304f5e76c613..109eb75cf7de 100644
--- a/tools/perf/arch/Build
+++ b/tools/perf/arch/Build
@@ -1 +1,2 @@
 libperf-y += common.o
+libperf-y += $(ARCH)/
diff --git a/tools/perf/arch/arm/Build b/tools/perf/arch/arm/Build
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/perf/arch/arm64/Build b/tools/perf/arch/arm64/Build
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/perf/arch/powerpc/Build b/tools/perf/arch/powerpc/Build
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/perf/arch/s390/Build b/tools/perf/arch/s390/Build
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/perf/arch/sh/Build b/tools/perf/arch/sh/Build
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/perf/arch/sparc/Build b/tools/perf/arch/sparc/Build
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tools/perf/arch/x86/Build b/tools/perf/arch/x86/Build
new file mode 100644
index 000000000000..41bf61da476a
--- /dev/null
+++ b/tools/perf/arch/x86/Build
@@ -0,0 +1,2 @@
+libperf-y += util/
+libperf-$(CONFIG_DWARF_UNWIND) += tests/
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 9b21881db52f..21322e0385b8 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -1,19 +1,4 @@
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
-ifndef NO_LIBDW_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-endif
-ifndef NO_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
-LIB_H += arch/$(ARCH)/util/tsc.h
 HAVE_KVM_STAT_SUPPORT := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
diff --git a/tools/perf/arch/x86/tests/Build b/tools/perf/arch/x86/tests/Build
new file mode 100644
index 000000000000..b30eff9bcc83
--- /dev/null
+++ b/tools/perf/arch/x86/tests/Build
@@ -0,0 +1,2 @@
+libperf-y += regs_load.o
+libperf-y += dwarf-unwind.o
diff --git a/tools/perf/arch/x86/util/Build b/tools/perf/arch/x86/util/Build
new file mode 100644
index 000000000000..cfbccc4e3187
--- /dev/null
+++ b/tools/perf/arch/x86/util/Build
@@ -0,0 +1,8 @@
+libperf-y += header.o
+libperf-y += tsc.o
+libperf-y += kvm-stat.o
+
+libperf-$(CONFIG_DWARF) += dwarf-regs.o
+
+libperf-$(CONFIG_LIBUNWIND)          += unwind-libunwind.o
+libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 19/30] perf build: Add arch arm objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (17 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 18/30] perf build: Add arch x86 objects building Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 20/30] perf build: Add arch arm64 " Jiri Olsa
                   ` (11 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the arm arch objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/arm/Build       |  2 ++
 tools/perf/arch/arm/Makefile    | 11 -----------
 tools/perf/arch/arm/tests/Build |  2 ++
 tools/perf/arch/arm/util/Build  |  4 ++++
 4 files changed, 8 insertions(+), 11 deletions(-)
 create mode 100644 tools/perf/arch/arm/tests/Build
 create mode 100644 tools/perf/arch/arm/util/Build

diff --git a/tools/perf/arch/arm/Build b/tools/perf/arch/arm/Build
index e69de29bb2d1..41bf61da476a 100644
--- a/tools/perf/arch/arm/Build
+++ b/tools/perf/arch/arm/Build
@@ -0,0 +1,2 @@
+libperf-y += util/
+libperf-$(CONFIG_DWARF_UNWIND) += tests/
diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
index 09d62153d384..7fbca175099e 100644
--- a/tools/perf/arch/arm/Makefile
+++ b/tools/perf/arch/arm/Makefile
@@ -1,14 +1,3 @@
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
-ifndef NO_LIBDW_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-endif
-ifndef NO_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
 endif
diff --git a/tools/perf/arch/arm/tests/Build b/tools/perf/arch/arm/tests/Build
new file mode 100644
index 000000000000..b30eff9bcc83
--- /dev/null
+++ b/tools/perf/arch/arm/tests/Build
@@ -0,0 +1,2 @@
+libperf-y += regs_load.o
+libperf-y += dwarf-unwind.o
diff --git a/tools/perf/arch/arm/util/Build b/tools/perf/arch/arm/util/Build
new file mode 100644
index 000000000000..d22e3d07de3d
--- /dev/null
+++ b/tools/perf/arch/arm/util/Build
@@ -0,0 +1,4 @@
+libperf-$(CONFIG_DWARF) += dwarf-regs.o
+
+libperf-$(CONFIG_LIBUNWIND)          += unwind-libunwind.o
+libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 20/30] perf build: Add arch arm64 objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (18 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 19/30] perf build: Add arch arm " Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 21/30] perf build: Add arch powerpc " Jiri Olsa
                   ` (10 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the arm64 arch objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/arm64/Build      | 3 +++
 tools/perf/arch/arm64/Makefile   | 4 ----
 tools/perf/arch/arm64/util/Build | 2 ++
 3 files changed, 5 insertions(+), 4 deletions(-)
 create mode 100644 tools/perf/arch/arm64/util/Build

diff --git a/tools/perf/arch/arm64/Build b/tools/perf/arch/arm64/Build
index e69de29bb2d1..3bfe380bbf4e 100644
--- a/tools/perf/arch/arm64/Build
+++ b/tools/perf/arch/arm64/Build
@@ -0,0 +1,3 @@
+ifneq ($(CONFIG_DWARF)$(CONFIG_LIBUNWIND),)
+libperf-y += util/
+endif
diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
index 67e9b3d38e89..7fbca175099e 100644
--- a/tools/perf/arch/arm64/Makefile
+++ b/tools/perf/arch/arm64/Makefile
@@ -1,7 +1,3 @@
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
 endif
diff --git a/tools/perf/arch/arm64/util/Build b/tools/perf/arch/arm64/util/Build
new file mode 100644
index 000000000000..e58123a8912b
--- /dev/null
+++ b/tools/perf/arch/arm64/util/Build
@@ -0,0 +1,2 @@
+libperf-$(CONFIG_DWARF)     += dwarf-regs.o
+libperf-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 21/30] perf build: Add arch powerpc objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (19 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 20/30] perf build: Add arch arm64 " Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 22/30] perf build: Add arch s390 " Jiri Olsa
                   ` (9 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the powerpc arch objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/powerpc/Build      | 1 +
 tools/perf/arch/powerpc/Makefile   | 3 ---
 tools/perf/arch/powerpc/util/Build | 4 ++++
 3 files changed, 5 insertions(+), 3 deletions(-)
 create mode 100644 tools/perf/arch/powerpc/util/Build

diff --git a/tools/perf/arch/powerpc/Build b/tools/perf/arch/powerpc/Build
index e69de29bb2d1..54afe4a467e7 100644
--- a/tools/perf/arch/powerpc/Build
+++ b/tools/perf/arch/powerpc/Build
@@ -0,0 +1 @@
+libperf-y += util/
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
index 6f7782bea5dd..7fbca175099e 100644
--- a/tools/perf/arch/powerpc/Makefile
+++ b/tools/perf/arch/powerpc/Makefile
@@ -1,6 +1,3 @@
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/skip-callchain-idx.o
 endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build
new file mode 100644
index 000000000000..0af6e9b3f728
--- /dev/null
+++ b/tools/perf/arch/powerpc/util/Build
@@ -0,0 +1,4 @@
+libperf-y += header.o
+
+libperf-$(CONFIG_DWARF) += dwarf-regs.o
+libperf-$(CONFIG_DWARF) += skip-callchain-idx.o
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 22/30] perf build: Add arch s390 objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (20 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 21/30] perf build: Add arch powerpc " Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 23/30] perf build: Add arch sh " Jiri Olsa
                   ` (8 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the s390 arch objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/s390/Build      | 1 +
 tools/perf/arch/s390/Makefile   | 3 ---
 tools/perf/arch/s390/util/Build | 4 ++++
 3 files changed, 5 insertions(+), 3 deletions(-)
 create mode 100644 tools/perf/arch/s390/util/Build

diff --git a/tools/perf/arch/s390/Build b/tools/perf/arch/s390/Build
index e69de29bb2d1..54afe4a467e7 100644
--- a/tools/perf/arch/s390/Build
+++ b/tools/perf/arch/s390/Build
@@ -0,0 +1 @@
+libperf-y += util/
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
index 798ac7379c5f..21322e0385b8 100644
--- a/tools/perf/arch/s390/Makefile
+++ b/tools/perf/arch/s390/Makefile
@@ -1,7 +1,4 @@
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
 HAVE_KVM_STAT_SUPPORT := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
diff --git a/tools/perf/arch/s390/util/Build b/tools/perf/arch/s390/util/Build
new file mode 100644
index 000000000000..8a61372bb47a
--- /dev/null
+++ b/tools/perf/arch/s390/util/Build
@@ -0,0 +1,4 @@
+libperf-y += header.o
+libperf-y += kvm-stat.o
+
+libperf-$(CONFIG_DWARF) += dwarf-regs.o
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 23/30] perf build: Add arch sh objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (21 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 22/30] perf build: Add arch s390 " Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 24/30] perf build: Add arch sparc " Jiri Olsa
                   ` (7 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the sh arch objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/sh/Build      | 1 +
 tools/perf/arch/sh/Makefile   | 1 -
 tools/perf/arch/sh/util/Build | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/arch/sh/util/Build

diff --git a/tools/perf/arch/sh/Build b/tools/perf/arch/sh/Build
index e69de29bb2d1..add469481bfd 100644
--- a/tools/perf/arch/sh/Build
+++ b/tools/perf/arch/sh/Build
@@ -0,0 +1 @@
+libperf-$(CONFIG_DWARF) += util/
diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
index 15130b50dfe3..7fbca175099e 100644
--- a/tools/perf/arch/sh/Makefile
+++ b/tools/perf/arch/sh/Makefile
@@ -1,4 +1,3 @@
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
diff --git a/tools/perf/arch/sh/util/Build b/tools/perf/arch/sh/util/Build
new file mode 100644
index 000000000000..332f01243f2f
--- /dev/null
+++ b/tools/perf/arch/sh/util/Build
@@ -0,0 +1 @@
+libperf-y += dwarf-regs.o
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 24/30] perf build: Add arch sparc objects building
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (22 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 23/30] perf build: Add arch sh " Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 25/30] perf build: Add single target build framework support Jiri Olsa
                   ` (6 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Move the sparc arch objects building under build framework
to be included in the libperf build object.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/arch/sparc/Build      | 1 +
 tools/perf/arch/sparc/Makefile   | 1 -
 tools/perf/arch/sparc/util/Build | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)
 create mode 100644 tools/perf/arch/sparc/util/Build

diff --git a/tools/perf/arch/sparc/Build b/tools/perf/arch/sparc/Build
index e69de29bb2d1..add469481bfd 100644
--- a/tools/perf/arch/sparc/Build
+++ b/tools/perf/arch/sparc/Build
@@ -0,0 +1 @@
+libperf-$(CONFIG_DWARF) += util/
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
index 15130b50dfe3..7fbca175099e 100644
--- a/tools/perf/arch/sparc/Makefile
+++ b/tools/perf/arch/sparc/Makefile
@@ -1,4 +1,3 @@
 ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
 endif
diff --git a/tools/perf/arch/sparc/util/Build b/tools/perf/arch/sparc/util/Build
new file mode 100644
index 000000000000..332f01243f2f
--- /dev/null
+++ b/tools/perf/arch/sparc/util/Build
@@ -0,0 +1 @@
+libperf-y += dwarf-regs.o
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 25/30] perf build: Add single target build framework support
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (23 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 24/30] perf build: Add arch sparc " Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 26/30] perf make: Remove directory dependency rules Jiri Olsa
                   ` (5 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Add support to build single targets, like:

 $ make util/map.o    # objects
 $ make util/map.i    # preprocessor
 $ make util/map.s    # assembly

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.build | 20 +++++++++++++++++++-
 tools/perf/Makefile.perf  | 39 ++++++++++++++++++++++++++++-----------
 tools/perf/util/Build     |  7 +++++++
 3 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/tools/perf/Makefile.build b/tools/perf/Makefile.build
index e5d4e4fe5077..54dc27e0acac 100644
--- a/tools/perf/Makefile.build
+++ b/tools/perf/Makefile.build
@@ -41,6 +41,12 @@ quiet_cmd_mkdir = MKDIR    $(dir $@)
 quiet_cmd_cc_o_c = CC       $@
       cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
 
+quiet_cmd_cc_i_c = CPP      $@
+      cmd_cc_i_c = $(CC) $(c_flags) -E -o $@ $<
+
+quiet_cmd_cc_s_c = AS       $@
+      cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
+
 # Link agregate command
 quiet_cmd_ld_multi = LD       $@
       cmd_ld_multi = $(LD) -r -o $@ $^
@@ -54,6 +60,18 @@ $(OUTPUT)%.o: %.S FORCE
 	$(call cmd_mkdir)
 	$(call if_changed_dep,cc_o_c)
 
+$(OUTPUT)%.i: %.c FORCE
+	$(call cmd_mkdir)
+	$(call if_changed_dep,cc_i_c)
+
+$(OUTPUT)%.i: %.S FORCE
+	$(call cmd_mkdir)
+	$(call if_changed_dep,cc_i_c)
+
+$(OUTPUT)%.s: %.c FORCE
+	$(call cmd_mkdir)
+	$(call if_changed_dep,cc_s_c)
+
 # Gather build data:
 #   obj-y        - list of build objects
 #   subdir-y     - list of directories to nest
@@ -91,7 +109,7 @@ FORCE:
 
 # Include all cmd files to get all the dependency rules
 # for all objects included
-targets   := $(wildcard $(sort $(obj-y)))
+targets   := $(wildcard $(sort $(obj-y) $(MAKECMDGOALS)))
 cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
 
 ifneq ($(cmd_files),)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 1393f34a01c2..a6bfadb32217 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -422,16 +422,33 @@ endif
 # These two need to be here so that when O= is not used they take precedence
 # over the general rule for .o
 
-$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
-$(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
-	$(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $<
-$(OUTPUT)%.o: %.S
-	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-$(OUTPUT)%.s: %.S
-	$(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
+# get relative building directory (to $(OUTPUT))
+# and '.' if it's $(OUTPUT) itself
+__build-dir = $(subst $(OUTPUT),,$(dir $@))
+build-dir   = $(if $(__build-dir),$(__build-dir),.)
+
+single_dep: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
+
+$(OUTPUT)%.o: %.c single_dep FORCE
+	@$(MAKE) -f Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%.i: %.c single_dep FORCE
+	@$(MAKE) -f Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%.s: %.c single_dep FORCE
+	@$(MAKE) -f Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%-bison.o: %.c single_dep FORCE
+	@$(MAKE) -f Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%-flex.o: %.c single_dep FORCE
+	@$(MAKE) -f Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%.o: %.S single_dep FORCE
+	@$(MAKE) -f Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%.i: %.S single_dep FORCE
+	@$(MAKE) -f Makefile.build dir=$(build-dir) $@
 
 $(OUTPUT)perf-%: %.o $(PERFLIBS)
 	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
@@ -676,5 +693,5 @@ FORCE:
 
 .PHONY: all install clean config-clean strip install-gtk
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
-.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS FORCE
+.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS FORCE single_dep
 
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 0583ac820f28..9293f2de6050 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -97,15 +97,19 @@ CFLAGS_config.o   += -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
 CFLAGS_exec_cmd.o += -DPERF_EXEC_PATH="BUILD_STR($(perfexecdir_SQ))" -DPREFIX="BUILD_STR($(prefix_SQ))"
 
 $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
+	$(call cmd_mkdir)
 	@$(call echo-cmd,bison)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
 
 $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
+	$(call cmd_mkdir)
 	@$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
 
 $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
+	$(call cmd_mkdir)
 	@$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
 
 $(OUTPUT)util/pmu-bison.c: util/pmu.y
+	$(call cmd_mkdir)
 	@$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
 
 CFLAGS_parse-events-flex.o  += -w
@@ -121,10 +125,13 @@ CFLAGS_rbtree.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ET
 CFLAGS_parse-events.o  += -Wno-redundant-decls
 
 $(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c FORCE
+	$(call cmd_mkdir)
 	$(call if_changed_dep,cc_o_c)
 
 $(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c FORCE
+	$(call cmd_mkdir)
 	$(call if_changed_dep,cc_o_c)
 
 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c FORCE
+	$(call cmd_mkdir)
 	$(call if_changed_dep,cc_o_c)
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 26/30] perf make: Remove directory dependency rules
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (24 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 25/30] perf build: Add single target build framework support Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 27/30] perf make: Remove uneeded variables Jiri Olsa
                   ` (4 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Removing subdirectories creation support from Makefile.perf
as it's no longer needed, since it's properly handled by new
build system.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.perf | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a6bfadb32217..e41400633df2 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -466,21 +466,6 @@ endif
 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
 $(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
 
-# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
-# we depend the various files onto their directories.
-DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(GTK_OBJS)
-DIRECTORY_DEPS += $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
-# no need to add flex objects, because they depend on bison ones
-DIRECTORY_DEPS += $(OUTPUT)util/parse-events-bison.c
-DIRECTORY_DEPS += $(OUTPUT)util/pmu-bison.c
-
-OUTPUT_DIRECTORIES := $(sort $(dir $(DIRECTORY_DEPS)))
-
-$(DIRECTORY_DEPS): | $(OUTPUT_DIRECTORIES)
-# In the second step, we make a rule to actually create these directories
-$(OUTPUT_DIRECTORIES):
-	$(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null
-
 LIBPERF_IN := $(OUTPUT)libperf-in.o
 
 $(LIBPERF_IN): FORCE
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 27/30] perf make: Remove uneeded variables
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (25 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 26/30] perf make: Remove directory dependency rules Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 28/30] perf make: Remove PERF-CFLAGS file Jiri Olsa
                   ` (3 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Removing uneeded variables from Makefile.perf:

  BUILTIN_OBJS LIB_OBJS GTK_OBJS
  - objects are now hold by in the build Makefiles

  LIB_H
  - header dependencies iare now handled by Build
    framework

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.perf | 123 ++---------------------------------------------
 1 file changed, 5 insertions(+), 118 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index e41400633df2..371701fd68cd 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -139,10 +139,6 @@ export prefix bindir sharedir sysconfdir DESTDIR
 SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
 
 # Guard against environment variables
-BUILTIN_OBJS =
-LIB_H =
-LIB_OBJS =
-GTK_OBJS =
 PYRF_OBJS =
 SCRIPT_SH =
 
@@ -220,113 +216,6 @@ export PERL_PATH
 
 LIB_FILE=$(OUTPUT)libperf.a
 
-LIB_H += ../lib/symbol/kallsyms.h
-LIB_H += ../../include/uapi/linux/perf_event.h
-LIB_H += ../../include/linux/rbtree.h
-LIB_H += ../../include/linux/list.h
-LIB_H += ../../include/uapi/linux/const.h
-LIB_H += ../include/linux/hash.h
-LIB_H += ../../include/linux/stringify.h
-LIB_H += util/include/linux/bitmap.h
-LIB_H += ../include/linux/bitops.h
-LIB_H += ../include/asm-generic/bitops/atomic.h
-LIB_H += ../include/asm-generic/bitops/find.h
-LIB_H += ../include/asm-generic/bitops/fls64.h
-LIB_H += ../include/asm-generic/bitops/fls.h
-LIB_H += ../include/asm-generic/bitops/__ffs.h
-LIB_H += ../include/asm-generic/bitops/__fls.h
-LIB_H += ../include/asm-generic/bitops.h
-LIB_H += ../include/linux/compiler.h
-LIB_H += ../include/linux/log2.h
-LIB_H += util/include/linux/const.h
-LIB_H += util/include/linux/ctype.h
-LIB_H += util/include/linux/kernel.h
-LIB_H += util/include/linux/list.h
-LIB_H += ../include/linux/export.h
-LIB_H += util/include/linux/poison.h
-LIB_H += util/include/linux/rbtree.h
-LIB_H += util/include/linux/rbtree_augmented.h
-LIB_H += util/include/linux/string.h
-LIB_H += ../include/linux/types.h
-LIB_H += util/include/linux/linkage.h
-LIB_H += util/include/asm/asm-offsets.h
-LIB_H += ../include/asm/bug.h
-LIB_H += util/include/asm/byteorder.h
-LIB_H += util/include/asm/hweight.h
-LIB_H += util/include/asm/swab.h
-LIB_H += util/include/asm/system.h
-LIB_H += util/include/asm/uaccess.h
-LIB_H += util/include/dwarf-regs.h
-LIB_H += util/include/asm/dwarf2.h
-LIB_H += util/include/asm/cpufeature.h
-LIB_H += util/include/asm/unistd_32.h
-LIB_H += util/include/asm/unistd_64.h
-LIB_H += perf.h
-LIB_H += util/annotate.h
-LIB_H += util/cache.h
-LIB_H += util/callchain.h
-LIB_H += util/build-id.h
-LIB_H += util/db-export.h
-LIB_H += util/debug.h
-LIB_H += util/pmu.h
-LIB_H += util/event.h
-LIB_H += util/evsel.h
-LIB_H += util/evlist.h
-LIB_H += util/exec_cmd.h
-LIB_H += util/find-vdso-map.c
-LIB_H += util/levenshtein.h
-LIB_H += util/machine.h
-LIB_H += util/map.h
-LIB_H += util/parse-options.h
-LIB_H += util/parse-events.h
-LIB_H += util/quote.h
-LIB_H += util/util.h
-LIB_H += util/xyarray.h
-LIB_H += util/header.h
-LIB_H += util/help.h
-LIB_H += util/session.h
-LIB_H += util/ordered-events.h
-LIB_H += util/strbuf.h
-LIB_H += util/strlist.h
-LIB_H += util/strfilter.h
-LIB_H += util/svghelper.h
-LIB_H += util/tool.h
-LIB_H += util/run-command.h
-LIB_H += util/sigchain.h
-LIB_H += util/dso.h
-LIB_H += util/symbol.h
-LIB_H += util/color.h
-LIB_H += util/values.h
-LIB_H += util/sort.h
-LIB_H += util/hist.h
-LIB_H += util/comm.h
-LIB_H += util/thread.h
-LIB_H += util/thread_map.h
-LIB_H += util/trace-event.h
-LIB_H += util/probe-finder.h
-LIB_H += util/dwarf-aux.h
-LIB_H += util/probe-event.h
-LIB_H += util/pstack.h
-LIB_H += util/cpumap.h
-LIB_H += util/top.h
-LIB_H += $(ARCH_INCLUDE)
-LIB_H += util/cgroup.h
-LIB_H += $(LIB_INCLUDE)traceevent/event-parse.h
-LIB_H += util/target.h
-LIB_H += util/rblist.h
-LIB_H += util/intlist.h
-LIB_H += util/perf_regs.h
-LIB_H += util/unwind.h
-LIB_H += util/vdso.h
-LIB_H += util/tsc.h
-LIB_H += ui/helpline.h
-LIB_H += ui/progress.h
-LIB_H += ui/util.h
-LIB_H += ui/ui.h
-LIB_H += util/data.h
-LIB_H += util/kvm-stat.h
-LIB_H += util/thread-stack.h
-
 PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
 
 # We choose to avoid "if .. else if .. else .. endif endif"
@@ -380,9 +269,8 @@ build := -f Makefile.build dir=. obj
 $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
 	@$(MAKE) $(build)=perf
 
-$(OUTPUT)perf: $(BUILTIN_OBJS) $(PERFLIBS) $(PERF_IN)
-	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) \
-               $(BUILTIN_OBJS) $(PERF_IN) $(LIBS) -o $@
+$(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
+	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(PERF_IN) $(LIBS) -o $@
 
 $(GTK_IN): FORCE
 	@$(MAKE) $(build)=gtk
@@ -463,15 +351,14 @@ $(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-vdso-map.c
 	$(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
 endif
 
-$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
-$(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
+$(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
 
 LIBPERF_IN := $(OUTPUT)libperf-in.o
 
 $(LIBPERF_IN): FORCE
 	@$(MAKE) $(build)=libperf
 
-$(LIB_FILE): $(LIB_OBJS) $(LIBPERF_IN)
+$(LIB_FILE): $(LIBPERF_IN)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIB_OBJS)
 
 # libtraceevent.a
@@ -656,7 +543,7 @@ config-clean:
 	@$(MAKE) -C config/feature-checks clean >/dev/null
 
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
-	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
+	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
 	@find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
 	@$(RM) .config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 28/30] perf make: Remove PERF-CFLAGS file
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (26 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 27/30] perf make: Remove uneeded variables Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 15:36 ` [PATCH 29/30] perf tools: Add support to configure builtin commands inclusion Jiri Olsa
                   ` (2 subsequent siblings)
  30 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

Removing PERF-CFLAGS file, because the build framework
stores full build command line for each object and
triggers rebuilt if necessary.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Makefile.perf | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 371701fd68cd..45d30b8f947e 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -368,7 +368,7 @@ LIBTRACEEVENT_FLAGS  = $(QUIET_SUBDIR1) O=$(OUTPUT)
 LIBTRACEEVENT_FLAGS += CFLAGS="-g -Wall $(EXTRA_CFLAGS)"
 LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
 
-$(LIBTRACEEVENT): $(TE_SOURCES) $(OUTPUT)PERF-CFLAGS
+$(LIBTRACEEVENT): $(TE_SOURCES)
 	$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) libtraceevent.a plugins
 
 $(LIBTRACEEVENT)-clean:
@@ -447,17 +447,6 @@ cscope:
 	$(QUIET_GEN)$(RM) cscope*; \
 	$(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES)
 
-### Detect prefix changes
-TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
-             $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):$(plugindir_SQ)
-
-$(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
-	@FLAGS='$(TRACK_CFLAGS)'; \
-	    if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \
-		echo 1>&2 "  FLAGS:   * new build flags or prefix"; \
-		echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \
-            fi
-
 ### Testing rules
 
 # GNU make supports exporting all variables by "export" without parameters.
@@ -547,7 +536,7 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	@find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
 	@$(RM) .config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
-	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
+	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(python-clean)
 
@@ -565,5 +554,5 @@ FORCE:
 
 .PHONY: all install clean config-clean strip install-gtk
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
-.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS FORCE single_dep
+.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep
 
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 29/30] perf tools: Add support to configure builtin commands inclusion
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (27 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 28/30] perf make: Remove PERF-CFLAGS file Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-08  7:15   ` Namhyung Kim
  2015-01-02 15:36 ` [PATCH 30/30] perf tools: Disable test code Jiri Olsa
  2015-01-02 17:36 ` [RFC/PATCHSET 00/30] perf tools: New build framework Ingo Molnar
  30 siblings, 1 reply; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

NOTE: hack

Adding support to configure builtin commands inclusion
in the build, so we could later disable particular
builtin command.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/Build                    | 53 ++++++++++++++++++++-----------------
 tools/perf/Makefile.build           |  3 +++
 tools/perf/Makefile.perf            |  7 +++--
 tools/perf/builtin-cmds.h           | 29 ++++++++++++++++++++
 tools/perf/builtin-help.c           |  1 +
 tools/perf/config.default           | 23 ++++++++++++++++
 tools/perf/perf.c                   |  1 +
 tools/perf/util/generate-cmdlist.sh | 10 +++++++
 8 files changed, 101 insertions(+), 26 deletions(-)
 create mode 100644 tools/perf/builtin-cmds.h
 create mode 100644 tools/perf/config.default

diff --git a/tools/perf/Build b/tools/perf/Build
index c95d6378ad65..8e8f2c58f2b0 100644
--- a/tools/perf/Build
+++ b/tools/perf/Build
@@ -1,29 +1,34 @@
-perf-y += builtin-bench.o
-perf-y += builtin-annotate.o
-perf-y += builtin-diff.o
-perf-y += builtin-evlist.o
-perf-y += builtin-help.o
-perf-y += builtin-sched.o
-perf-y += builtin-buildid-list.o
-perf-y += builtin-buildid-cache.o
-perf-y += builtin-list.o
-perf-y += builtin-record.o
-perf-y += builtin-report.o
-perf-y += builtin-stat.o
-perf-y += builtin-timechart.o
-perf-y += builtin-top.o
-perf-y += builtin-script.o
-perf-y += builtin-kmem.o
-perf-y += builtin-lock.o
-perf-y += builtin-kvm.o
-perf-y += builtin-inject.o
-perf-y += builtin-mem.o
-
-perf-$(CONFIG_AUDIT) += builtin-trace.o
-perf-$(CONFIG_LIBELF) += builtin-probe.o
+perf-$(CONFIG_BUILTIN_BENCH)         += builtin-bench.o
+perf-$(CONFIG_BUILTIN_ANNOTATE)      += builtin-annotate.o
+perf-$(CONFIG_BUILTIN_DIFF)          += builtin-diff.o
+perf-$(CONFIG_BUILTIN_EVLIST)        += builtin-evlist.o
+perf-$(CONFIG_BUILTIN_HELP)          += builtin-help.o
+perf-$(CONFIG_BUILTIN_SCHED)         += builtin-sched.o
+perf-$(CONFIG_BUILTIN_BUILDID_LIST)  += builtin-buildid-list.o
+perf-$(CONFIG_BUILTIN_BUILDID_CACHE) += builtin-buildid-cache.o
+perf-$(CONFIG_BUILTIN_LIST)          += builtin-list.o
+perf-$(CONFIG_BUILTIN_RECORD)        += builtin-record.o
+perf-$(CONFIG_BUILTIN_REPORT)        += builtin-report.o
+perf-$(CONFIG_BUILTIN_STAT)          += builtin-stat.o
+perf-$(CONFIG_BUILTIN_TIMECHART)     += builtin-timechart.o
+perf-$(CONFIG_BUILTIN_TOP)           += builtin-top.o
+perf-$(CONFIG_BUILTIN_SCRIPT)        += builtin-script.o
+perf-$(CONFIG_BUILTIN_KMEM)          += builtin-kmem.o
+perf-$(CONFIG_BUILTIN_LOCK)          += builtin-lock.o
+perf-$(CONFIG_BUILTIN_KVM)           += builtin-kvm.o
+perf-$(CONFIG_BUILTIN_INJECT)        += builtin-inject.o
+perf-$(CONFIG_BUILTIN_MEM)           += builtin-mem.o
+
+ifeq ($(CONFIG_AUDIT),y)
+perf-$(CONFIG_BUILTIN_TRACE)         += builtin-trace.o
+endif
+
+ifeq ($(CONFIG_LIBELF),y)
+perf-$(CONFIG_BUILTIN_PROBE)         += builtin-probe.o
+endif
 
 perf-y += bench/
-perf-y += tests/
+perf-$(CONFIG_BUILTIN_TEST) += tests/
 
 perf-y += perf.o
 
diff --git a/tools/perf/Makefile.build b/tools/perf/Makefile.build
index 54dc27e0acac..7c50b44e53f9 100644
--- a/tools/perf/Makefile.build
+++ b/tools/perf/Makefile.build
@@ -18,6 +18,9 @@ include Build.include
 # do not force detected configuration
 -include .config-detected
 
+# do not force user's configuration
+-include .config-user
+
 # Init all relevant variables used in build files so
 # 1) they have correct type
 # 2) they do not inherit any value from the environment
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 45d30b8f947e..8203777120cd 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -250,7 +250,10 @@ export INSTALL SHELL_PATH
 
 SHELL = $(SHELL_PATH)
 
-all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
+config_def:
+	@cp config.default .config-user
+
+all: config_def shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
 
 please_set_SHELL_PATH_to_a_more_modern_shell:
 	@$$(:)
@@ -554,5 +557,5 @@ FORCE:
 
 .PHONY: all install clean config-clean strip install-gtk
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
-.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep
+.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope FORCE single_dep config_def
 
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
new file mode 100644
index 000000000000..5ceb4b58cfdd
--- /dev/null
+++ b/tools/perf/builtin-cmds.h
@@ -0,0 +1,29 @@
+#ifndef BUILTIN_CMDS_H
+#define BUILTIN_CMDS_H
+
+#define CONFIG_BUILTIN_REPORT
+#define CONFIG_BUILTIN_SCRIPT
+#define CONFIG_BUILTIN_BENCH
+#define CONFIG_BUILTIN_SCHED
+#define CONFIG_BUILTIN_TRACE
+#define CONFIG_BUILTIN_TOP
+#define CONFIG_BUILTIN_RECORD
+#define CONFIG_BUILTIN_BUILDID_LIST
+#define CONFIG_BUILTIN_INJECT
+#define CONFIG_BUILTIN_LOCK
+#define CONFIG_BUILTIN_KVM
+#define CONFIG_BUILTIN_BUILDID_CACHE
+#define CONFIG_BUILTIN_EVLIST
+#define CONFIG_BUILTIN_KMEM
+#define CONFIG_BUILTIN_STAT
+#define CONFIG_BUILTIN_DIFF
+#define CONFIG_BUILTIN_ANNOTATE
+#define CONFIG_BUILTIN_TIMECHART
+#define CONFIG_BUILTIN_LIST
+#define CONFIG_BUILTIN_HELP
+#define CONFIG_BUILTIN_PROBE
+#define CONFIG_BUILTIN_MEM
+#define CONFIG_BUILTIN_TEST
+
+#endif /* BUILTIN_CMDS_H */
+
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 25d20628212e..2aa88a040bde 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -6,6 +6,7 @@
 #include "perf.h"
 #include "util/cache.h"
 #include "builtin.h"
+#include "builtin-cmds.h"
 #include "util/exec_cmd.h"
 #include "common-cmds.h"
 #include "util/parse-options.h"
diff --git a/tools/perf/config.default b/tools/perf/config.default
new file mode 100644
index 000000000000..2781af21b70b
--- /dev/null
+++ b/tools/perf/config.default
@@ -0,0 +1,23 @@
+CONFIG_BUILTIN_BENCH         := y
+CONFIG_BUILTIN_ANNOTATE      := y
+CONFIG_BUILTIN_DIFF          := y
+CONFIG_BUILTIN_EVLIST        := y
+CONFIG_BUILTIN_HELP          := y
+CONFIG_BUILTIN_SCHED         := y
+CONFIG_BUILTIN_BUILDID_LIST  := y
+CONFIG_BUILTIN_BUILDID_CACHE := y
+CONFIG_BUILTIN_LIST          := y
+CONFIG_BUILTIN_RECORD        := y
+CONFIG_BUILTIN_REPORT        := y
+CONFIG_BUILTIN_STAT          := y
+CONFIG_BUILTIN_TIMECHART     := y
+CONFIG_BUILTIN_TOP           := y
+CONFIG_BUILTIN_SCRIPT        := y
+CONFIG_BUILTIN_KMEM          := y
+CONFIG_BUILTIN_LOCK          := y
+CONFIG_BUILTIN_KVM           := y
+CONFIG_BUILTIN_INJECT        := y
+CONFIG_BUILTIN_MEM           := y
+CONFIG_BUILTIN_TRACE         := y
+CONFIG_BUILTIN_PROBE         := y
+CONFIG_BUILTIN_TEST          := y
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 3700a7faca6c..7c5ceff22d47 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -7,6 +7,7 @@
  * perf top, perf record, perf report, etc.) are started.
  */
 #include "builtin.h"
+#include "builtin-cmds.h"
 
 #include "util/exec_cmd.h"
 #include "util/cache.h"
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 36a885d2cd22..05ee30f724e0 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -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 HAVE_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 /* HAVE_LIBELF_SUPPORT */"
 echo "};"
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* [PATCH 30/30] perf tools: Disable test code
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (28 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 29/30] perf tools: Add support to configure builtin commands inclusion Jiri Olsa
@ 2015-01-02 15:36 ` Jiri Olsa
  2015-01-02 16:29   ` David Ahern
  2015-01-02 17:36 ` [RFC/PATCHSET 00/30] perf tools: New build framework Ingo Molnar
  30 siblings, 1 reply; 44+ messages in thread
From: Jiri Olsa @ 2015-01-02 15:36 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jiri Olsa, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

NOTE: hack

Forcing test objects not to be compiled into perf code.
This saves almost 1MB of perf binary size on my setup:

  # standard perf binary
  $ ls -l perf
  -rwxrwxr-x 1 jolsa jolsa 10283684 Jan  1 15:52 perf

  # current perf binary
  $ ls -l perf
  -rwxrwxr-x 1 jolsa jolsa 9303174 Jan  1 15:58 perf

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/perf/builtin-cmds.h | 2 +-
 tools/perf/config.default | 2 +-
 tools/perf/perf-sys.h     | 2 +-
 tools/perf/perf.c         | 4 ++++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
index 5ceb4b58cfdd..d0993b91932e 100644
--- a/tools/perf/builtin-cmds.h
+++ b/tools/perf/builtin-cmds.h
@@ -23,7 +23,7 @@
 #define CONFIG_BUILTIN_HELP
 #define CONFIG_BUILTIN_PROBE
 #define CONFIG_BUILTIN_MEM
-#define CONFIG_BUILTIN_TEST
+//#define CONFIG_BUILTIN_TEST
 
 #endif /* BUILTIN_CMDS_H */
 
diff --git a/tools/perf/config.default b/tools/perf/config.default
index 2781af21b70b..8a31a9d7b940 100644
--- a/tools/perf/config.default
+++ b/tools/perf/config.default
@@ -20,4 +20,4 @@ CONFIG_BUILTIN_INJECT        := y
 CONFIG_BUILTIN_MEM           := y
 CONFIG_BUILTIN_TRACE         := y
 CONFIG_BUILTIN_PROBE         := y
-CONFIG_BUILTIN_TEST          := y
+CONFIG_BUILTIN_TEST          := n
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
index a3b13d7dc1d4..48831388db1d 100644
--- a/tools/perf/perf-sys.h
+++ b/tools/perf/perf-sys.h
@@ -181,7 +181,7 @@ sys_perf_event_open(struct perf_event_attr *attr,
 	fd = syscall(__NR_perf_event_open, attr, pid, cpu,
 		     group_fd, flags);
 
-#ifdef HAVE_ATTR_TEST
+#if defined(CONFIG_BUILTIN_TEST) && defined(HAVE_ATTR_TEST)
 	if (unlikely(test_attr__enabled))
 		test_attr__open(attr, pid, cpu, fd, group_fd, flags);
 #endif
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 7c5ceff22d47..ef7c92cf9f25 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -57,7 +57,9 @@ static struct cmd_struct commands[] = {
 	{ "kmem",	cmd_kmem,	0 },
 	{ "lock",	cmd_lock,	0 },
 	{ "kvm",	cmd_kvm,	0 },
+#ifdef CONFIG_BUILTIN_TEST
 	{ "test",	cmd_test,	0 },
+#endif
 #ifdef HAVE_LIBAUDIT_SUPPORT
 	{ "trace",	cmd_trace,	0 },
 #endif
@@ -539,7 +541,9 @@ int main(int argc, const char **argv)
 	}
 	cmd = argv[0];
 
+#ifdef CONFIG_BUILTIN_TEST
 	test_attr__init();
+#endif
 
 	/*
 	 * We use PATH to find perf commands, but we prepend some higher
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 44+ messages in thread

* Re: [PATCH 30/30] perf tools: Disable test code
  2015-01-02 15:36 ` [PATCH 30/30] perf tools: Disable test code Jiri Olsa
@ 2015-01-02 16:29   ` David Ahern
  0 siblings, 0 replies; 44+ messages in thread
From: David Ahern @ 2015-01-02 16:29 UTC (permalink / raw)
  To: Jiri Olsa, linux-kernel
  Cc: Alexis Berlemont, Arnaldo Carvalho de Melo, Borislav Petkov,
	Corey Ashford, Frederic Weisbecker, Ingo Molnar, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Stephane Eranian

On 1/2/15 8:36 AM, Jiri Olsa wrote:
> NOTE: hack
>
> Forcing test objects not to be compiled into perf code.
> This saves almost 1MB of perf binary size on my setup:
>
>    # standard perf binary
>    $ ls -l perf
>    -rwxrwxr-x 1 jolsa jolsa 10283684 Jan  1 15:52 perf
>
>    # current perf binary
>    $ ls -l perf
>    -rwxrwxr-x 1 jolsa jolsa 9303174 Jan  1 15:58 perf

nice. I had done the same locally; never got around to pushing that 
patch upstream.

https://github.com/dsahern/linux/commit/20b85d1cbf5c46a5d9966bfcb7c0dbcb8f0cc8d0

David

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFC/PATCHSET 00/30] perf tools: New build framework
  2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
                   ` (29 preceding siblings ...)
  2015-01-02 15:36 ` [PATCH 30/30] perf tools: Disable test code Jiri Olsa
@ 2015-01-02 17:36 ` Ingo Molnar
  2015-01-04 15:49   ` Jiri Olsa
  30 siblings, 1 reply; 44+ messages in thread
From: Ingo Molnar @ 2015-01-02 17:36 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Adrian Hunter, Alexis Berlemont, Andi Kleen,
	Anton Blanchard, Arnaldo Carvalho de Melo, Borislav Petkov,
	Borislav Petkov, Cody P Schafer, Corey Ashford, David Ahern,
	Florian Fainelli, Frederic Weisbecker, Jean Pihet, Mark Salter,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Sam Ravnborg,
	Stephane Eranian, Sukadev Bhattiprolu, Will Deacon


* Jiri Olsa <jolsa@kernel.org> wrote:

> [...] The basic idea is the same as in kbuild system, with some 
> minor changes to allow for multiple binaries build definitions.

>  tools/perf/Build                                |  48 ++
>  tools/perf/Build.include                        |  75 ++++
>  tools/perf/Documentation/Build                  | 123 +++++
>  tools/perf/Makefile.build                       | 122 +++++
>  tools/perf/Makefile.perf                        | 566 +++---------------------

>  47 files changed, 827 insertions(+), 541 deletions(-)

Even the diffstat looks pretty good: only a modest line count 
increase.

It would be useful to put this (and other build features - such 
as features/parallelisation support) into tools/kbuild/ though, 
so that other tooling can make easy use of it as well. For 
example tools/kvm/ (an external project) started off with an 
earlier version of the perf build system.

Sharing that would make quite a bit of sense, as tooling (and 
most user-space project) build systems are usually have pretty 
poor quality.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [RFC/PATCHSET 00/30] perf tools: New build framework
  2015-01-02 17:36 ` [RFC/PATCHSET 00/30] perf tools: New build framework Ingo Molnar
@ 2015-01-04 15:49   ` Jiri Olsa
  0 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-04 15:49 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jiri Olsa, linux-kernel, Adrian Hunter, Alexis Berlemont,
	Andi Kleen, Anton Blanchard, Arnaldo Carvalho de Melo,
	Borislav Petkov, Borislav Petkov, Cody P Schafer, Corey Ashford,
	David Ahern, Florian Fainelli, Frederic Weisbecker, Jean Pihet,
	Mark Salter, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Sam Ravnborg, Stephane Eranian, Sukadev Bhattiprolu, Will Deacon

On Fri, Jan 02, 2015 at 06:36:12PM +0100, Ingo Molnar wrote:
> 
> * Jiri Olsa <jolsa@kernel.org> wrote:
> 
> > [...] The basic idea is the same as in kbuild system, with some 
> > minor changes to allow for multiple binaries build definitions.
> 
> >  tools/perf/Build                                |  48 ++
> >  tools/perf/Build.include                        |  75 ++++
> >  tools/perf/Documentation/Build                  | 123 +++++
> >  tools/perf/Makefile.build                       | 122 +++++
> >  tools/perf/Makefile.perf                        | 566 +++---------------------
> 
> >  47 files changed, 827 insertions(+), 541 deletions(-)
> 
> Even the diffstat looks pretty good: only a modest line count 
> increase.
> 
> It would be useful to put this (and other build features - such 
> as features/parallelisation support) into tools/kbuild/ though, 
> so that other tooling can make easy use of it as well. For 
> example tools/kvm/ (an external project) started off with an 
> earlier version of the perf build system.

right, I'll put it in tools/build.. looks like the tools/lib/*
could use it, probably others as well

thanks,
jirka

> 
> Sharing that would make quite a bit of sense, as tooling (and 
> most user-space project) build systems are usually have pretty 
> poor quality.
> 
> Thanks,
> 
> 	Ingo

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/30] perf tools: Add new build framework support
  2015-01-02 15:35 ` [PATCH 01/30] perf tools: Add new build framework support Jiri Olsa
@ 2015-01-05 10:57   ` Borislav Petkov
  2015-01-05 11:13     ` Jiri Olsa
  2015-01-08  6:18   ` Namhyung Kim
  1 sibling, 1 reply; 44+ messages in thread
From: Borislav Petkov @ 2015-01-05 10:57 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Corey Ashford, David Ahern, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian

On Fri, Jan 02, 2015 at 04:35:43PM +0100, Jiri Olsa wrote:
> +a) Build makefiles
> +------------------
> +User supplies 'Build' makefiles that contains objects summary,
> +like for example following 'krava/Build' file:
> +
> +  perf-y += a.o
> +  perf-y += b.o
> +
> +The build framework is triggered by:
> +  $ make -f Makefile.build dir=krava obj=perf
> +
> +which produces 'krava/perf-in.o' object file that has both
> +a.o and b.o objects compiled in linked together.
> +
> +The 'Build' makefile can contains multiple objects definitions
> +to allow building separated binaries, like:
> +
> +  perf-y += a.o
> +  perf-y += b.o
> +
> +  libperf-y += c.o
> +  libperf-y += d.o
> +
> +If the build framework is triggered by:
> +  $ make -f Makefile.build dir=krava obj=libperf
> +
> +it produces 'krava/libperf-in.o' object file that has both
> +a.o and b.o objects compiled in linked together.

Ok, question: you say those "Build" files are supplied by the user. Does
that mean that everyone has to go and write their own or are we still
using Kconfig and doing it in a more user-friendly manner?

I've probably missed this in the whole perf fastlane development... :)

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/30] perf tools: Add new build framework support
  2015-01-05 10:57   ` Borislav Petkov
@ 2015-01-05 11:13     ` Jiri Olsa
  2015-01-06 13:41       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 44+ messages in thread
From: Jiri Olsa @ 2015-01-05 11:13 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Jiri Olsa, linux-kernel, Alexis Berlemont,
	Arnaldo Carvalho de Melo, Corey Ashford, David Ahern,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian

On Mon, Jan 05, 2015 at 11:57:51AM +0100, Borislav Petkov wrote:
> On Fri, Jan 02, 2015 at 04:35:43PM +0100, Jiri Olsa wrote:
> > +a) Build makefiles
> > +------------------
> > +User supplies 'Build' makefiles that contains objects summary,
> > +like for example following 'krava/Build' file:
> > +
> > +  perf-y += a.o
> > +  perf-y += b.o
> > +
> > +The build framework is triggered by:
> > +  $ make -f Makefile.build dir=krava obj=perf
> > +
> > +which produces 'krava/perf-in.o' object file that has both
> > +a.o and b.o objects compiled in linked together.
> > +
> > +The 'Build' makefile can contains multiple objects definitions
> > +to allow building separated binaries, like:
> > +
> > +  perf-y += a.o
> > +  perf-y += b.o
> > +
> > +  libperf-y += c.o
> > +  libperf-y += d.o
> > +
> > +If the build framework is triggered by:
> > +  $ make -f Makefile.build dir=krava obj=libperf
> > +
> > +it produces 'krava/libperf-in.o' object file that has both
> > +a.o and b.o objects compiled in linked together.
> 
> Ok, question: you say those "Build" files are supplied by the user. Does
> that mean that everyone has to go and write their own or are we still
> using Kconfig and doing it in a more user-friendly manner?

there's no Kconfig involved in perf build at this moment..

the 'Build' Makefiles are equivalents of Kbuild/Makefile makefiles
within the kernel build system.. I just move the 'K' out

> 
> I've probably missed this in the whole perf fastlane development... :)

the reason for this switch is to have a first step towards
easy config support 'kernel Kconfig style like' in build

also with this change it's easier to see how the perf binary
is build and what flags were used for particular object..
at least for kernel developer used to kbuild ;-)

I also believe that the support to allow just part of the perf
code in perf binary will force the less spaghetti code ;-)

jirka

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/30] perf tools: Add new build framework support
  2015-01-05 11:13     ` Jiri Olsa
@ 2015-01-06 13:41       ` Arnaldo Carvalho de Melo
  2015-01-06 14:06         ` Jiri Olsa
  0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-01-06 13:41 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Borislav Petkov, Jiri Olsa, linux-kernel, Alexis Berlemont,
	Corey Ashford, David Ahern, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian

Em Mon, Jan 05, 2015 at 12:13:35PM +0100, Jiri Olsa escreveu:
> On Mon, Jan 05, 2015 at 11:57:51AM +0100, Borislav Petkov wrote:
> > On Fri, Jan 02, 2015 at 04:35:43PM +0100, Jiri Olsa wrote:
> > > +a) Build makefiles
> > > +------------------
> > > +User supplies 'Build' makefiles that contains objects summary,
> > > +like for example following 'krava/Build' file:
> > > +
> > > +  perf-y += a.o
> > > +  perf-y += b.o
> > > +
> > > +The build framework is triggered by:
> > > +  $ make -f Makefile.build dir=krava obj=perf
> > > +
> > > +which produces 'krava/perf-in.o' object file that has both
> > > +a.o and b.o objects compiled in linked together.
> > > +
> > > +The 'Build' makefile can contains multiple objects definitions
> > > +to allow building separated binaries, like:
> > > +
> > > +  perf-y += a.o
> > > +  perf-y += b.o
> > > +
> > > +  libperf-y += c.o
> > > +  libperf-y += d.o
> > > +
> > > +If the build framework is triggered by:
> > > +  $ make -f Makefile.build dir=krava obj=libperf
> > > +
> > > +it produces 'krava/libperf-in.o' object file that has both
> > > +a.o and b.o objects compiled in linked together.
> > 
> > Ok, question: you say those "Build" files are supplied by the user. Does
> > that mean that everyone has to go and write their own or are we still
> > using Kconfig and doing it in a more user-friendly manner?
> 
> there's no Kconfig involved in perf build at this moment..
> 
> the 'Build' Makefiles are equivalents of Kbuild/Makefile makefiles
> within the kernel build system.. I just move the 'K' out
> 
> > 
> > I've probably missed this in the whole perf fastlane development... :)
> 
> the reason for this switch is to have a first step towards
> easy config support 'kernel Kconfig style like' in build
> 
> also with this change it's easier to see how the perf binary
> is build and what flags were used for particular object..
> at least for kernel developer used to kbuild ;-)
> 
> I also believe that the support to allow just part of the perf
> code in perf binary will force the less spaghetti code ;-)

Right, making it possible for us to build a minimalistic perf will have
manifold good implications :-)

But perhaps we could continue calling it the same way as in the kernel?
I.e. we would then be using the "Kbuild" build configuration mechanism,
the K would be there just for historic reasons.

- Arnaldo

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/30] perf tools: Add new build framework support
  2015-01-06 13:41       ` Arnaldo Carvalho de Melo
@ 2015-01-06 14:06         ` Jiri Olsa
  0 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-06 14:06 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Borislav Petkov, Jiri Olsa, linux-kernel, Alexis Berlemont,
	Corey Ashford, David Ahern, Frederic Weisbecker, Ingo Molnar,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian

On Tue, Jan 06, 2015 at 11:41:08AM -0200, Arnaldo Carvalho de Melo wrote:

SNIP

> > the reason for this switch is to have a first step towards
> > easy config support 'kernel Kconfig style like' in build
> > 
> > also with this change it's easier to see how the perf binary
> > is build and what flags were used for particular object..
> > at least for kernel developer used to kbuild ;-)
> > 
> > I also believe that the support to allow just part of the perf
> > code in perf binary will force the less spaghetti code ;-)
> 
> Right, making it possible for us to build a minimalistic perf will have
> manifold good implications :-)
> 
> But perhaps we could continue calling it the same way as in the kernel?
> I.e. we would then be using the "Kbuild" build configuration mechanism,
> the K would be there just for historic reasons.

well, the main reason I used 'Build' instead of 'KBuild' was to
'say' that this is not Kbuild makefile.. because it's not ;-)

It's separated build framework with no dependency on KBuild
makefiles. I think the 'KBuild' name could mislead folks when
hunting things in perf build.

jirka

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/30] perf build: Add libperf objects building
  2015-01-02 15:35 ` [PATCH 07/30] perf build: Add libperf " Jiri Olsa
@ 2015-01-08  6:15   ` Namhyung Kim
  2015-01-08 14:45     ` Jiri Olsa
  0 siblings, 1 reply; 44+ messages in thread
From: Namhyung Kim @ 2015-01-08  6:15 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Paul Mackerras, Peter Zijlstra, Stephane Eranian

On Fri, Jan 02, 2015 at 04:35:49PM +0100, Jiri Olsa wrote:
> Move the util objects building under build framework.
> 
> Add new libperf build object so it's separated from
> the rest of the perf code and could be librarized.
>


[SNIP]
> +$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> +	@$(call echo-cmd,bison)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
                         ^^^^^
s/bison/flex/ ?


> +
> +$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
> +	@$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_

I guess we can simply use "-o $@" here.


> +
> +$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
> +	@$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
> +
> +$(OUTPUT)util/pmu-bison.c: util/pmu.y
> +	@$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_

Ditto.

Thanks,
Namhyung


> +
> +CFLAGS_parse-events-flex.o  += -w
> +CFLAGS_pmu-flex.o           += -w
> +CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
> +CFLAGS_pmu-bison.o          += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
> +
> +$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
> +$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
> +
> +CFLAGS_find_next_bit.o += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
> +CFLAGS_rbtree.o        += -Wno-unused-parameter -DETC_PERFCONFIG="BUILD_STR($(ETC_PERFCONFIG_SQ))"
> +CFLAGS_parse-events.o  += -Wno-redundant-decls
> +
> +$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c FORCE
> +	$(call if_changed_dep,cc_o_c)
> +
> +$(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c FORCE
> +	$(call if_changed_dep,cc_o_c)
> +
> +$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c FORCE
> +	$(call if_changed_dep,cc_o_c)
> -- 
> 1.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/30] perf tools: Add new build framework support
  2015-01-02 15:35 ` [PATCH 01/30] perf tools: Add new build framework support Jiri Olsa
  2015-01-05 10:57   ` Borislav Petkov
@ 2015-01-08  6:18   ` Namhyung Kim
  2015-01-08 14:45     ` Jiri Olsa
  1 sibling, 1 reply; 44+ messages in thread
From: Namhyung Kim @ 2015-01-08  6:18 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Paul Mackerras, Peter Zijlstra, Stephane Eranian

On Fri, Jan 02, 2015 at 04:35:43PM +0100, Jiri Olsa wrote:
> Adding new build framework. There's no change for actual
> building at this point, it comes in the next patches.
> 
> The idea and more details are explained in the
> 'Documentation/Build' file.


[SNIP]
> diff --git a/tools/perf/Documentation/Build b/tools/perf/Documentation/Build
> new file mode 100644
> index 000000000000..7008520600eb
> --- /dev/null
> +++ b/tools/perf/Documentation/Build
> @@ -0,0 +1,123 @@
> +
> +1) perf build
> +=============
> +The perf build process consists of several separated building blocks,
> +which are linked together to form the perf binary:
> +  - libperf library (static)
> +  - perf builtin commands
> +  - traceevent library (static)
> +  - GTK ui library

And libapikfs library (static) ?

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 29/30] perf tools: Add support to configure builtin commands inclusion
  2015-01-02 15:36 ` [PATCH 29/30] perf tools: Add support to configure builtin commands inclusion Jiri Olsa
@ 2015-01-08  7:15   ` Namhyung Kim
  2015-01-08 14:44     ` Jiri Olsa
  0 siblings, 1 reply; 44+ messages in thread
From: Namhyung Kim @ 2015-01-08  7:15 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Alexis Berlemont, Arnaldo Carvalho de Melo,
	Borislav Petkov, Corey Ashford, David Ahern, Frederic Weisbecker,
	Ingo Molnar, Paul Mackerras, Peter Zijlstra, Stephane Eranian

On Fri, Jan 02, 2015 at 04:36:11PM +0100, Jiri Olsa wrote:
> NOTE: hack
> 
> Adding support to configure builtin commands inclusion
> in the build, so we could later disable particular
> builtin command.
> 
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> Cc: Alexis Berlemont <alexis.berlemont@gmail.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: David Ahern <dsahern@gmail.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Stephane Eranian <eranian@google.com>
> ---
>  tools/perf/Build                    | 53 ++++++++++++++++++++-----------------
>  tools/perf/Makefile.build           |  3 +++
>  tools/perf/Makefile.perf            |  7 +++--
>  tools/perf/builtin-cmds.h           | 29 ++++++++++++++++++++
>  tools/perf/builtin-help.c           |  1 +
>  tools/perf/config.default           | 23 ++++++++++++++++
>  tools/perf/perf.c                   |  1 +
>  tools/perf/util/generate-cmdlist.sh | 10 +++++++
>  8 files changed, 101 insertions(+), 26 deletions(-)
>  create mode 100644 tools/perf/builtin-cmds.h
>  create mode 100644 tools/perf/config.default
> 
> diff --git a/tools/perf/Build b/tools/perf/Build
> index c95d6378ad65..8e8f2c58f2b0 100644
> --- a/tools/perf/Build
> +++ b/tools/perf/Build
> @@ -1,29 +1,34 @@
> -perf-y += builtin-bench.o
> -perf-y += builtin-annotate.o
> -perf-y += builtin-diff.o
> -perf-y += builtin-evlist.o
> -perf-y += builtin-help.o
> -perf-y += builtin-sched.o
> -perf-y += builtin-buildid-list.o
> -perf-y += builtin-buildid-cache.o
> -perf-y += builtin-list.o
> -perf-y += builtin-record.o
> -perf-y += builtin-report.o
> -perf-y += builtin-stat.o
> -perf-y += builtin-timechart.o
> -perf-y += builtin-top.o
> -perf-y += builtin-script.o
> -perf-y += builtin-kmem.o
> -perf-y += builtin-lock.o
> -perf-y += builtin-kvm.o
> -perf-y += builtin-inject.o
> -perf-y += builtin-mem.o
> -
> -perf-$(CONFIG_AUDIT) += builtin-trace.o
> -perf-$(CONFIG_LIBELF) += builtin-probe.o
> +perf-$(CONFIG_BUILTIN_BENCH)         += builtin-bench.o
> +perf-$(CONFIG_BUILTIN_ANNOTATE)      += builtin-annotate.o
> +perf-$(CONFIG_BUILTIN_DIFF)          += builtin-diff.o
> +perf-$(CONFIG_BUILTIN_EVLIST)        += builtin-evlist.o
> +perf-$(CONFIG_BUILTIN_HELP)          += builtin-help.o
> +perf-$(CONFIG_BUILTIN_SCHED)         += builtin-sched.o
> +perf-$(CONFIG_BUILTIN_BUILDID_LIST)  += builtin-buildid-list.o
> +perf-$(CONFIG_BUILTIN_BUILDID_CACHE) += builtin-buildid-cache.o
> +perf-$(CONFIG_BUILTIN_LIST)          += builtin-list.o
> +perf-$(CONFIG_BUILTIN_RECORD)        += builtin-record.o
> +perf-$(CONFIG_BUILTIN_REPORT)        += builtin-report.o
> +perf-$(CONFIG_BUILTIN_STAT)          += builtin-stat.o
> +perf-$(CONFIG_BUILTIN_TIMECHART)     += builtin-timechart.o
> +perf-$(CONFIG_BUILTIN_TOP)           += builtin-top.o
> +perf-$(CONFIG_BUILTIN_SCRIPT)        += builtin-script.o
> +perf-$(CONFIG_BUILTIN_KMEM)          += builtin-kmem.o
> +perf-$(CONFIG_BUILTIN_LOCK)          += builtin-lock.o
> +perf-$(CONFIG_BUILTIN_KVM)           += builtin-kvm.o
> +perf-$(CONFIG_BUILTIN_INJECT)        += builtin-inject.o
> +perf-$(CONFIG_BUILTIN_MEM)           += builtin-mem.o
> +
> +ifeq ($(CONFIG_AUDIT),y)
> +perf-$(CONFIG_BUILTIN_TRACE)         += builtin-trace.o
> +endif
> +
> +ifeq ($(CONFIG_LIBELF),y)
> +perf-$(CONFIG_BUILTIN_PROBE)         += builtin-probe.o
> +endif
>  
>  perf-y += bench/

I guess it also needs to be changed like below?

   perf-$(CONFIG_BUILTIN_BENCH) += bench/

Thanks,
Namhyung


> -perf-y += tests/
> +perf-$(CONFIG_BUILTIN_TEST) += tests/
>  
>  perf-y += perf.o

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 29/30] perf tools: Add support to configure builtin commands inclusion
  2015-01-08  7:15   ` Namhyung Kim
@ 2015-01-08 14:44     ` Jiri Olsa
  0 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-08 14:44 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Jiri Olsa, linux-kernel, Alexis Berlemont,
	Arnaldo Carvalho de Melo, Borislav Petkov, Corey Ashford,
	David Ahern, Frederic Weisbecker, Ingo Molnar, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian

On Thu, Jan 08, 2015 at 04:15:27PM +0900, Namhyung Kim wrote:

SNIP

> > +perf-$(CONFIG_BUILTIN_KVM)           += builtin-kvm.o
> > +perf-$(CONFIG_BUILTIN_INJECT)        += builtin-inject.o
> > +perf-$(CONFIG_BUILTIN_MEM)           += builtin-mem.o
> > +
> > +ifeq ($(CONFIG_AUDIT),y)
> > +perf-$(CONFIG_BUILTIN_TRACE)         += builtin-trace.o
> > +endif
> > +
> > +ifeq ($(CONFIG_LIBELF),y)
> > +perf-$(CONFIG_BUILTIN_PROBE)         += builtin-probe.o
> > +endif
> >  
> >  perf-y += bench/
> 
> I guess it also needs to be changed like below?
> 
>    perf-$(CONFIG_BUILTIN_BENCH) += bench/
> 

right, thanks

jirka

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 01/30] perf tools: Add new build framework support
  2015-01-08  6:18   ` Namhyung Kim
@ 2015-01-08 14:45     ` Jiri Olsa
  0 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-08 14:45 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Jiri Olsa, linux-kernel, Alexis Berlemont,
	Arnaldo Carvalho de Melo, Borislav Petkov, Corey Ashford,
	David Ahern, Frederic Weisbecker, Ingo Molnar, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian

On Thu, Jan 08, 2015 at 03:18:35PM +0900, Namhyung Kim wrote:
> On Fri, Jan 02, 2015 at 04:35:43PM +0100, Jiri Olsa wrote:
> > Adding new build framework. There's no change for actual
> > building at this point, it comes in the next patches.
> > 
> > The idea and more details are explained in the
> > 'Documentation/Build' file.
> 
> 
> [SNIP]
> > diff --git a/tools/perf/Documentation/Build b/tools/perf/Documentation/Build
> > new file mode 100644
> > index 000000000000..7008520600eb
> > --- /dev/null
> > +++ b/tools/perf/Documentation/Build
> > @@ -0,0 +1,123 @@
> > +
> > +1) perf build
> > +=============
> > +The perf build process consists of several separated building blocks,
> > +which are linked together to form the perf binary:
> > +  - libperf library (static)
> > +  - perf builtin commands
> > +  - traceevent library (static)
> > +  - GTK ui library
> 
> And libapikfs library (static) ?

yep, forgot to add that one.., thanks

jirka

^ permalink raw reply	[flat|nested] 44+ messages in thread

* Re: [PATCH 07/30] perf build: Add libperf objects building
  2015-01-08  6:15   ` Namhyung Kim
@ 2015-01-08 14:45     ` Jiri Olsa
  0 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-01-08 14:45 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Jiri Olsa, linux-kernel, Alexis Berlemont,
	Arnaldo Carvalho de Melo, Borislav Petkov, Corey Ashford,
	David Ahern, Frederic Weisbecker, Ingo Molnar, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian

On Thu, Jan 08, 2015 at 03:15:09PM +0900, Namhyung Kim wrote:
> On Fri, Jan 02, 2015 at 04:35:49PM +0100, Jiri Olsa wrote:
> > Move the util objects building under build framework.
> > 
> > Add new libperf build object so it's separated from
> > the rest of the perf code and could be librarized.
> >
> 
> 
> [SNIP]
> > +$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
> > +	@$(call echo-cmd,bison)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
>                          ^^^^^
> s/bison/flex/ ?

yes

> 
> 
> > +
> > +$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
> > +	@$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
> 
> I guess we can simply use "-o $@" here.

yes

> 
> 
> > +
> > +$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
> > +	@$(call echo-cmd,flex)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
> > +
> > +$(OUTPUT)util/pmu-bison.c: util/pmu.y
> > +	@$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
> 
> Ditto.

and yes ;-)

thanks,
jirka

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2015-01-08 14:46 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-02 15:35 [RFC/PATCHSET 00/30] perf tools: New build framework Jiri Olsa
2015-01-02 15:35 ` [PATCH 01/30] perf tools: Add new build framework support Jiri Olsa
2015-01-05 10:57   ` Borislav Petkov
2015-01-05 11:13     ` Jiri Olsa
2015-01-06 13:41       ` Arnaldo Carvalho de Melo
2015-01-06 14:06         ` Jiri Olsa
2015-01-08  6:18   ` Namhyung Kim
2015-01-08 14:45     ` Jiri Olsa
2015-01-02 15:35 ` [PATCH 02/30] perf build: Add detected config " Jiri Olsa
2015-01-02 15:35 ` [PATCH 03/30] perf build: Add subdir " Jiri Olsa
2015-01-02 15:35 ` [PATCH 04/30] perf build: Add bench objects building Jiri Olsa
2015-01-02 15:35 ` [PATCH 05/30] perf build: Add tests " Jiri Olsa
2015-01-02 15:35 ` [PATCH 06/30] perf build: Add builtin " Jiri Olsa
2015-01-02 15:35 ` [PATCH 07/30] perf build: Add libperf " Jiri Olsa
2015-01-08  6:15   ` Namhyung Kim
2015-01-08 14:45     ` Jiri Olsa
2015-01-02 15:35 ` [PATCH 08/30] perf build: Add probe " Jiri Olsa
2015-01-02 15:35 ` [PATCH 09/30] perf build: Add dwarf " Jiri Olsa
2015-01-02 15:35 ` [PATCH 10/30] perf build: Add dwarf unwind " Jiri Olsa
2015-01-02 15:35 ` [PATCH 11/30] perf build: Add ui " Jiri Olsa
2015-01-02 15:35 ` [PATCH 12/30] perf build: Add slang " Jiri Olsa
2015-01-02 15:35 ` [PATCH 13/30] perf build: Add gtk " Jiri Olsa
2015-01-02 15:35 ` [PATCH 14/30] perf build: Add scripts " Jiri Olsa
2015-01-02 15:35 ` [PATCH 15/30] perf build: Add perf regs " Jiri Olsa
2015-01-02 15:35 ` [PATCH 16/30] perf build: Add zlib " Jiri Olsa
2015-01-02 15:35 ` [PATCH 17/30] perf build: Add perf.o object building Jiri Olsa
2015-01-02 15:36 ` [PATCH 18/30] perf build: Add arch x86 objects building Jiri Olsa
2015-01-02 15:36 ` [PATCH 19/30] perf build: Add arch arm " Jiri Olsa
2015-01-02 15:36 ` [PATCH 20/30] perf build: Add arch arm64 " Jiri Olsa
2015-01-02 15:36 ` [PATCH 21/30] perf build: Add arch powerpc " Jiri Olsa
2015-01-02 15:36 ` [PATCH 22/30] perf build: Add arch s390 " Jiri Olsa
2015-01-02 15:36 ` [PATCH 23/30] perf build: Add arch sh " Jiri Olsa
2015-01-02 15:36 ` [PATCH 24/30] perf build: Add arch sparc " Jiri Olsa
2015-01-02 15:36 ` [PATCH 25/30] perf build: Add single target build framework support Jiri Olsa
2015-01-02 15:36 ` [PATCH 26/30] perf make: Remove directory dependency rules Jiri Olsa
2015-01-02 15:36 ` [PATCH 27/30] perf make: Remove uneeded variables Jiri Olsa
2015-01-02 15:36 ` [PATCH 28/30] perf make: Remove PERF-CFLAGS file Jiri Olsa
2015-01-02 15:36 ` [PATCH 29/30] perf tools: Add support to configure builtin commands inclusion Jiri Olsa
2015-01-08  7:15   ` Namhyung Kim
2015-01-08 14:44     ` Jiri Olsa
2015-01-02 15:36 ` [PATCH 30/30] perf tools: Disable test code Jiri Olsa
2015-01-02 16:29   ` David Ahern
2015-01-02 17:36 ` [RFC/PATCHSET 00/30] perf tools: New build framework Ingo Molnar
2015-01-04 15:49   ` Jiri Olsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.