LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCHv2 00/36] perf tools: New build framework
@ 2015-01-15 12:54 Jiri Olsa
  2015-01-15 12:54 ` [PATCH 01/36] tools build: Add new build support Jiri Olsa
                   ` (37 more replies)
  0 siblings, 38 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:54 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,
	S. Lockwood-Childs, Sam Ravnborg, Sasha Levin, Stephane Eranian,
	Steven Rostedt, Sukadev Bhattiprolu, Will Deacon

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

v2 changes:
  - build Makefiles librarized and moved to 'tools/build' [Ingo]
  - several minor fixies [Namhyung]
  - tested on other archs now - x86_64, i386, powerpc
  - moved tools/lib/* under new build framework to show
    that it's possible ;-)
    included traceevent/lockdep maintainers to get the feedback
  - omitted last 2 patches

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

All tests/make tests passed.

Any feedback from ARM guys would be great ;-)


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)

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

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: S. Lockwood-Childs <sjl@vctlabs.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Will Deacon <will.deacon@arm.com>
---
Jiri Olsa (36):
      tools build: Add new build support
      tools build: Add detected config support
      tools build: Add subdir support
      perf tools: Remove api fs object from python build
      perf build: Disable make's built-in rules and variables
      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 build: Remove directory dependency rules
      perf build: Remove uneeded variables
      perf build: Remove PERF-CFLAGS file
      perf build: Add build documentation
      tools lib api: Use tools build framework
      tools lib api: Rename libapikfs.a to libapi.a
      tools lib traceevent: Use tools build framework
      tools lib lockdep: Use tools build framework
      perf build: Display make commands on V=1

 tools/build/Build.include                       |  75 +++
 tools/build/Documentation/Build.txt             |  75 +++
 tools/build/Makefile.build                      | 122 +++++
 tools/lib/api/Build                             |   2 +
 tools/lib/api/Makefile                          |  57 +--
 tools/lib/api/fd/Build                          |   1 +
 tools/lib/api/fs/Build                          |   2 +
 tools/lib/lockdep/Build                         |   1 +
 tools/lib/lockdep/Makefile                      | 132 +-----
 tools/lib/traceevent/Build                      |  17 +
 tools/lib/traceevent/Makefile                   | 161 ++-----
 tools/perf/Build                                |  43 ++
 tools/perf/Documentation/Build.txt              |  49 ++
 tools/perf/MANIFEST                             |   1 +
 tools/perf/Makefile.perf                        | 600 +++---------------------
 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/config/Makefile                      |  44 ++
 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                          |  42 ++
 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/python-ext-sources              |   1 -
 tools/perf/util/scripting-engines/Build         |   6 +
 52 files changed, 875 insertions(+), 828 deletions(-)
 create mode 100644 tools/build/Build.include
 create mode 100644 tools/build/Documentation/Build.txt
 create mode 100644 tools/build/Makefile.build
 create mode 100644 tools/lib/api/Build
 create mode 100644 tools/lib/api/fd/Build
 create mode 100644 tools/lib/api/fs/Build
 create mode 100644 tools/lib/lockdep/Build
 create mode 100644 tools/lib/traceevent/Build
 create mode 100644 tools/perf/Build
 create mode 100644 tools/perf/Documentation/Build.txt
 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/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] 55+ messages in thread

* [PATCH 01/36] tools build: Add new build support
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
@ 2015-01-15 12:54 ` Jiri Olsa
  2015-01-15 12:54 ` [PATCH 02/36] tools build: Add detected config support Jiri Olsa
                   ` (36 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:54 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 into 'tools/build' to be used
by tools.

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
'tools/build/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/build/Build.include           | 75 ++++++++++++++++++++++++++++++
 tools/build/Documentation/Build.txt | 75 ++++++++++++++++++++++++++++++
 tools/build/Makefile.build          | 91 +++++++++++++++++++++++++++++++++++++
 tools/perf/MANIFEST                 |  1 +
 4 files changed, 242 insertions(+)
 create mode 100644 tools/build/Build.include
 create mode 100644 tools/build/Documentation/Build.txt
 create mode 100644 tools/build/Makefile.build

diff --git a/tools/build/Build.include b/tools/build/Build.include
new file mode 100644
index 000000000000..6a990b018e6d
--- /dev/null
+++ b/tools/build/Build.include
@@ -0,0 +1,75 @@
+###
+# 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
+# - 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) $(CFLAGS_$(obj))
diff --git a/tools/build/Documentation/Build.txt b/tools/build/Documentation/Build.txt
new file mode 100644
index 000000000000..8a11facc1838
--- /dev/null
+++ b/tools/build/Documentation/Build.txt
@@ -0,0 +1,75 @@
+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
diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
new file mode 100644
index 000000000000..afd2266e0935
--- /dev/null
+++ b/tools/build/Makefile.build
@@ -0,0 +1,91 @@
+###
+# 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
+
+build-dir := $(srctree)/tools/build
+
+# Generic definitions
+include $(build-dir)/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 $(build-dir)/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/MANIFEST b/tools/perf/MANIFEST
index 83e2887f91a3..6702c9f57fd6 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -1,5 +1,6 @@
 tools/perf
 tools/scripts
+tools/build
 tools/lib/traceevent
 tools/lib/api
 tools/lib/symbol/kallsyms.c
-- 
1.9.3


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

* [PATCH 02/36] tools build: Add detected config support
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
  2015-01-15 12:54 ` [PATCH 01/36] tools build: Add new build support Jiri Olsa
@ 2015-01-15 12:54 ` Jiri Olsa
  2015-01-15 15:50   ` David Ahern
  2015-01-15 12:54 ` [PATCH 03/36] tools build: Add subdir support Jiri Olsa
                   ` (35 subsequent siblings)
  37 siblings, 1 reply; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:54 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/build/Makefile.build | 3 +++
 tools/perf/config/Makefile | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index afd2266e0935..1706b93b0ef2 100644
--- a/tools/build/Makefile.build
+++ b/tools/build/Makefile.build
@@ -17,6 +17,9 @@ build-dir := $(srctree)/tools/build
 # Generic definitions
 include $(build-dir)/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/config/Makefile b/tools/perf/config/Makefile
index 648e31ff4021..bd60ca04d5da 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] 55+ messages in thread

* [PATCH 03/36] tools build: Add subdir support
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
  2015-01-15 12:54 ` [PATCH 01/36] tools build: Add new build support Jiri Olsa
  2015-01-15 12:54 ` [PATCH 02/36] tools build: Add detected config support Jiri Olsa
@ 2015-01-15 12:54 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 04/36] perf tools: Remove api fs object from python build Jiri Olsa
                   ` (34 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:54 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/build/Makefile.build | 7 +++++++
 1 file changed, 7 insertions(+)

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


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

* [PATCH 04/36] perf tools: Remove api fs object from python build
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (2 preceding siblings ...)
  2015-01-15 12:54 ` [PATCH 03/36] tools build: Add subdir support Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 05/36] perf build: Disable make's built-in rules and variables Jiri Olsa
                   ` (33 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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

It's already included in libapikfs.a library, which
is already used to link perf.so.

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/util/python-ext-sources | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index 16a475a7d492..601272145338 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -17,6 +17,5 @@ util/xyarray.c
 util/cgroup.c
 util/rblist.c
 util/strlist.c
-../lib/api/fs/fs.c
 util/trace-event.c
 ../../lib/rbtree.c
-- 
1.9.3


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

* [PATCH 05/36] perf build: Disable make's built-in rules and variables
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (3 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 04/36] perf tools: Remove api fs object from python build Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 16:01   ` David Ahern
  2015-01-15 12:55 ` [PATCH 06/36] perf build: Add bench objects building Jiri Olsa
                   ` (32 subsequent siblings)
  37 siblings, 1 reply; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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

We don't use any built-in rules and variables so we can
disable make's checks for that and build faster.

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 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 1f71a32aea78..dd49b40e203b 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -84,6 +84,10 @@ ifneq ($(OUTPUT),)
 #$(info Determined 'OUTPUT' to be $(OUTPUT))
 endif
 
+# 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)
 	@touch $(OUTPUT)PERF-VERSION-FILE
-- 
1.9.3


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

* [PATCH 06/36] perf build: Add bench objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (4 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 05/36] perf build: Disable make's built-in rules and variables Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 07/36] perf build: Add tests " Jiri Olsa
                   ` (31 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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   | 38 ++++++++++++++++----------------------
 tools/perf/bench/Build     | 11 +++++++++++
 tools/perf/config/Makefile |  2 ++
 4 files changed, 31 insertions(+), 22 deletions(-)
 create mode 100644 tools/perf/Build
 create mode 100644 tools/perf/bench/Build

diff --git a/tools/perf/Build b/tools/perf/Build
new file mode 100644
index 000000000000..9ea828de3fde
--- /dev/null
+++ 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 dd49b40e203b..8f50d0c45307 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -93,6 +93,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
 
@@ -462,21 +463,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 ($(ARCH), x86)
-ifeq ($(IS_64_BIT), 1)
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
-endif
-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
@@ -595,10 +581,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
@@ -625,14 +607,22 @@ 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 srctree OUTPUT RM CC LD CFLAGS V
+build := -f $(srctree)/tools/build/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)"' \
 		$(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) $<
@@ -984,6 +974,8 @@ 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
@@ -999,7 +991,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
 
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 bd60ca04d5da..1938432969ab 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] 55+ messages in thread

* [PATCH 07/36] perf build: Add tests objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (5 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 06/36] perf build: Add bench objects building Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 08/36] perf build: Add builtin " Jiri Olsa
                   ` (30 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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/Makefile.perf   | 55 ----------------------------------------------
 tools/perf/config/Makefile | 10 +++++++++
 tools/perf/tests/Build     | 42 +++++++++++++++++++++++++++++++++++
 4 files changed, 53 insertions(+), 55 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/Makefile.perf b/tools/perf/Makefile.perf
index 8f50d0c45307..01caaa9ca0d6 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -423,45 +423,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
@@ -481,7 +442,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)
@@ -523,7 +483,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
@@ -698,20 +657,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 1938432969ab..10a0ad839390 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_64_BIT}, 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..2de01a4b4084
--- /dev/null
+++ b/tools/perf/tests/Build
@@ -0,0 +1,42 @@
+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] 55+ messages in thread

* [PATCH 08/36] perf build: Add builtin objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (6 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 07/36] perf build: Add tests " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 09/36] perf build: Add libperf " Jiri Olsa
                   ` (29 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 01caaa9ca0d6..37f2257f03e6 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -423,26 +423,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)
 
@@ -484,10 +465,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
@@ -589,18 +566,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 10a0ad839390..e8723b4134f1 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] 55+ messages in thread

* [PATCH 09/36] perf build: Add libperf objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (7 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 08/36] perf build: Add builtin " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 10/36] perf build: Add probe " Jiri Olsa
                   ` (28 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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/build/Makefile.build |   3 +
 tools/perf/Build           |   3 +
 tools/perf/Makefile.perf   | 136 +++++----------------------------------------
 tools/perf/arch/Build      |   1 +
 tools/perf/config/Makefile |   5 ++
 tools/perf/util/Build      | 112 +++++++++++++++++++++++++++++++++++++
 6 files changed, 137 insertions(+), 123 deletions(-)
 create mode 100644 tools/perf/arch/Build
 create mode 100644 tools/perf/util/Build

diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index 459a3441de78..52911f616076 100644
--- a/tools/build/Makefile.build
+++ b/tools/build/Makefile.build
@@ -32,6 +32,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 = mkdir -p $(dir $@)
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.perf b/tools/perf/Makefile.perf
index 37f2257f03e6..fa8268ce4659 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -82,6 +82,11 @@ endif
 
 ifneq ($(OUTPUT),)
 #$(info Determined 'OUTPUT' to be $(OUTPUT))
+# 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
 
 # Do not use make's built-in rules and variables
@@ -211,21 +216,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
@@ -335,84 +325,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
@@ -421,8 +335,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)
@@ -545,7 +457,7 @@ strip: $(PROGRAMS) $(OUTPUT)perf
 
 PERF_IN := $(OUTPUT)perf-in.o
 
-export srctree OUTPUT RM CC LD CFLAGS V
+export srctree OUTPUT RM CC LD CFLAGS V BISON FLEX
 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
 $(PERF_IN): FORCE
@@ -599,12 +511,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
@@ -616,15 +522,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)"' $<
 
@@ -643,18 +540,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 $<
 
@@ -698,8 +583,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 e8723b4134f1..0b61ec2c667d 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,6 @@ 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)
+$(call detected_var,perfexecdir_SQ)
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
new file mode 100644
index 000000000000..2a50aabec8dc
--- /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,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
+	@$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -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 $@ -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] 55+ messages in thread

* [PATCH 10/36] perf build: Add probe objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (8 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 09/36] perf build: Add libperf " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 11/36] perf build: Add dwarf " Jiri Olsa
                   ` (27 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 fa8268ce4659..564d18806446 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -325,9 +325,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
@@ -335,8 +332,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"
@@ -349,19 +344,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 0b61ec2c667d..1a3720f2cdbb 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 2a50aabec8dc..65029041bc13 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] 55+ messages in thread

* [PATCH 11/36] perf build: Add dwarf objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (9 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 10/36] perf build: Add probe " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 12/36] perf build: Add dwarf unwind " Jiri Olsa
                   ` (26 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 564d18806446..d0df16556fe4 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -344,13 +344,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 1a3720f2cdbb..20f00b2effb9 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 65029041bc13..b21f67172983 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] 55+ messages in thread

* [PATCH 12/36] perf build: Add dwarf unwind objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (10 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 11/36] perf build: Add dwarf " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 13/36] perf build: Add ui " Jiri Olsa
                   ` (25 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 d0df16556fe4..a375f6912bf2 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -344,15 +344,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 20f00b2effb9..2b4b273cf804 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 b21f67172983..7a58ee437085 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] 55+ messages in thread

* [PATCH 13/36] perf build: Add ui objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (11 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 12/36] perf build: Add dwarf unwind " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 14/36] perf build: Add slang " Jiri Olsa
                   ` (24 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 a375f6912bf2..b08a939ae52c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -325,13 +325,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"
@@ -489,9 +482,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 2b4b273cf804..e7d1b46b7d31 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -838,3 +838,4 @@ $(call detected_var,mandir_SQ)
 $(call detected_var,ETC_PERFCONFIG_SQ)
 $(call detected_var,prefix_SQ)
 $(call detected_var,perfexecdir_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] 55+ messages in thread

* [PATCH 14/36] perf build: Add slang objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (12 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 13/36] perf build: Add ui " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 15/36] perf build: Add gtk " Jiri Olsa
                   ` (23 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 b08a939ae52c..66e0c930da9c 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -337,24 +337,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
 
@@ -482,21 +464,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 e7d1b46b7d31..4e5f080e2a22 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] 55+ messages in thread

* [PATCH 15/36] perf build: Add gtk objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (13 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 14/36] perf build: Add slang " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 16/36] perf build: Add scripts " Jiri Olsa
                   ` (22 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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/Makefile.perf   | 17 +++++------------
 tools/perf/config/Makefile |  1 +
 tools/perf/ui/gtk/Build    |  9 +++++++++
 4 files changed, 17 insertions(+), 12 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/Makefile.perf b/tools/perf/Makefile.perf
index 66e0c930da9c..3cea829f9a01 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -339,14 +339,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') \
@@ -414,10 +407,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
@@ -697,7 +690,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 4e5f080e2a22..05b6724fdb19 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -840,3 +840,4 @@ $(call detected_var,ETC_PERFCONFIG_SQ)
 $(call detected_var,prefix_SQ)
 $(call detected_var,perfexecdir_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] 55+ messages in thread

* [PATCH 16/36] perf build: Add scripts objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (14 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 15/36] perf build: Add gtk " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 17/36] perf build: Add perf regs " Jiri Olsa
                   ` (21 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 3cea829f9a01..766334c35d54 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -347,16 +347,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
@@ -457,18 +447,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 05b6724fdb19..fabc0cc874c2 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
@@ -841,3 +845,6 @@ $(call detected_var,prefix_SQ)
 $(call detected_var,perfexecdir_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 7a58ee437085..f11463be4506 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] 55+ messages in thread

* [PATCH 17/36] perf build: Add perf regs objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (15 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 16/36] perf build: Add scripts " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 18/36] perf build: Add zlib " Jiri Olsa
                   ` (20 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 766334c35d54..da57ee1d0518 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -347,13 +347,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 fabc0cc874c2..ab265dfdfa8b 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 f11463be4506..65ff4de61483 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] 55+ messages in thread

* [PATCH 18/36] perf build: Add zlib objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (16 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 17/36] perf build: Add perf regs " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 19/36] perf build: Add perf.o object building Jiri Olsa
                   ` (19 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 da57ee1d0518..6154384eb2ee 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -347,10 +347,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 ab265dfdfa8b..1f8851a7453b 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 65ff4de61483..1f6e88684e31 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] 55+ messages in thread

* [PATCH 19/36] perf build: Add perf.o object building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (17 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 18/36] perf build: Add zlib " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 20/36] perf build: Add arch x86 objects building Jiri Olsa
                   ` (18 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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..797bd633aced 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 6154384eb2ee..e58a321bf1c3 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -374,16 +374,11 @@ PERF_IN := $(OUTPUT)perf-in.o
 export srctree OUTPUT RM CC LD CFLAGS V BISON FLEX
 build := -f $(srctree)/tools/build/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
@@ -401,8 +396,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:
@@ -657,7 +651,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] 55+ messages in thread

* [PATCH 20/36] perf build: Add arch x86 objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (18 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 19/36] perf build: Add perf.o object building Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 21/36] perf build: Add arch arm " Jiri Olsa
                   ` (17 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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] 55+ messages in thread

* [PATCH 21/36] perf build: Add arch arm objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (19 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 20/36] perf build: Add arch x86 objects building Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 22/36] perf build: Add arch arm64 " Jiri Olsa
                   ` (16 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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] 55+ messages in thread

* [PATCH 22/36] perf build: Add arch arm64 objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (20 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 21/36] perf build: Add arch arm " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 23/36] perf build: Add arch powerpc " Jiri Olsa
                   ` (15 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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] 55+ messages in thread

* [PATCH 23/36] perf build: Add arch powerpc objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (21 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 22/36] perf build: Add arch arm64 " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 24/36] perf build: Add arch s390 " Jiri Olsa
                   ` (14 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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] 55+ messages in thread

* [PATCH 24/36] perf build: Add arch s390 objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (22 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 23/36] perf build: Add arch powerpc " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 25/36] perf build: Add arch sh " Jiri Olsa
                   ` (13 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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] 55+ messages in thread

* [PATCH 25/36] perf build: Add arch sh objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (23 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 24/36] perf build: Add arch s390 " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 26/36] perf build: Add arch sparc " Jiri Olsa
                   ` (12 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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] 55+ messages in thread

* [PATCH 26/36] perf build: Add arch sparc objects building
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (24 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 25/36] perf build: Add arch sh " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 27/36] perf build: Add single target build framework support Jiri Olsa
                   ` (11 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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] 55+ messages in thread

* [PATCH 27/36] perf build: Add single target build framework support
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (25 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 26/36] perf build: Add arch sparc " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 28/36] perf build: Remove directory dependency rules Jiri Olsa
                   ` (10 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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/build/Makefile.build | 20 +++++++++++++++++++-
 tools/perf/Makefile.perf   | 39 ++++++++++++++++++++++++++++-----------
 tools/perf/util/Build      |  7 +++++++
 3 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index 52911f616076..d35b66014992 100644
--- a/tools/build/Makefile.build
+++ b/tools/build/Makefile.build
@@ -44,6 +44,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 $@ $^
@@ -57,6 +63,18 @@ $(OUTPUT)%.o: %.S FORCE
 	$(call rule_mkdir)
 	$(call if_changed_dep,cc_o_c)
 
+$(OUTPUT)%.i: %.c FORCE
+	$(call rule_mkdir)
+	$(call if_changed_dep,cc_i_c)
+
+$(OUTPUT)%.i: %.S FORCE
+	$(call rule_mkdir)
+	$(call if_changed_dep,cc_i_c)
+
+$(OUTPUT)%.s: %.c FORCE
+	$(call rule_mkdir)
+	$(call if_changed_dep,cc_s_c)
+
 # Gather build data:
 #   obj-y        - list of build objects
 #   subdir-y     - list of directories to nest
@@ -94,7 +112,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 e58a321bf1c3..7cee1114a0e1 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -419,16 +419,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 $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%.i: %.c single_dep FORCE
+	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%.s: %.c single_dep FORCE
+	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%-bison.o: %.c single_dep FORCE
+	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%-flex.o: %.c single_dep FORCE
+	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%.o: %.S single_dep FORCE
+	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+
+$(OUTPUT)%.i: %.S single_dep FORCE
+	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
 
 $(OUTPUT)perf-%: %.o $(PERFLIBS)
 	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
@@ -673,5 +690,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 1f6e88684e31..fc7d47bf390f 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 rule_mkdir)
 	@$(call echo-cmd,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
+	$(call rule_mkdir)
 	@$(call echo-cmd,bison)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $@ -p parse_events_
 
 $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
+	$(call rule_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 rule_mkdir)
 	@$(call echo-cmd,bison)$(BISON) -v util/pmu.y -d -o $@ -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 rule_mkdir)
 	$(call if_changed_dep,cc_o_c)
 
 $(OUTPUT)util/find_next_bit.o: ../lib/util/find_next_bit.c FORCE
+	$(call rule_mkdir)
 	$(call if_changed_dep,cc_o_c)
 
 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c FORCE
+	$(call rule_mkdir)
 	$(call if_changed_dep,cc_o_c)
-- 
1.9.3


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

* [PATCH 28/36] perf build: Remove directory dependency rules
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (26 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 27/36] perf build: Add single target build framework support Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 29/36] perf build: Remove uneeded variables Jiri Olsa
                   ` (9 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 7cee1114a0e1..af3069d94c16 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -463,21 +463,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] 55+ messages in thread

* [PATCH 29/36] perf build: Remove uneeded variables
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (27 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 28/36] perf build: Remove directory dependency rules Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 30/36] perf build: Remove PERF-CFLAGS file Jiri Olsa
                   ` (8 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 af3069d94c16..e193e90b8454 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -137,10 +137,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 =
 
@@ -218,113 +214,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"
@@ -377,9 +266,8 @@ build := -f $(srctree)/tools/build/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
@@ -460,15 +348,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
@@ -653,7 +540,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] 55+ messages in thread

* [PATCH 30/36] perf build: Remove PERF-CFLAGS file
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (28 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 29/36] perf build: Remove uneeded variables Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 31/36] perf build: Add build documentation Jiri Olsa
                   ` (7 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 e193e90b8454..a763b17be982 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -365,7 +365,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:
@@ -444,17 +444,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.
@@ -544,7 +533,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)
 
@@ -562,5 +551,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] 55+ messages in thread

* [PATCH 31/36] perf build: Add build documentation
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (29 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 30/36] perf build: Remove PERF-CFLAGS file Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 32/36] tools lib api: Use tools build framework Jiri Olsa
                   ` (6 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 file describing the basics of perf build process.

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/Documentation/Build.txt | 49 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 tools/perf/Documentation/Build.txt

diff --git a/tools/perf/Documentation/Build.txt b/tools/perf/Documentation/Build.txt
new file mode 100644
index 000000000000..f6fc6507ba55
--- /dev/null
+++ b/tools/perf/Documentation/Build.txt
@@ -0,0 +1,49 @@
+
+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.
+
+  - tools/build/Makefile.build
+    main makefile of the build framework
+
+  - tools/build/Build.include
+    build framework generic definitions
+
+  - Build makefiles
+    makefiles that defines build objects
+
+Please refer to tools/build/Documentation/Build.txt for more
+information about build framework.
+
+
+2) 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 this description is omitting other libraries involved, only
+     focusing on build framework outcomes
-- 
1.9.3


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

* [PATCH 32/36] tools lib api: Use tools build framework
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (30 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 31/36] perf build: Add build documentation Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 33/36] tools lib api: Rename libapikfs.a to libapi.a Jiri Olsa
                   ` (5 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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 libapikfs library building under tools
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/lib/api/Build      |  2 ++
 tools/lib/api/Makefile   | 57 +++++++++++++++++++++---------------------------
 tools/lib/api/fd/Build   |  1 +
 tools/lib/api/fs/Build   |  2 ++
 tools/perf/Makefile.perf | 12 ++--------
 5 files changed, 32 insertions(+), 42 deletions(-)
 create mode 100644 tools/lib/api/Build
 create mode 100644 tools/lib/api/fd/Build
 create mode 100644 tools/lib/api/fs/Build

diff --git a/tools/lib/api/Build b/tools/lib/api/Build
new file mode 100644
index 000000000000..64dd8d466d2c
--- /dev/null
+++ b/tools/lib/api/Build
@@ -0,0 +1,2 @@
+libapikfs-y += fd/
+libapikfs-y += fs/
diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index 36c08b1f4afb..27cedb273cca 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -1,49 +1,42 @@
 include ../../scripts/Makefile.include
 include ../../perf/config/utilities.mak		# QUIET_CLEAN
 
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+#$(info Determined 'srctree' to be $(srctree))
+endif
+
 CC = $(CROSS_COMPILE)gcc
 AR = $(CROSS_COMPILE)ar
 
-# guard against environment variables
-LIB_H=
-LIB_OBJS=
-
-LIB_H += fs/debugfs.h
-LIB_H += fs/fs.h
-# See comment below about piggybacking...
-LIB_H += fd/array.h
-
-LIB_OBJS += $(OUTPUT)fs/debugfs.o
-LIB_OBJS += $(OUTPUT)fs/fs.o
-# XXX piggybacking here, need to introduce libapikfd, or rename this
-# to plain libapik.a and make it have it all api goodies
-LIB_OBJS += $(OUTPUT)fd/array.o
+MAKEFLAGS += --no-print-directory
 
-LIBFILE = libapikfs.a
+LIBFILE = $(OUTPUT)libapikfs.a
 
-CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
-EXTLIBS = -lelf -lpthread -lrt -lm
-ALL_CFLAGS = $(CFLAGS) $(BASIC_CFLAGS) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-ALL_LDFLAGS = $(LDFLAGS)
+CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
+CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 
 RM = rm -f
 
-$(LIBFILE): $(LIB_OBJS)
-	$(QUIET_AR)$(RM) $@ && $(AR) rcs $(OUTPUT)$@ $(LIB_OBJS)
+build  := -f $(srctree)/tools/build/Makefile.build dir=. obj
+API_IN := $(OUTPUT)libapikfs-in.o
 
-$(LIB_OBJS): $(LIB_H)
+export srctree OUTPUT CC LD CFLAGS V
 
-libapi_dirs:
-	$(QUIET_MKDIR)mkdir -p $(OUTPUT)fd $(OUTPUT)fs
+all: $(LIBFILE)
 
-$(OUTPUT)%.o: %.c libapi_dirs
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
-$(OUTPUT)%.s: %.c libapi_dirs
-	$(QUIET_CC)$(CC) -S $(ALL_CFLAGS) $<
-$(OUTPUT)%.o: %.S libapi_dirs
-	$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
+$(API_IN): FORCE
+	@$(MAKE) $(build)=libapikfs
+
+$(LIBFILE): $(API_IN)
+	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
 
 clean:
-	$(call QUIET_CLEAN, libapi) $(RM) $(LIB_OBJS) $(LIBFILE)
+	$(call QUIET_CLEAN, libapikfs) $(RM) $(LIBFILE); \
+	find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
+
+FORCE:
 
-.PHONY: clean
+.PHONY: clean FORCE
diff --git a/tools/lib/api/fd/Build b/tools/lib/api/fd/Build
new file mode 100644
index 000000000000..4ddcb0ff7f49
--- /dev/null
+++ b/tools/lib/api/fd/Build
@@ -0,0 +1 @@
+libapikfs-y += array.o
diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build
new file mode 100644
index 000000000000..de9c015794ff
--- /dev/null
+++ b/tools/lib/api/fs/Build
@@ -0,0 +1,2 @@
+libapikfs-y += fs.o
+libapikfs-y += debugfs.o
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a763b17be982..5b4d6df73f07 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -375,20 +375,12 @@ $(LIBTRACEEVENT)-clean:
 install-traceevent-plugins: $(LIBTRACEEVENT)
 	$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
 
-LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch] $(LIB_PATH)fd/*.[ch])
-
-# if subdir is set, we've been called from above so target has been built
-# already
-$(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
-ifeq ($(subdir),)
-	$(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
-endif
+$(LIBAPIKFS): FORCE
+	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapikfs.a
 
 $(LIBAPIKFS)-clean:
-ifeq ($(subdir),)
 	$(call QUIET_CLEAN, libapikfs)
 	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
-endif
 
 help:
 	@echo 'Perf make targets:'
-- 
1.9.3


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

* [PATCH 33/36] tools lib api: Rename libapikfs.a to libapi.a
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (31 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 32/36] tools lib api: Use tools build framework Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 34/36] tools lib traceevent: Use tools build framework Jiri Olsa
                   ` (4 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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

Renaming libapikfs.a to libapi.a, because it's not
just 'fs' specific library now.

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/lib/api/Build      | 4 ++--
 tools/lib/api/Makefile   | 8 ++++----
 tools/lib/api/fd/Build   | 2 +-
 tools/lib/api/fs/Build   | 4 ++--
 tools/perf/Makefile.perf | 6 +++---
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/lib/api/Build b/tools/lib/api/Build
index 64dd8d466d2c..3653965cf481 100644
--- a/tools/lib/api/Build
+++ b/tools/lib/api/Build
@@ -1,2 +1,2 @@
-libapikfs-y += fd/
-libapikfs-y += fs/
+libapi-y += fd/
+libapi-y += fs/
diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index 27cedb273cca..0785c380466c 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -13,7 +13,7 @@ AR = $(CROSS_COMPILE)ar
 
 MAKEFLAGS += --no-print-directory
 
-LIBFILE = $(OUTPUT)libapikfs.a
+LIBFILE = $(OUTPUT)libapi.a
 
 CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC
 CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
@@ -21,20 +21,20 @@ CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 RM = rm -f
 
 build  := -f $(srctree)/tools/build/Makefile.build dir=. obj
-API_IN := $(OUTPUT)libapikfs-in.o
+API_IN := $(OUTPUT)libapi-in.o
 
 export srctree OUTPUT CC LD CFLAGS V
 
 all: $(LIBFILE)
 
 $(API_IN): FORCE
-	@$(MAKE) $(build)=libapikfs
+	@$(MAKE) $(build)=libapi
 
 $(LIBFILE): $(API_IN)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(API_IN)
 
 clean:
-	$(call QUIET_CLEAN, libapikfs) $(RM) $(LIBFILE); \
+	$(call QUIET_CLEAN, libapi) $(RM) $(LIBFILE); \
 	find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
 
 FORCE:
diff --git a/tools/lib/api/fd/Build b/tools/lib/api/fd/Build
index 4ddcb0ff7f49..605d99f6d71a 100644
--- a/tools/lib/api/fd/Build
+++ b/tools/lib/api/fd/Build
@@ -1 +1 @@
-libapikfs-y += array.o
+libapi-y += array.o
diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build
index de9c015794ff..6090532359b7 100644
--- a/tools/lib/api/fs/Build
+++ b/tools/lib/api/fs/Build
@@ -1,2 +1,2 @@
-libapikfs-y += fs.o
-libapikfs-y += debugfs.o
+libapi-y += fs.o
+libapi-y += debugfs.o
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 5b4d6df73f07..0f2e021ffa1f 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -161,7 +161,7 @@ endif
 LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
 export LIBTRACEEVENT
 
-LIBAPIKFS = $(LIB_PATH)libapikfs.a
+LIBAPIKFS = $(LIB_PATH)libapi.a
 export LIBAPIKFS
 
 # python extension build directories
@@ -376,10 +376,10 @@ install-traceevent-plugins: $(LIBTRACEEVENT)
 	$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
 
 $(LIBAPIKFS): FORCE
-	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapikfs.a
+	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a
 
 $(LIBAPIKFS)-clean:
-	$(call QUIET_CLEAN, libapikfs)
+	$(call QUIET_CLEAN, libapi)
 	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
 
 help:
-- 
1.9.3


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

* [PATCH 34/36] tools lib traceevent: Use tools build framework
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (32 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 33/36] tools lib api: Rename libapikfs.a to libapi.a Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 35/36] tools lib lockdep: " Jiri Olsa
                   ` (3 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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, Steven Rostedt

Move the libtraceevent library building under tools
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>
Cc: Steven Rostedt <rostedt@goodmis.org>
---
 tools/lib/traceevent/Build    |  17 +++++
 tools/lib/traceevent/Makefile | 161 ++++++++++--------------------------------
 tools/perf/Makefile.perf      |  10 +--
 3 files changed, 59 insertions(+), 129 deletions(-)
 create mode 100644 tools/lib/traceevent/Build

diff --git a/tools/lib/traceevent/Build b/tools/lib/traceevent/Build
new file mode 100644
index 000000000000..c681d0575d16
--- /dev/null
+++ b/tools/lib/traceevent/Build
@@ -0,0 +1,17 @@
+libtraceevent-y += event-parse.o
+libtraceevent-y += event-plugin.o
+libtraceevent-y += trace-seq.o
+libtraceevent-y += parse-filter.o
+libtraceevent-y += parse-utils.o
+libtraceevent-y += kbuffer-parse.o
+
+plugin_jbd2-y         += plugin_jbd2.o
+plugin_hrtimer-y      += plugin_hrtimer.o
+plugin_kmem-y         += plugin_kmem.o
+plugin_kvm-y          += plugin_kvm.o
+plugin_mac80211-y     += plugin_mac80211.o
+plugin_sched_switch-y += plugin_sched_switch.o
+plugin_function-y     += plugin_function.o
+plugin_xen-y          += plugin_xen.o
+plugin_scsi-y         += plugin_scsi.o
+plugin_cfg80211-y     += plugin_cfg80211.o
diff --git a/tools/lib/traceevent/Makefile b/tools/lib/traceevent/Makefile
index 005c9cc06935..8c44ece033d9 100644
--- a/tools/lib/traceevent/Makefile
+++ b/tools/lib/traceevent/Makefile
@@ -67,7 +67,7 @@ PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
 PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
 endif
 
-include $(if $(BUILD_SRC),$(BUILD_SRC)/)../../scripts/Makefile.include
+include ../../scripts/Makefile.include
 
 # copy a bit from Linux kbuild
 
@@ -78,40 +78,13 @@ ifndef VERBOSE
   VERBOSE = 0
 endif
 
-ifeq ("$(origin O)", "command line")
-  BUILD_OUTPUT := $(O)
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+#$(info Determined 'srctree' to be $(srctree))
 endif
 
-ifeq ($(BUILD_SRC),)
-ifneq ($(OUTPUT),)
-
-define build_output
-  $(if $(VERBOSE:1=),@)+$(MAKE) -C $(OUTPUT) \
-  BUILD_SRC=$(CURDIR)/ -f $(CURDIR)/Makefile $1
-endef
-
-all: sub-make
-
-$(MAKECMDGOALS): sub-make
-
-sub-make: force
-	$(call build_output, $(MAKECMDGOALS))
-
-
-# Leave processing to above invocation of make
-skip-makefile := 1
-
-endif # OUTPUT
-endif # BUILD_SRC
-
-# We process the rest of the Makefile if this is the final invocation of make
-ifeq ($(skip-makefile),)
-
-srctree		:= $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR))
-objtree		:= $(CURDIR)
-src		:= $(srctree)
-obj		:= $(objtree)
-
 export prefix bindir src obj
 
 # Shell quotes
@@ -132,16 +105,15 @@ EXTRAVERSION	= $(EP_EXTRAVERSION)
 OBJ		= $@
 N		=
 
-export Q VERBOSE
-
 EVENT_PARSE_VERSION = $(EP_VERSION).$(EP_PATCHLEVEL).$(EP_EXTRAVERSION)
 
-INCLUDES = -I. -I $(srctree)/../../include $(CONFIG_INCLUDES)
+INCLUDES = -I. -I $(srctree)/tools/include $(CONFIG_INCLUDES)
 
 # Set compile option CFLAGS if not set elsewhere
 CFLAGS ?= -g -Wall
 
 # Append required CFLAGS
+override CFLAGS += -fPIC
 override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
 override CFLAGS += $(udis86-flags) -D_GNU_SOURCE
 
@@ -151,74 +123,58 @@ else
   Q = @
 endif
 
-do_compile_shared_library =			\
-	($(print_shared_lib_compile)		\
-	$(CC) --shared $^ -o $@)
-
-do_plugin_build =				\
-	($(print_plugin_build)			\
-	$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $<)
-
-do_build_static_lib =				\
-	($(print_static_lib_build)		\
-	$(RM) $@;  $(AR) rcs $@ $^)
-
-
-do_compile = $(QUIET_CC)$(CC) -c $(CFLAGS) $(EXT) $< -o $(obj)/$@;
-
-$(obj)/%.o: $(src)/%.c
-	$(call do_compile)
+# Disable command line variables (CFLAGS) overide from top
+# level Makefile (perf), otherwise build Makefile will get
+# the same command line setup.
+MAKEOVERRIDES=
 
-%.o: $(src)/%.c
-	$(call do_compile)
+export srctree OUTPUT CC LD CFLAGS V
+build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
-PEVENT_LIB_OBJS  = event-parse.o
-PEVENT_LIB_OBJS += event-plugin.o
-PEVENT_LIB_OBJS += trace-seq.o
-PEVENT_LIB_OBJS += parse-filter.o
-PEVENT_LIB_OBJS += parse-utils.o
-PEVENT_LIB_OBJS += kbuffer-parse.o
+PLUGINS  = plugin_jbd2.so
+PLUGINS += plugin_hrtimer.so
+PLUGINS += plugin_kmem.so
+PLUGINS += plugin_kvm.so
+PLUGINS += plugin_mac80211.so
+PLUGINS += plugin_sched_switch.so
+PLUGINS += plugin_function.so
+PLUGINS += plugin_xen.so
+PLUGINS += plugin_scsi.so
+PLUGINS += plugin_cfg80211.so
 
-PLUGIN_OBJS  = plugin_jbd2.o
-PLUGIN_OBJS += plugin_hrtimer.o
-PLUGIN_OBJS += plugin_kmem.o
-PLUGIN_OBJS += plugin_kvm.o
-PLUGIN_OBJS += plugin_mac80211.o
-PLUGIN_OBJS += plugin_sched_switch.o
-PLUGIN_OBJS += plugin_function.o
-PLUGIN_OBJS += plugin_xen.o
-PLUGIN_OBJS += plugin_scsi.o
-PLUGIN_OBJS += plugin_cfg80211.o
+PLUGINS    := $(addprefix $(OUTPUT),$(PLUGINS))
+PLUGINS_IN := $(PLUGINS:.so=-in.o)
 
-PLUGINS := $(PLUGIN_OBJS:.o=.so)
-
-ALL_OBJS = $(PEVENT_LIB_OBJS) $(PLUGIN_OBJS)
+TE_IN    := $(OUTPUT)libtraceevent-in.o
+LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
 
 CMD_TARGETS = $(LIB_FILE) $(PLUGINS)
 
 TARGETS = $(CMD_TARGETS)
 
-
 all: all_cmd
 
 all_cmd: $(CMD_TARGETS)
 
-libtraceevent.so: $(PEVENT_LIB_OBJS)
+$(TE_IN): force
+	$(Q)$(MAKE) $(build)=libtraceevent
+
+$(OUTPUT)libtraceevent.so: $(TE_IN)
 	$(QUIET_LINK)$(CC) --shared $^ -o $@
 
-libtraceevent.a: $(PEVENT_LIB_OBJS)
+$(OUTPUT)libtraceevent.a: $(TE_IN)
 	$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
 
 plugins: $(PLUGINS)
 
-$(PEVENT_LIB_OBJS): %.o: $(src)/%.c TRACEEVENT-CFLAGS
-	$(QUIET_CC_FPIC)$(CC) -c $(CFLAGS) $(EXT) -fPIC $< -o $@
+__plugin_obj = $(notdir $@)
+  plugin_obj = $(__plugin_obj:-in.o=)
 
-$(PLUGIN_OBJS): %.o : $(src)/%.c
-	$(QUIET_CC_FPIC)$(CC) -c $(CFLAGS) -fPIC -o $@ $<
+$(PLUGINS_IN): force
+	$(Q)$(MAKE) $(build)=$(plugin_obj)
 
-$(PLUGINS): %.so: %.o
-	$(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $<
+$(OUTPUT)%.so: $(OUTPUT)%-in.o
+	$(QUIET_LINK)$(CC) $(CFLAGS) -shared -nostartfiles -o $@ $^
 
 define make_version.h
   (echo '/* This file is automatically generated. Do not modify. */';		\
@@ -255,40 +211,6 @@ define update_dir
    fi);
 endef
 
-## make deps
-
-all_objs := $(sort $(ALL_OBJS))
-all_deps := $(all_objs:%.o=.%.d)
-
-# let .d file also depends on the source and header files
-define check_deps
-  @set -e; $(RM) $@; \
-  $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
-  sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
-  $(RM) $@.$$$$
-endef
-
-$(all_deps): .%.d: $(src)/%.c
-	$(Q)$(call check_deps)
-
-$(all_objs) : %.o : .%.d
-
-dep_includes := $(wildcard $(all_deps))
-
-ifneq ($(dep_includes),)
- include $(dep_includes)
-endif
-
-### Detect environment changes
-TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):$(ARCH):$(CROSS_COMPILE)
-
-TRACEEVENT-CFLAGS: force
-	@FLAGS='$(TRACK_CFLAGS)'; \
-	    if test x"$$FLAGS" != x"`cat TRACEEVENT-CFLAGS 2>/dev/null`" ; then \
-		echo 1>&2 "  FLAGS:   * new build flags or cross compiler"; \
-		echo "$$FLAGS" >TRACEEVENT-CFLAGS; \
-            fi
-
 tags:	force
 	$(RM) tags
 	find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
@@ -327,14 +249,9 @@ clean:
 		$(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d \
 		$(RM) TRACEEVENT-CFLAGS tags TAGS
 
-endif # skip-makefile
-
 PHONY += force plugins
 force:
 
-plugins:
-	@echo > /dev/null
-
 # Declare the contents of the .PHONY variable as phony.  We keep that
 # information in a variable so we can use it in if_changed and friends.
 .PHONY: $(PHONY)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 0f2e021ffa1f..6b6bef8a515a 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -358,22 +358,18 @@ $(LIBPERF_IN): FORCE
 $(LIB_FILE): $(LIBPERF_IN)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIB_OBJS)
 
-# libtraceevent.a
-TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch])
-
-LIBTRACEEVENT_FLAGS  = $(QUIET_SUBDIR1) O=$(OUTPUT)
 LIBTRACEEVENT_FLAGS += CFLAGS="-g -Wall $(EXTRA_CFLAGS)"
 LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
 
-$(LIBTRACEEVENT): $(TE_SOURCES)
-	$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) libtraceevent.a plugins
+$(LIBTRACEEVENT): FORCE
+	@$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a plugins
 
 $(LIBTRACEEVENT)-clean:
 	$(call QUIET_CLEAN, libtraceevent)
 	@$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null
 
 install-traceevent-plugins: $(LIBTRACEEVENT)
-	$(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
+	@$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins
 
 $(LIBAPIKFS): FORCE
 	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a
-- 
1.9.3


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

* [PATCH 35/36] tools lib lockdep: Use tools build framework
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (33 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 34/36] tools lib traceevent: Use tools build framework Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 12:55 ` [PATCH 36/36] perf build: Display make commands on V=1 Jiri Olsa
                   ` (2 subsequent siblings)
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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,
	S. Lockwood-Childs, Sasha Levin, Stephane Eranian

Move the lockdep library building under tools
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: S. Lockwood-Childs <sjl@vctlabs.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Stephane Eranian <eranian@google.com>
---
 tools/lib/lockdep/Build    |   1 +
 tools/lib/lockdep/Makefile | 132 ++++++++-------------------------------------
 2 files changed, 24 insertions(+), 109 deletions(-)
 create mode 100644 tools/lib/lockdep/Build

diff --git a/tools/lib/lockdep/Build b/tools/lib/lockdep/Build
new file mode 100644
index 000000000000..6f667355b068
--- /dev/null
+++ b/tools/lib/lockdep/Build
@@ -0,0 +1 @@
+liblockdep-y += common.o lockdep.o preload.o rbtree.o
diff --git a/tools/lib/lockdep/Makefile b/tools/lib/lockdep/Makefile
index 52f9279c6c13..8c3340a4b9f8 100644
--- a/tools/lib/lockdep/Makefile
+++ b/tools/lib/lockdep/Makefile
@@ -35,6 +35,10 @@ bindir = $(prefix)/$(bindir_relative)
 
 export DESTDIR DESTDIR_SQ INSTALL
 
+MAKEFLAGS += --no-print-directory
+
+include ../../scripts/Makefile.include
+
 # copy a bit from Linux kbuild
 
 ifeq ("$(origin V)", "command line")
@@ -44,56 +48,21 @@ ifndef VERBOSE
   VERBOSE = 0
 endif
 
-ifeq ("$(origin O)", "command line")
-  BUILD_OUTPUT := $(O)
+ifeq ($(srctree),)
+srctree := $(patsubst %/,%,$(dir $(shell pwd)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+srctree := $(patsubst %/,%,$(dir $(srctree)))
+#$(info Determined 'srctree' to be $(srctree))
 endif
 
-ifeq ($(BUILD_SRC),)
-ifneq ($(BUILD_OUTPUT),)
-
-define build_output
-	$(if $(VERBOSE:1=),@)$(MAKE) -C $(BUILD_OUTPUT)	\
-	BUILD_SRC=$(CURDIR) -f $(CURDIR)/Makefile $1
-endef
-
-saved-output := $(BUILD_OUTPUT)
-BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd)
-$(if $(BUILD_OUTPUT),, \
-     $(error output directory "$(saved-output)" does not exist))
-
-all: sub-make
-
-gui: force
-	$(call build_output, all_cmd)
-
-$(filter-out gui,$(MAKECMDGOALS)): sub-make
-
-sub-make: force
-	$(call build_output, $(MAKECMDGOALS))
-
-
-# Leave processing to above invocation of make
-skip-makefile := 1
-
-endif # BUILD_OUTPUT
-endif # BUILD_SRC
-
-# We process the rest of the Makefile if this is the final invocation of make
-ifeq ($(skip-makefile),)
-
-srctree		:= $(realpath $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR)))
-objtree		:= $(realpath $(CURDIR))
-src		:= $(srctree)
-obj		:= $(objtree)
-
-export prefix libdir bindir src obj
-
 # Shell quotes
 libdir_SQ = $(subst ','\'',$(libdir))
 bindir_SQ = $(subst ','\'',$(bindir))
 
-LIB_FILE = liblockdep.a liblockdep.so.$(LIBLOCKDEP_VERSION)
+LIB_IN := $(OUTPUT)liblockdep-in.o
+
 BIN_FILE = lockdep
+LIB_FILE = $(OUTPUT)liblockdep.a $(OUTPUT)liblockdep.so.$(LIBLOCKDEP_VERSION)
 
 CONFIG_INCLUDES =
 CONFIG_LIBS	=
@@ -108,33 +77,23 @@ INCLUDES = -I. -I/usr/local/include -I./uinclude -I./include -I../../include $(C
 
 # Set compile option CFLAGS if not set elsewhere
 CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g
+CFLAGS += -fPIC
 
 override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
 
 ifeq ($(VERBOSE),1)
   Q =
-  print_compile =
-  print_app_build =
-  print_fpic_compile =
   print_shared_lib_compile =
   print_install =
 else
   Q = @
-  print_compile =		echo '  CC                 '$(OBJ);
-  print_app_build =		echo '  BUILD              '$(OBJ);
-  print_fpic_compile =		echo '  CC FPIC            '$(OBJ);
-  print_shared_lib_compile =	echo '  BUILD SHARED LIB   '$(OBJ);
-  print_static_lib_build =	echo '  BUILD STATIC LIB   '$(OBJ);
-  print_install =		echo '  INSTALL     '$1'	to	$(DESTDIR_SQ)$2';
+  print_shared_lib_compile =	echo '  LD       '$(OBJ);
+  print_static_lib_build =	echo '  LD       '$(OBJ);
+  print_install =		echo '  INSTALL  '$1'	to	$(DESTDIR_SQ)$2';
 endif
 
-do_fpic_compile =					\
-	($(print_fpic_compile)				\
-	$(CC) -c $(CFLAGS) $(EXT) -fPIC $< -o $@)
-
-do_app_build =						\
-	($(print_app_build)				\
-	$(CC) $^ -rdynamic -o $@ $(CONFIG_LIBS) $(LIBS))
+export srctree OUTPUT CC LD CFLAGS V
+build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
 do_compile_shared_library =			\
 	($(print_shared_lib_compile)		\
@@ -144,22 +103,6 @@ do_build_static_lib =				\
 	($(print_static_lib_build)		\
 	$(RM) $@;  $(AR) rcs $@ $^)
 
-
-define do_compile
-	$(print_compile)						\
-	$(CC) -c $(CFLAGS) $(EXT) $< -o $(obj)/$@;
-endef
-
-$(obj)/%.o: $(src)/%.c
-	$(Q)$(call do_compile)
-
-%.o: $(src)/%.c
-	$(Q)$(call do_compile)
-
-PEVENT_LIB_OBJS = common.o lockdep.o preload.o rbtree.o
-
-ALL_OBJS = $(PEVENT_LIB_OBJS)
-
 CMD_TARGETS = $(LIB_FILE)
 
 TARGETS = $(CMD_TARGETS)
@@ -169,42 +112,15 @@ all: all_cmd
 
 all_cmd: $(CMD_TARGETS)
 
-liblockdep.so.$(LIBLOCKDEP_VERSION): $(PEVENT_LIB_OBJS)
+$(LIB_IN): force
+	$(Q)$(MAKE) $(build)=liblockdep
+
+liblockdep.so.$(LIBLOCKDEP_VERSION): $(LIB_IN)
 	$(Q)$(do_compile_shared_library)
 
-liblockdep.a: $(PEVENT_LIB_OBJS)
+liblockdep.a: $(LIB_IN)
 	$(Q)$(do_build_static_lib)
 
-$(PEVENT_LIB_OBJS): %.o: $(src)/%.c
-	$(Q)$(do_fpic_compile)
-
-## make deps
-
-all_objs := $(sort $(ALL_OBJS))
-all_deps := $(all_objs:%.o=.%.d)
-
-# let .d file also depends on the source and header files
-define check_deps
-		@set -e; $(RM) $@; \
-		$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
-		sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
-		$(RM) $@.$$$$
-endef
-
-$(all_deps): .%.d: $(src)/%.c
-	$(Q)$(call check_deps)
-
-$(all_objs) : %.o : .%.d
-
-dep_includes := $(wildcard $(all_deps))
-
-ifneq ($(dep_includes),)
- include $(dep_includes)
-endif
-
-### Detect environment changes
-TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):$(ARCH):$(CROSS_COMPILE)
-
 tags:	force
 	$(RM) tags
 	find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \
@@ -233,8 +149,6 @@ clean:
 	$(RM) *.o *~ $(TARGETS) *.a *liblockdep*.so* $(VERSION_FILES) .*.d
 	$(RM) tags TAGS
 
-endif # skip-makefile
-
 PHONY += force
 force:
 
-- 
1.9.3


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

* [PATCH 36/36] perf build: Display make commands on V=1
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (34 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 35/36] tools lib lockdep: " Jiri Olsa
@ 2015-01-15 12:55 ` Jiri Olsa
  2015-01-15 16:08 ` [PATCHv2 00/36] perf tools: New build framework David Ahern
  2015-01-16 11:39 ` Will Deacon
  37 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 12:55 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

Get more verbose output wrt displaying executed commands
from make.

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 | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 6b6bef8a515a..d5f1d3feea17 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -89,13 +89,19 @@ VPATH += $(OUTPUT)
 export VPATH
 endif
 
+ifeq ($(V),1)
+  Q =
+else
+  Q = @
+endif
+
 # 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)
-	@touch $(OUTPUT)PERF-VERSION-FILE
+	$(Q)$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
+	$(Q)touch $(OUTPUT)PERF-VERSION-FILE
 
 CC = $(CROSS_COMPILE)gcc
 LD = $(CROSS_COMPILE)ld
@@ -251,7 +257,7 @@ SHELL = $(SHELL_PATH)
 all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
 
 please_set_SHELL_PATH_to_a_more_modern_shell:
-	@$$(:)
+	$(Q)$$(:)
 
 shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
 
@@ -264,13 +270,13 @@ export srctree OUTPUT RM CC LD CFLAGS V BISON FLEX
 build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 
 $(PERF_IN): $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h FORCE
-	@$(MAKE) $(build)=perf
+	$(Q)$(MAKE) $(build)=perf
 
 $(OUTPUT)perf: $(PERFLIBS) $(PERF_IN)
 	$(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(PERF_IN) $(LIBS) -o $@
 
 $(GTK_IN): FORCE
-	@$(MAKE) $(build)=gtk
+	$(Q)$(MAKE) $(build)=gtk
 
 $(OUTPUT)libperf-gtk.so: $(GTK_IN) $(PERFLIBS)
 	$(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
@@ -315,25 +321,25 @@ 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 $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
 
 $(OUTPUT)%.i: %.c single_dep FORCE
-	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
 
 $(OUTPUT)%.s: %.c single_dep FORCE
-	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
 
 $(OUTPUT)%-bison.o: %.c single_dep FORCE
-	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
 
 $(OUTPUT)%-flex.o: %.c single_dep FORCE
-	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
 
 $(OUTPUT)%.o: %.S single_dep FORCE
-	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
 
 $(OUTPUT)%.i: %.S single_dep FORCE
-	@$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
+	$(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@
 
 $(OUTPUT)perf-%: %.o $(PERFLIBS)
 	$(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
@@ -353,7 +359,7 @@ $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h)
 LIBPERF_IN := $(OUTPUT)libperf-in.o
 
 $(LIBPERF_IN): FORCE
-	@$(MAKE) $(build)=libperf
+	$(Q)$(MAKE) $(build)=libperf
 
 $(LIB_FILE): $(LIBPERF_IN)
 	$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN) $(LIB_OBJS)
@@ -362,21 +368,21 @@ LIBTRACEEVENT_FLAGS += CFLAGS="-g -Wall $(EXTRA_CFLAGS)"
 LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
 
 $(LIBTRACEEVENT): FORCE
-	@$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a plugins
+	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) $(OUTPUT)libtraceevent.a plugins
 
 $(LIBTRACEEVENT)-clean:
 	$(call QUIET_CLEAN, libtraceevent)
-	@$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null
+	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null
 
 install-traceevent-plugins: $(LIBTRACEEVENT)
-	@$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins
+	$(Q)$(MAKE) -C $(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) O=$(OUTPUT) install_plugins
 
 $(LIBAPIKFS): FORCE
-	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a
+	$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) $(OUTPUT)libapi.a
 
 $(LIBAPIKFS)-clean:
 	$(call QUIET_CLEAN, libapi)
-	@$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
+	$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
 
 help:
 	@echo 'Perf make targets:'
@@ -514,12 +520,12 @@ $(INSTALL_DOC_TARGETS):
 #
 config-clean:
 	$(call QUIET_CLEAN, config)
-	@$(MAKE) -C config/feature-checks clean >/dev/null
+	$(Q)$(MAKE) -C config/feature-checks clean >/dev/null
 
 clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
 	$(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
+	$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o | xargs $(RM)
+	$(Q)$(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-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
-- 
1.9.3


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

* Re: [PATCH 02/36] tools build: Add detected config support
  2015-01-15 12:54 ` [PATCH 02/36] tools build: Add detected config support Jiri Olsa
@ 2015-01-15 15:50   ` David Ahern
  2015-01-15 16:21     ` Jiri Olsa
  0 siblings, 1 reply; 55+ messages in thread
From: David Ahern @ 2015-01-15 15:50 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/15/15 5:54 AM, Jiri Olsa wrote:
> 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.

So this file is similar to kernel's .config file and is generated based 
on today's autoprobing?


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

* Re: [PATCH 05/36] perf build: Disable make's built-in rules and variables
  2015-01-15 12:55 ` [PATCH 05/36] perf build: Disable make's built-in rules and variables Jiri Olsa
@ 2015-01-15 16:01   ` David Ahern
  2015-01-15 16:24     ` Jiri Olsa
  0 siblings, 1 reply; 55+ messages in thread
From: David Ahern @ 2015-01-15 16:01 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/15/15 5:55 AM, Jiri Olsa wrote:

> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 1f71a32aea78..dd49b40e203b 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -84,6 +84,10 @@ ifneq ($(OUTPUT),)
>   #$(info Determined 'OUTPUT' to be $(OUTPUT))
>   endif
>
> +# 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)
>   	@touch $(OUTPUT)PERF-VERSION-FILE

Does this depend on any prior patch? Was not obvious to me. Adding just 
this patch to a fresh build and it blows up.

$ vi Makefile.perf
- add line above
$ mkdir /tmp/junk2
$ make O=/tmp/junk2
...
  CC       /tmp/junk2/fs/debugfs.o
   CC       /tmp/junk2/fs/fs.o
   CC       /tmp/junk2/fd/array.o
/bin/sh: .event-parse.d: command not found
/bin/sh: .trace-seq.d: command not found
/bin/sh: .event-plugin.d: command not found
make[3]: *** [.event-parse.d] Error 127
make[3]: *** Waiting for unfinished jobs....
...

This is on a Fedora 16 host.

David

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (35 preceding siblings ...)
  2015-01-15 12:55 ` [PATCH 36/36] perf build: Display make commands on V=1 Jiri Olsa
@ 2015-01-15 16:08 ` David Ahern
  2015-01-15 16:31   ` Jiri Olsa
  2015-01-16 11:39 ` Will Deacon
  37 siblings, 1 reply; 55+ messages in thread
From: David Ahern @ 2015-01-15 16:08 UTC (permalink / raw)
  To: Jiri Olsa, linux-kernel
  Cc: Adrian Hunter, Alexis Berlemont, Andi Kleen, Anton Blanchard,
	Arnaldo Carvalho de Melo, Borislav Petkov, Borislav Petkov,
	Cody P Schafer, Corey Ashford, Florian Fainelli,
	Frederic Weisbecker, Ingo Molnar, Jean Pihet, Mark Salter,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, S. Lockwood-Childs,
	Sam Ravnborg, Sasha Levin, Stephane Eranian, Steven Rostedt,
	Sukadev Bhattiprolu, Will Deacon

On 1/15/15 5:54 AM, Jiri Olsa wrote:
> 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/
>    ...
>

It is not obvious to me how this works. Users provide a .config file for 
building perf? Or do users provide Build files like you state above? If 
it is a .config file then what if a .config file is not present is it 
auto generated using the current autoprobing?

David


> 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)
>



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

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

On Thu, Jan 15, 2015 at 08:50:40AM -0700, David Ahern wrote:
> On 1/15/15 5:54 AM, Jiri Olsa wrote:
> >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.
> 
> So this file is similar to kernel's .config file and is generated based on
> today's autoprobing?
> 

yep, it's the way to pass detected data/variables from perf detection
system (config/Makefile) to the build framework, it get's generated
every build

the plan is to have '.config' in the future that will gather user's
configuration

jirka

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

* Re: [PATCH 05/36] perf build: Disable make's built-in rules and variables
  2015-01-15 16:01   ` David Ahern
@ 2015-01-15 16:24     ` Jiri Olsa
  0 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 16:24 UTC (permalink / raw)
  To: David Ahern
  Cc: Jiri Olsa, linux-kernel, Alexis Berlemont,
	Arnaldo Carvalho de Melo, Borislav Petkov, Corey Ashford,
	Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian

On Thu, Jan 15, 2015 at 09:01:05AM -0700, David Ahern wrote:
> On 1/15/15 5:55 AM, Jiri Olsa wrote:
> 
> >diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> >index 1f71a32aea78..dd49b40e203b 100644
> >--- a/tools/perf/Makefile.perf
> >+++ b/tools/perf/Makefile.perf
> >@@ -84,6 +84,10 @@ ifneq ($(OUTPUT),)
> >  #$(info Determined 'OUTPUT' to be $(OUTPUT))
> >  endif
> >
> >+# 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)
> >  	@touch $(OUTPUT)PERF-VERSION-FILE
> 
> Does this depend on any prior patch? Was not obvious to me. Adding just this
> patch to a fresh build and it blows up.
> 
> $ vi Makefile.perf
> - add line above
> $ mkdir /tmp/junk2
> $ make O=/tmp/junk2
> ...
>  CC       /tmp/junk2/fs/debugfs.o
>   CC       /tmp/junk2/fs/fs.o
>   CC       /tmp/junk2/fd/array.o
> /bin/sh: .event-parse.d: command not found
> /bin/sh: .trace-seq.d: command not found
> /bin/sh: .event-plugin.d: command not found
> make[3]: *** [.event-parse.d] Error 127
> make[3]: *** Waiting for unfinished jobs....
> ...
> 
> This is on a Fedora 16 host.

oops, I've cut it out of the framework changes to make
it simpler, but looks like traceevent library depends
on builtin rules, I'll check..

thanks,
jirka

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-15 16:08 ` [PATCHv2 00/36] perf tools: New build framework David Ahern
@ 2015-01-15 16:31   ` Jiri Olsa
  0 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-15 16:31 UTC (permalink / raw)
  To: David Ahern
  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,
	Florian Fainelli, Frederic Weisbecker, Ingo Molnar, Jean Pihet,
	Mark Salter, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	S. Lockwood-Childs, Sam Ravnborg, Sasha Levin, Stephane Eranian,
	Steven Rostedt, Sukadev Bhattiprolu, Will Deacon

On Thu, Jan 15, 2015 at 09:08:00AM -0700, David Ahern wrote:
> On 1/15/15 5:54 AM, Jiri Olsa wrote:
> >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/
> >   ...
> >
> 
> It is not obvious to me how this works. Users provide a .config file for
> building perf? Or do users provide Build files like you state above? If it
> is a .config file then what if a .config file is not present is it auto
> generated using the current autoprobing?

so far users provide 'Build' files, which defines list of objects
to be built for specific outputs, like following Build file:

---
perf-y += perf.o
perf-y += builtin-bench.o

libperf-y += util/
---

means that build framework's output will be 2 files:

  - 'perf-in.o'    that contains (links) perf.o and builtin-bench.o objects
  - 'libperf-in.o' that contains (links) whatever is defined under 'util/'


also user can provide '.config-detected' file that will get included
into the Makefile.build to get the environment changed and refer to it
in the 'Build' files

I'll update docs with more details..

jirka

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
                   ` (36 preceding siblings ...)
  2015-01-15 16:08 ` [PATCHv2 00/36] perf tools: New build framework David Ahern
@ 2015-01-16 11:39 ` Will Deacon
  2015-01-16 12:12   ` Mark Rutland
  37 siblings, 1 reply; 55+ messages in thread
From: Will Deacon @ 2015-01-16 11:39 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, Ingo Molnar, Jean Pihet,
	msalter, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	S. Lockwood-Childs, Sam Ravnborg, Sasha Levin, Stephane Eranian,
	Steven Rostedt, Sukadev Bhattiprolu, mark.rutland

On Thu, Jan 15, 2015 at 12:54:56PM +0000, Jiri Olsa wrote:
> hi,
> I'm following up on latest post from Alexis:
>   http://marc.info/?l=linux-kernel&m=141427580405357&w=2
> 
> v2 changes:
>   - build Makefiles librarized and moved to 'tools/build' [Ingo]
>   - several minor fixies [Namhyung]
>   - tested on other archs now - x86_64, i386, powerpc
>   - moved tools/lib/* under new build framework to show
>     that it's possible ;-)
>     included traceevent/lockdep maintainers to get the feedback
>   - omitted last 2 patches
> 
> The patchset is also available in:
>   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
>   perf/build
> 
> All tests/make tests passed.
> 
> Any feedback from ARM guys would be great ;-)

[adding Mark Rutland to Cc]

I'll try and take this for a spin on some arm64 hardware too.

Will

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-16 11:39 ` Will Deacon
@ 2015-01-16 12:12   ` Mark Rutland
  2015-01-16 12:22     ` Will Deacon
  2015-01-16 12:29     ` Jiri Olsa
  0 siblings, 2 replies; 55+ messages in thread
From: Mark Rutland @ 2015-01-16 12:12 UTC (permalink / raw)
  To: Will Deacon
  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, Ingo Molnar,
	Jean Pihet, msalter, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, S. Lockwood-Childs, Sam Ravnborg, Sasha Levin,
	Stephane Eranian, Steven Rostedt, Sukadev Bhattiprolu

On Fri, Jan 16, 2015 at 11:39:22AM +0000, Will Deacon wrote:
> On Thu, Jan 15, 2015 at 12:54:56PM +0000, Jiri Olsa wrote:
> > hi,
> > I'm following up on latest post from Alexis:
> >   http://marc.info/?l=linux-kernel&m=141427580405357&w=2
> > 
> > v2 changes:
> >   - build Makefiles librarized and moved to 'tools/build' [Ingo]
> >   - several minor fixies [Namhyung]
> >   - tested on other archs now - x86_64, i386, powerpc
> >   - moved tools/lib/* under new build framework to show
> >     that it's possible ;-)
> >     included traceevent/lockdep maintainers to get the feedback
> >   - omitted last 2 patches
> > 
> > The patchset is also available in:
> >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> >   perf/build
> > 
> > All tests/make tests passed.
> > 
> > Any feedback from ARM guys would be great ;-)
> 
> [adding Mark Rutland to Cc]

Cheers.

I just tried a cross-build for arm, and that blew up when trying to do
something with arch/arm/util/libperf-in.o (log below). I bisected that
to f169fbc4c59dd9d4 "perf build: Add arch x86 objects building". I'm
looking into why now.

Thanks,
Mark.

[mark@leverpostej:~/src/linux/tools/perf]% make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
  BUILD:   Doing 'make -j8' parallel build
config/Makefile:341: No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev
config/Makefile:417: Disabling post unwind, no support found.
config/Makefile:458: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:473: slang not found, disables TUI support. Please install slang-devel or libslang-dev
config/Makefile:487: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
config/Makefile:515: Missing perl devel files. Disabling perl scripting support, consider installing perl-ExtUtils-Embed
config/Makefile:560: No Python.h (for Python 2.x) was found
config/Makefile:560: Python support will not be built
config/Makefile:653: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev

Auto-detecting system features:
...                         dwarf: [ OFF ]
...                         glibc: [ on  ]
...                          gtk2: [ OFF ]
...                      libaudit: [ OFF ]
...                        libbfd: [ OFF ]
...                        libelf: [ OFF ]
...                       libnuma: [ OFF ]
...                       libperl: [ OFF ]
...                     libpython: [ OFF ]
...                      libslang: [ OFF ]
...                     libunwind: [ OFF ]
...            libdw-dwarf-unwind: [ OFF ]
...                          zlib: [ OFF ]

  CC       arch/common.o
  CC       util/alias.o
  CC       util/abspath.o
  CC       ui/setup.o
  CC       event-parse.o
  CC       fd/array.o
  LD       arch/arm/libperf-in.o
arm-linux-gnueabihf-ld: cannot find arch/arm/util/libperf-in.o: No such file or directory
make[4]: *** [arch/arm/libperf-in.o] Error 1
make[3]: *** [arm] Error 2
make[3]: *** Waiting for unfinished jobs....
  GEN      common-cmds.h
  LD       fd/libapi-in.o
  CC       fs/fs.o
  CC       fs/debugfs.o
  CC       util/annotate.o
  CC       ui/helpline.o
  CC       ui/progress.o
  CC       ui/util.o
  LD       fs/libapi-in.o
  LD       libapi-in.o
  AR       libapi.a
  CC       ui/hist.o
make[2]: *** [arch] Error 2
make[2]: *** Waiting for unfinished jobs....
  CC       ui/stdio/hist.o
  CC       plugin_jbd2.o
  PERF_VERSION = 3.19.rc2.gcdb397
  CC       plugin_hrtimer.o
  CC       plugin_kmem.o
  LD       plugin_jbd2-in.o
  CC       plugin_kvm.o
  LD       plugin_hrtimer-in.o
  CC       plugin_mac80211.o
  CC       event-plugin.o
  LD       plugin_kmem-in.o
  CC       trace-seq.o
  LD       plugin_mac80211-in.o
  LD       plugin_kvm-in.o
  CC       parse-filter.o
  CC       plugin_sched_switch.o
  CC       parse-utils.o
  CC       kbuffer-parse.o
  CC       plugin_function.o
  LD       plugin_sched_switch-in.o
  CC       plugin_xen.o
  CC       plugin_scsi.o
  LD       plugin_xen-in.o
  LD       plugin_function-in.o
  CC       plugin_cfg80211.o
  LINK     plugin_jbd2.so
  LINK     plugin_hrtimer.so
  LINK     plugin_kmem.so
  LINK     plugin_kvm.so
  LD       plugin_cfg80211-in.o
  CC       builtin-bench.o
  LD       plugin_scsi-in.o
  LINK     plugin_mac80211.so
  LINK     plugin_sched_switch.so
  CC       builtin-annotate.o
  LD       libtraceevent-in.o
  LINK     plugin_function.so
  LINK     plugin_xen.so
  LINK     plugin_scsi.so
  LINK     plugin_cfg80211.so
  CC       util/build-id.o
  CC       util/config.o
  LINK     libtraceevent.a
  GEN      perf-archive
  GEN      perf-with-kcore
  CC       util/ctype.o
  CC       builtin-diff.o
  CC       util/db-export.o
  CC       util/environment.o
  CC       builtin-evlist.o
  CC       util/event.o
  CC       util/evlist.o
  CC       util/evsel.o
  CC       util/exec_cmd.o
  CC       builtin-help.o
  CC       util/find_next_bit.o
  CC       builtin-sched.o
  CC       util/help.o
  CC       builtin-buildid-list.o
  CC       builtin-buildid-cache.o
  CC       util/kallsyms.o
  CC       builtin-list.o
  CC       util/levenshtein.o
  CC       util/parse-options.o
  LD       ui/libperf-in.o
  BISON    util/parse-events-bison.c
  CC       builtin-record.o
  CC       builtin-report.o
  CC       util/path.o
  CC       util/rbtree.o
  CC       util/bitmap.o
  CC       util/hweight.o
  CC       util/run-command.o
  CC       util/quote.o
  CC       builtin-stat.o
  CC       util/strbuf.o
  CC       builtin-timechart.o
  CC       builtin-top.o
  CC       util/string.o
  CC       util/strlist.o
  CC       builtin-script.o
  CC       builtin-kmem.o
  CC       util/strfilter.o
  CC       util/top.o
  CC       builtin-lock.o
  CC       util/usage.o
  CC       util/wrapper.o
  CC       util/sigchain.o
  CC       builtin-kvm.o
  CC       util/dso.o
  CC       util/symbol.o
  CC       util/color.o
  CC       builtin-inject.o
  CC       util/pager.o
  CC       util/header.o
  CC       builtin-mem.o
  CC       util/callchain.o
  CC       bench/sched-messaging.o
  CC       bench/sched-pipe.o
  CC       util/values.o
  CC       util/debug.o
  CC       util/machine.o
  CC       tests/builtin-test.o
  CC       bench/mem-memcpy.o
  CC       util/map.o
  CC       util/pstack.o
  CC       tests/parse-events.o
  CC       bench/futex-hash.o
  CC       perf.o
  CC       util/session.o
  CC       bench/futex-wake.o
  CC       util/ordered-events.o
  CC       bench/futex-requeue.o
  CC       tests/dso-data.o
  CC       tests/attr.o
  CC       util/comm.o
  CC       util/thread.o
  LD       bench/perf-in.o
  CC       util/thread_map.o
  CC       util/trace-event-parse.o
  CC       tests/vmlinux-kallsyms.o
  CC       tests/open-syscall.o
  CC       tests/open-syscall-all-cpus.o
  CC       util/parse-events-bison.o
  BISON    util/pmu-bison.c
  CC       util/trace-event-read.o
  CC       tests/open-syscall-tp-fields.o
  CC       util/trace-event-info.o
  CC       util/trace-event-scripting.o
  CC       util/trace-event.o
  CC       util/svghelper.o
  CC       tests/mmap-basic.o
  CC       util/sort.o
  CC       util/hist.o
  CC       util/util.o
  CC       util/xyarray.o
  CC       tests/perf-record.o
  CC       util/cpumap.o
  CC       tests/rdpmc.o
  CC       util/cgroup.o
  CC       util/target.o
  CC       tests/evsel-roundtrip-name.o
  CC       tests/evsel-tp-sched.o
  CC       util/rblist.o
  CC       util/intlist.o
  CC       util/vdso.o
  CC       tests/fdarray.o
  CC       util/stat.o
  CC       util/record.o
  CC       util/srcline.o
  CC       tests/pmu.o
  CC       util/data.o
  CC       util/tsc.o
  CC       util/cloexec.o
  CC       util/thread-stack.o
  CC       tests/hists_common.o
  CC       util/symbol-minimal.o
  CC       util/perf_regs.o
  FLEX     util/parse-events-flex.c
  CC       tests/hists_link.o
  FLEX     util/pmu-flex.c
  CC       util/pmu-bison.o
  CC       util/parse-events.o
  CC       util/parse-events-flex.o
  CC       util/pmu.o
  CC       tests/hists_filter.o
  CC       util/pmu-flex.o
  CC       tests/hists_output.o
  CC       tests/hists_cumulate.o
  CC       tests/python-use.o
  CC       tests/bp_signal.o
  CC       tests/bp_signal_overflow.o
  CC       tests/task-exit.o
  CC       tests/sw-clock.o
  CC       tests/mmap-thread-lookup.o
  CC       tests/thread-mg-share.o
  CC       tests/switch-tracking.o
  CC       tests/keep-tracking.o
  CC       tests/code-reading.o
  CC       tests/sample-parsing.o
  CC       tests/parse-no-sample-id-all.o
  LD       util/libperf-in.o
make[1]: *** [libperf-in.o] Error 2
make[1]: *** Waiting for unfinished jobs....
  LD       tests/perf-in.o
  LD       perf-in.o
make: *** [all] Error 2
[

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-16 12:12   ` Mark Rutland
@ 2015-01-16 12:22     ` Will Deacon
  2015-01-16 12:30       ` Jiri Olsa
  2015-01-16 12:29     ` Jiri Olsa
  1 sibling, 1 reply; 55+ messages in thread
From: Will Deacon @ 2015-01-16 12:22 UTC (permalink / raw)
  To: Mark Rutland
  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, Ingo Molnar,
	Jean Pihet, msalter, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, S. Lockwood-Childs, Sam Ravnborg, Sasha Levin,
	Stephane Eranian, Steven Rostedt, Sukadev Bhattiprolu

On Fri, Jan 16, 2015 at 12:12:14PM +0000, Mark Rutland wrote:
> On Fri, Jan 16, 2015 at 11:39:22AM +0000, Will Deacon wrote:
> > On Thu, Jan 15, 2015 at 12:54:56PM +0000, Jiri Olsa wrote:
> > > hi,
> > > I'm following up on latest post from Alexis:
> > >   http://marc.info/?l=linux-kernel&m=141427580405357&w=2
> > > 
> > > v2 changes:
> > >   - build Makefiles librarized and moved to 'tools/build' [Ingo]
> > >   - several minor fixies [Namhyung]
> > >   - tested on other archs now - x86_64, i386, powerpc
> > >   - moved tools/lib/* under new build framework to show
> > >     that it's possible ;-)
> > >     included traceevent/lockdep maintainers to get the feedback
> > >   - omitted last 2 patches
> > > 
> > > The patchset is also available in:
> > >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> > >   perf/build
> > > 
> > > All tests/make tests passed.
> > > 
> > > Any feedback from ARM guys would be great ;-)
> > 
> > [adding Mark Rutland to Cc]
> 
> Cheers.
> 
> I just tried a cross-build for arm, and that blew up when trying to do
> something with arch/arm/util/libperf-in.o (log below). I bisected that
> to f169fbc4c59dd9d4 "perf build: Add arch x86 objects building". I'm
> looking into why now.

I get a similar failure doing a native arm64 build. I think the problem is
because the arch/ files for arm and arm64 aren't always required (i.e. there
are configurations where nothing is built under there) and, consequently,
libperf-in.o isn't actually needed and we try to link against something that
doesn't exist.

Will

> Thanks,
> Mark.
> 
> [mark@leverpostej:~/src/linux/tools/perf]% make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
>   BUILD:   Doing 'make -j8' parallel build
> config/Makefile:341: No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev
> config/Makefile:417: Disabling post unwind, no support found.
> config/Makefile:458: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
> config/Makefile:473: slang not found, disables TUI support. Please install slang-devel or libslang-dev
> config/Makefile:487: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
> config/Makefile:515: Missing perl devel files. Disabling perl scripting support, consider installing perl-ExtUtils-Embed
> config/Makefile:560: No Python.h (for Python 2.x) was found
> config/Makefile:560: Python support will not be built
> config/Makefile:653: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
> 
> Auto-detecting system features:
> ...                         dwarf: [ OFF ]
> ...                         glibc: [ on  ]
> ...                          gtk2: [ OFF ]
> ...                      libaudit: [ OFF ]
> ...                        libbfd: [ OFF ]
> ...                        libelf: [ OFF ]
> ...                       libnuma: [ OFF ]
> ...                       libperl: [ OFF ]
> ...                     libpython: [ OFF ]
> ...                      libslang: [ OFF ]
> ...                     libunwind: [ OFF ]
> ...            libdw-dwarf-unwind: [ OFF ]
> ...                          zlib: [ OFF ]
> 
>   CC       arch/common.o
>   CC       util/alias.o
>   CC       util/abspath.o
>   CC       ui/setup.o
>   CC       event-parse.o
>   CC       fd/array.o
>   LD       arch/arm/libperf-in.o
> arm-linux-gnueabihf-ld: cannot find arch/arm/util/libperf-in.o: No such file or directory
> make[4]: *** [arch/arm/libperf-in.o] Error 1
> make[3]: *** [arm] Error 2
> make[3]: *** Waiting for unfinished jobs....
>   GEN      common-cmds.h
>   LD       fd/libapi-in.o
>   CC       fs/fs.o
>   CC       fs/debugfs.o
>   CC       util/annotate.o
>   CC       ui/helpline.o
>   CC       ui/progress.o
>   CC       ui/util.o
>   LD       fs/libapi-in.o
>   LD       libapi-in.o
>   AR       libapi.a
>   CC       ui/hist.o
> make[2]: *** [arch] Error 2
> make[2]: *** Waiting for unfinished jobs....
>   CC       ui/stdio/hist.o
>   CC       plugin_jbd2.o
>   PERF_VERSION = 3.19.rc2.gcdb397
>   CC       plugin_hrtimer.o
>   CC       plugin_kmem.o
>   LD       plugin_jbd2-in.o
>   CC       plugin_kvm.o
>   LD       plugin_hrtimer-in.o
>   CC       plugin_mac80211.o
>   CC       event-plugin.o
>   LD       plugin_kmem-in.o
>   CC       trace-seq.o
>   LD       plugin_mac80211-in.o
>   LD       plugin_kvm-in.o
>   CC       parse-filter.o
>   CC       plugin_sched_switch.o
>   CC       parse-utils.o
>   CC       kbuffer-parse.o
>   CC       plugin_function.o
>   LD       plugin_sched_switch-in.o
>   CC       plugin_xen.o
>   CC       plugin_scsi.o
>   LD       plugin_xen-in.o
>   LD       plugin_function-in.o
>   CC       plugin_cfg80211.o
>   LINK     plugin_jbd2.so
>   LINK     plugin_hrtimer.so
>   LINK     plugin_kmem.so
>   LINK     plugin_kvm.so
>   LD       plugin_cfg80211-in.o
>   CC       builtin-bench.o
>   LD       plugin_scsi-in.o
>   LINK     plugin_mac80211.so
>   LINK     plugin_sched_switch.so
>   CC       builtin-annotate.o
>   LD       libtraceevent-in.o
>   LINK     plugin_function.so
>   LINK     plugin_xen.so
>   LINK     plugin_scsi.so
>   LINK     plugin_cfg80211.so
>   CC       util/build-id.o
>   CC       util/config.o
>   LINK     libtraceevent.a
>   GEN      perf-archive
>   GEN      perf-with-kcore
>   CC       util/ctype.o
>   CC       builtin-diff.o
>   CC       util/db-export.o
>   CC       util/environment.o
>   CC       builtin-evlist.o
>   CC       util/event.o
>   CC       util/evlist.o
>   CC       util/evsel.o
>   CC       util/exec_cmd.o
>   CC       builtin-help.o
>   CC       util/find_next_bit.o
>   CC       builtin-sched.o
>   CC       util/help.o
>   CC       builtin-buildid-list.o
>   CC       builtin-buildid-cache.o
>   CC       util/kallsyms.o
>   CC       builtin-list.o
>   CC       util/levenshtein.o
>   CC       util/parse-options.o
>   LD       ui/libperf-in.o
>   BISON    util/parse-events-bison.c
>   CC       builtin-record.o
>   CC       builtin-report.o
>   CC       util/path.o
>   CC       util/rbtree.o
>   CC       util/bitmap.o
>   CC       util/hweight.o
>   CC       util/run-command.o
>   CC       util/quote.o
>   CC       builtin-stat.o
>   CC       util/strbuf.o
>   CC       builtin-timechart.o
>   CC       builtin-top.o
>   CC       util/string.o
>   CC       util/strlist.o
>   CC       builtin-script.o
>   CC       builtin-kmem.o
>   CC       util/strfilter.o
>   CC       util/top.o
>   CC       builtin-lock.o
>   CC       util/usage.o
>   CC       util/wrapper.o
>   CC       util/sigchain.o
>   CC       builtin-kvm.o
>   CC       util/dso.o
>   CC       util/symbol.o
>   CC       util/color.o
>   CC       builtin-inject.o
>   CC       util/pager.o
>   CC       util/header.o
>   CC       builtin-mem.o
>   CC       util/callchain.o
>   CC       bench/sched-messaging.o
>   CC       bench/sched-pipe.o
>   CC       util/values.o
>   CC       util/debug.o
>   CC       util/machine.o
>   CC       tests/builtin-test.o
>   CC       bench/mem-memcpy.o
>   CC       util/map.o
>   CC       util/pstack.o
>   CC       tests/parse-events.o
>   CC       bench/futex-hash.o
>   CC       perf.o
>   CC       util/session.o
>   CC       bench/futex-wake.o
>   CC       util/ordered-events.o
>   CC       bench/futex-requeue.o
>   CC       tests/dso-data.o
>   CC       tests/attr.o
>   CC       util/comm.o
>   CC       util/thread.o
>   LD       bench/perf-in.o
>   CC       util/thread_map.o
>   CC       util/trace-event-parse.o
>   CC       tests/vmlinux-kallsyms.o
>   CC       tests/open-syscall.o
>   CC       tests/open-syscall-all-cpus.o
>   CC       util/parse-events-bison.o
>   BISON    util/pmu-bison.c
>   CC       util/trace-event-read.o
>   CC       tests/open-syscall-tp-fields.o
>   CC       util/trace-event-info.o
>   CC       util/trace-event-scripting.o
>   CC       util/trace-event.o
>   CC       util/svghelper.o
>   CC       tests/mmap-basic.o
>   CC       util/sort.o
>   CC       util/hist.o
>   CC       util/util.o
>   CC       util/xyarray.o
>   CC       tests/perf-record.o
>   CC       util/cpumap.o
>   CC       tests/rdpmc.o
>   CC       util/cgroup.o
>   CC       util/target.o
>   CC       tests/evsel-roundtrip-name.o
>   CC       tests/evsel-tp-sched.o
>   CC       util/rblist.o
>   CC       util/intlist.o
>   CC       util/vdso.o
>   CC       tests/fdarray.o
>   CC       util/stat.o
>   CC       util/record.o
>   CC       util/srcline.o
>   CC       tests/pmu.o
>   CC       util/data.o
>   CC       util/tsc.o
>   CC       util/cloexec.o
>   CC       util/thread-stack.o
>   CC       tests/hists_common.o
>   CC       util/symbol-minimal.o
>   CC       util/perf_regs.o
>   FLEX     util/parse-events-flex.c
>   CC       tests/hists_link.o
>   FLEX     util/pmu-flex.c
>   CC       util/pmu-bison.o
>   CC       util/parse-events.o
>   CC       util/parse-events-flex.o
>   CC       util/pmu.o
>   CC       tests/hists_filter.o
>   CC       util/pmu-flex.o
>   CC       tests/hists_output.o
>   CC       tests/hists_cumulate.o
>   CC       tests/python-use.o
>   CC       tests/bp_signal.o
>   CC       tests/bp_signal_overflow.o
>   CC       tests/task-exit.o
>   CC       tests/sw-clock.o
>   CC       tests/mmap-thread-lookup.o
>   CC       tests/thread-mg-share.o
>   CC       tests/switch-tracking.o
>   CC       tests/keep-tracking.o
>   CC       tests/code-reading.o
>   CC       tests/sample-parsing.o
>   CC       tests/parse-no-sample-id-all.o
>   LD       util/libperf-in.o
> make[1]: *** [libperf-in.o] Error 2
> make[1]: *** Waiting for unfinished jobs....
>   LD       tests/perf-in.o
>   LD       perf-in.o
> make: *** [all] Error 2
> [
> 

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-16 12:12   ` Mark Rutland
  2015-01-16 12:22     ` Will Deacon
@ 2015-01-16 12:29     ` Jiri Olsa
  1 sibling, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-16 12:29 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Will Deacon, 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, Ingo Molnar, Jean Pihet, msalter,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, S. Lockwood-Childs,
	Sam Ravnborg, Sasha Levin, Stephane Eranian, Steven Rostedt,
	Sukadev Bhattiprolu

On Fri, Jan 16, 2015 at 12:12:14PM +0000, Mark Rutland wrote:
> On Fri, Jan 16, 2015 at 11:39:22AM +0000, Will Deacon wrote:
> > On Thu, Jan 15, 2015 at 12:54:56PM +0000, Jiri Olsa wrote:
> > > hi,
> > > I'm following up on latest post from Alexis:
> > >   http://marc.info/?l=linux-kernel&m=141427580405357&w=2
> > > 
> > > v2 changes:
> > >   - build Makefiles librarized and moved to 'tools/build' [Ingo]
> > >   - several minor fixies [Namhyung]
> > >   - tested on other archs now - x86_64, i386, powerpc
> > >   - moved tools/lib/* under new build framework to show
> > >     that it's possible ;-)
> > >     included traceevent/lockdep maintainers to get the feedback
> > >   - omitted last 2 patches
> > > 
> > > The patchset is also available in:
> > >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> > >   perf/build
> > > 
> > > All tests/make tests passed.
> > > 
> > > Any feedback from ARM guys would be great ;-)
> > 
> > [adding Mark Rutland to Cc]
> 
> Cheers.
> 
> I just tried a cross-build for arm, and that blew up when trying to do
> something with arch/arm/util/libperf-in.o (log below). I bisected that
> to f169fbc4c59dd9d4 "perf build: Add arch x86 objects building". I'm
> looking into why now.

hum, looks like you dont have anything to be built in arch directory,
so the libperf-in.o is not created:

arch/arm/Build:
  libperf-y += util/
  libperf-$(CONFIG_DWARF_UNWIND) += tests/

arch/arm/util/Build:
  libperf-$(CONFIG_DWARF) += dwarf-regs.o

  libperf-$(CONFIG_LIBUNWIND)          += unwind-libunwind.o
  libperf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o

if none of CONFIG_DWARF_UNWIND,CONFIG_LIBUNWIND,CONFIG_LIBDW_DWARF_UNWIND
is defined then the final 'arch/arm/util/libperf-in.o' is not created,
because there are no objects for it.. and build fails

I'll come up with the fix

thanks for testing,
jirka



> 
> Thanks,
> Mark.
> 
> [mark@leverpostej:~/src/linux/tools/perf]% make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
>   BUILD:   Doing 'make -j8' parallel build
> config/Makefile:341: No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev
> config/Makefile:417: Disabling post unwind, no support found.
> config/Makefile:458: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
> config/Makefile:473: slang not found, disables TUI support. Please install slang-devel or libslang-dev
> config/Makefile:487: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
> config/Makefile:515: Missing perl devel files. Disabling perl scripting support, consider installing perl-ExtUtils-Embed
> config/Makefile:560: No Python.h (for Python 2.x) was found
> config/Makefile:560: Python support will not be built
> config/Makefile:653: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
> 
> Auto-detecting system features:
> ...                         dwarf: [ OFF ]
> ...                         glibc: [ on  ]
> ...                          gtk2: [ OFF ]
> ...                      libaudit: [ OFF ]
> ...                        libbfd: [ OFF ]
> ...                        libelf: [ OFF ]
> ...                       libnuma: [ OFF ]
> ...                       libperl: [ OFF ]
> ...                     libpython: [ OFF ]
> ...                      libslang: [ OFF ]
> ...                     libunwind: [ OFF ]
> ...            libdw-dwarf-unwind: [ OFF ]
> ...                          zlib: [ OFF ]
> 
>   CC       arch/common.o
>   CC       util/alias.o
>   CC       util/abspath.o
>   CC       ui/setup.o
>   CC       event-parse.o
>   CC       fd/array.o
>   LD       arch/arm/libperf-in.o
> arm-linux-gnueabihf-ld: cannot find arch/arm/util/libperf-in.o: No such file or directory
> make[4]: *** [arch/arm/libperf-in.o] Error 1
> make[3]: *** [arm] Error 2
> make[3]: *** Waiting for unfinished jobs....
>   GEN      common-cmds.h
>   LD       fd/libapi-in.o
>   CC       fs/fs.o
>   CC       fs/debugfs.o
>   CC       util/annotate.o
>   CC       ui/helpline.o
>   CC       ui/progress.o
>   CC       ui/util.o
>   LD       fs/libapi-in.o
>   LD       libapi-in.o
>   AR       libapi.a
>   CC       ui/hist.o
> make[2]: *** [arch] Error 2
> make[2]: *** Waiting for unfinished jobs....
>   CC       ui/stdio/hist.o
>   CC       plugin_jbd2.o
>   PERF_VERSION = 3.19.rc2.gcdb397
>   CC       plugin_hrtimer.o
>   CC       plugin_kmem.o
>   LD       plugin_jbd2-in.o
>   CC       plugin_kvm.o
>   LD       plugin_hrtimer-in.o
>   CC       plugin_mac80211.o
>   CC       event-plugin.o
>   LD       plugin_kmem-in.o
>   CC       trace-seq.o
>   LD       plugin_mac80211-in.o
>   LD       plugin_kvm-in.o
>   CC       parse-filter.o
>   CC       plugin_sched_switch.o
>   CC       parse-utils.o
>   CC       kbuffer-parse.o
>   CC       plugin_function.o
>   LD       plugin_sched_switch-in.o
>   CC       plugin_xen.o
>   CC       plugin_scsi.o
>   LD       plugin_xen-in.o
>   LD       plugin_function-in.o
>   CC       plugin_cfg80211.o
>   LINK     plugin_jbd2.so
>   LINK     plugin_hrtimer.so
>   LINK     plugin_kmem.so
>   LINK     plugin_kvm.so
>   LD       plugin_cfg80211-in.o
>   CC       builtin-bench.o
>   LD       plugin_scsi-in.o
>   LINK     plugin_mac80211.so
>   LINK     plugin_sched_switch.so
>   CC       builtin-annotate.o
>   LD       libtraceevent-in.o
>   LINK     plugin_function.so
>   LINK     plugin_xen.so
>   LINK     plugin_scsi.so
>   LINK     plugin_cfg80211.so
>   CC       util/build-id.o
>   CC       util/config.o
>   LINK     libtraceevent.a
>   GEN      perf-archive
>   GEN      perf-with-kcore
>   CC       util/ctype.o
>   CC       builtin-diff.o
>   CC       util/db-export.o
>   CC       util/environment.o
>   CC       builtin-evlist.o
>   CC       util/event.o
>   CC       util/evlist.o
>   CC       util/evsel.o
>   CC       util/exec_cmd.o
>   CC       builtin-help.o
>   CC       util/find_next_bit.o
>   CC       builtin-sched.o
>   CC       util/help.o
>   CC       builtin-buildid-list.o
>   CC       builtin-buildid-cache.o
>   CC       util/kallsyms.o
>   CC       builtin-list.o
>   CC       util/levenshtein.o
>   CC       util/parse-options.o
>   LD       ui/libperf-in.o
>   BISON    util/parse-events-bison.c
>   CC       builtin-record.o
>   CC       builtin-report.o
>   CC       util/path.o
>   CC       util/rbtree.o
>   CC       util/bitmap.o
>   CC       util/hweight.o
>   CC       util/run-command.o
>   CC       util/quote.o
>   CC       builtin-stat.o
>   CC       util/strbuf.o
>   CC       builtin-timechart.o
>   CC       builtin-top.o
>   CC       util/string.o
>   CC       util/strlist.o
>   CC       builtin-script.o
>   CC       builtin-kmem.o
>   CC       util/strfilter.o
>   CC       util/top.o
>   CC       builtin-lock.o
>   CC       util/usage.o
>   CC       util/wrapper.o
>   CC       util/sigchain.o
>   CC       builtin-kvm.o
>   CC       util/dso.o
>   CC       util/symbol.o
>   CC       util/color.o
>   CC       builtin-inject.o
>   CC       util/pager.o
>   CC       util/header.o
>   CC       builtin-mem.o
>   CC       util/callchain.o
>   CC       bench/sched-messaging.o
>   CC       bench/sched-pipe.o
>   CC       util/values.o
>   CC       util/debug.o
>   CC       util/machine.o
>   CC       tests/builtin-test.o
>   CC       bench/mem-memcpy.o
>   CC       util/map.o
>   CC       util/pstack.o
>   CC       tests/parse-events.o
>   CC       bench/futex-hash.o
>   CC       perf.o
>   CC       util/session.o
>   CC       bench/futex-wake.o
>   CC       util/ordered-events.o
>   CC       bench/futex-requeue.o
>   CC       tests/dso-data.o
>   CC       tests/attr.o
>   CC       util/comm.o
>   CC       util/thread.o
>   LD       bench/perf-in.o
>   CC       util/thread_map.o
>   CC       util/trace-event-parse.o
>   CC       tests/vmlinux-kallsyms.o
>   CC       tests/open-syscall.o
>   CC       tests/open-syscall-all-cpus.o
>   CC       util/parse-events-bison.o
>   BISON    util/pmu-bison.c
>   CC       util/trace-event-read.o
>   CC       tests/open-syscall-tp-fields.o
>   CC       util/trace-event-info.o
>   CC       util/trace-event-scripting.o
>   CC       util/trace-event.o
>   CC       util/svghelper.o
>   CC       tests/mmap-basic.o
>   CC       util/sort.o
>   CC       util/hist.o
>   CC       util/util.o
>   CC       util/xyarray.o
>   CC       tests/perf-record.o
>   CC       util/cpumap.o
>   CC       tests/rdpmc.o
>   CC       util/cgroup.o
>   CC       util/target.o
>   CC       tests/evsel-roundtrip-name.o
>   CC       tests/evsel-tp-sched.o
>   CC       util/rblist.o
>   CC       util/intlist.o
>   CC       util/vdso.o
>   CC       tests/fdarray.o
>   CC       util/stat.o
>   CC       util/record.o
>   CC       util/srcline.o
>   CC       tests/pmu.o
>   CC       util/data.o
>   CC       util/tsc.o
>   CC       util/cloexec.o
>   CC       util/thread-stack.o
>   CC       tests/hists_common.o
>   CC       util/symbol-minimal.o
>   CC       util/perf_regs.o
>   FLEX     util/parse-events-flex.c
>   CC       tests/hists_link.o
>   FLEX     util/pmu-flex.c
>   CC       util/pmu-bison.o
>   CC       util/parse-events.o
>   CC       util/parse-events-flex.o
>   CC       util/pmu.o
>   CC       tests/hists_filter.o
>   CC       util/pmu-flex.o
>   CC       tests/hists_output.o
>   CC       tests/hists_cumulate.o
>   CC       tests/python-use.o
>   CC       tests/bp_signal.o
>   CC       tests/bp_signal_overflow.o
>   CC       tests/task-exit.o
>   CC       tests/sw-clock.o
>   CC       tests/mmap-thread-lookup.o
>   CC       tests/thread-mg-share.o
>   CC       tests/switch-tracking.o
>   CC       tests/keep-tracking.o
>   CC       tests/code-reading.o
>   CC       tests/sample-parsing.o
>   CC       tests/parse-no-sample-id-all.o
>   LD       util/libperf-in.o
> make[1]: *** [libperf-in.o] Error 2
> make[1]: *** Waiting for unfinished jobs....
>   LD       tests/perf-in.o
>   LD       perf-in.o
> make: *** [all] Error 2
> [

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-16 12:22     ` Will Deacon
@ 2015-01-16 12:30       ` Jiri Olsa
  2015-01-16 12:43         ` Jiri Olsa
  0 siblings, 1 reply; 55+ messages in thread
From: Jiri Olsa @ 2015-01-16 12:30 UTC (permalink / raw)
  To: Will Deacon
  Cc: Mark Rutland, 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, Ingo Molnar, Jean Pihet, msalter,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, S. Lockwood-Childs,
	Sam Ravnborg, Sasha Levin, Stephane Eranian, Steven Rostedt,
	Sukadev Bhattiprolu

On Fri, Jan 16, 2015 at 12:22:21PM +0000, Will Deacon wrote:
> On Fri, Jan 16, 2015 at 12:12:14PM +0000, Mark Rutland wrote:
> > On Fri, Jan 16, 2015 at 11:39:22AM +0000, Will Deacon wrote:
> > > On Thu, Jan 15, 2015 at 12:54:56PM +0000, Jiri Olsa wrote:
> > > > hi,
> > > > I'm following up on latest post from Alexis:
> > > >   http://marc.info/?l=linux-kernel&m=141427580405357&w=2
> > > > 
> > > > v2 changes:
> > > >   - build Makefiles librarized and moved to 'tools/build' [Ingo]
> > > >   - several minor fixies [Namhyung]
> > > >   - tested on other archs now - x86_64, i386, powerpc
> > > >   - moved tools/lib/* under new build framework to show
> > > >     that it's possible ;-)
> > > >     included traceevent/lockdep maintainers to get the feedback
> > > >   - omitted last 2 patches
> > > > 
> > > > The patchset is also available in:
> > > >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> > > >   perf/build
> > > > 
> > > > All tests/make tests passed.
> > > > 
> > > > Any feedback from ARM guys would be great ;-)
> > > 
> > > [adding Mark Rutland to Cc]
> > 
> > Cheers.
> > 
> > I just tried a cross-build for arm, and that blew up when trying to do
> > something with arch/arm/util/libperf-in.o (log below). I bisected that
> > to f169fbc4c59dd9d4 "perf build: Add arch x86 objects building". I'm
> > looking into why now.
> 
> I get a similar failure doing a native arm64 build. I think the problem is
> because the arch/ files for arm and arm64 aren't always required (i.e. there
> are configurations where nothing is built under there) and, consequently,
> libperf-in.o isn't actually needed and we try to link against something that
> doesn't exist.

exactly ;-) I'll spin v3 shortly..

thanks,
jirka

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-16 12:30       ` Jiri Olsa
@ 2015-01-16 12:43         ` Jiri Olsa
  2015-01-16 13:41           ` Will Deacon
  2015-01-16 13:49           ` Mark Rutland
  0 siblings, 2 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-16 12:43 UTC (permalink / raw)
  To: Will Deacon
  Cc: Mark Rutland, 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, Ingo Molnar, msalter, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, S. Lockwood-Childs, Sam Ravnborg,
	Sasha Levin, Stephane Eranian, Steven Rostedt,
	Sukadev Bhattiprolu

On Fri, Jan 16, 2015 at 01:30:13PM +0100, Jiri Olsa wrote:
> On Fri, Jan 16, 2015 at 12:22:21PM +0000, Will Deacon wrote:
> > On Fri, Jan 16, 2015 at 12:12:14PM +0000, Mark Rutland wrote:
> > > On Fri, Jan 16, 2015 at 11:39:22AM +0000, Will Deacon wrote:
> > > > On Thu, Jan 15, 2015 at 12:54:56PM +0000, Jiri Olsa wrote:
> > > > > hi,
> > > > > I'm following up on latest post from Alexis:
> > > > >   http://marc.info/?l=linux-kernel&m=141427580405357&w=2
> > > > > 
> > > > > v2 changes:
> > > > >   - build Makefiles librarized and moved to 'tools/build' [Ingo]
> > > > >   - several minor fixies [Namhyung]
> > > > >   - tested on other archs now - x86_64, i386, powerpc
> > > > >   - moved tools/lib/* under new build framework to show
> > > > >     that it's possible ;-)
> > > > >     included traceevent/lockdep maintainers to get the feedback
> > > > >   - omitted last 2 patches
> > > > > 
> > > > > The patchset is also available in:
> > > > >   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
> > > > >   perf/build
> > > > > 
> > > > > All tests/make tests passed.
> > > > > 
> > > > > Any feedback from ARM guys would be great ;-)
> > > > 
> > > > [adding Mark Rutland to Cc]
> > > 
> > > Cheers.
> > > 
> > > I just tried a cross-build for arm, and that blew up when trying to do
> > > something with arch/arm/util/libperf-in.o (log below). I bisected that
> > > to f169fbc4c59dd9d4 "perf build: Add arch x86 objects building". I'm
> > > looking into why now.
> > 
> > I get a similar failure doing a native arm64 build. I think the problem is
> > because the arch/ files for arm and arm64 aren't always required (i.e. there
> > are configurations where nothing is built under there) and, consequently,
> > libperf-in.o isn't actually needed and we try to link against something that
> > doesn't exist.
> 
> exactly ;-) I'll spin v3 shortly..

this fixes the issue for me

jirka


---
diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
index d35b66014992..396b33b124d1 100644
--- a/tools/build/Makefile.build
+++ b/tools/build/Makefile.build
@@ -52,7 +52,7 @@ quiet_cmd_cc_s_c = AS       $@
 
 # Link agregate command
 quiet_cmd_ld_multi = LD       $@
-      cmd_ld_multi = $(LD) -r -o $@ $^
+      cmd_ld_multi = $(LD) -r -o $@ $(wildcard $^)
 
 # Build rules
 $(OUTPUT)%.o: %.c FORCE

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-16 12:43         ` Jiri Olsa
@ 2015-01-16 13:41           ` Will Deacon
  2015-01-16 13:49           ` Mark Rutland
  1 sibling, 0 replies; 55+ messages in thread
From: Will Deacon @ 2015-01-16 13:41 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Mark Rutland, 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, Ingo Molnar, msalter, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, S. Lockwood-Childs, Sam Ravnborg,
	Sasha Levin, Stephane Eranian, Steven Rostedt,
	Sukadev Bhattiprolu

On Fri, Jan 16, 2015 at 12:43:49PM +0000, Jiri Olsa wrote:
> On Fri, Jan 16, 2015 at 01:30:13PM +0100, Jiri Olsa wrote:
> > On Fri, Jan 16, 2015 at 12:22:21PM +0000, Will Deacon wrote:
> > > On Fri, Jan 16, 2015 at 12:12:14PM +0000, Mark Rutland wrote:
> > > > I just tried a cross-build for arm, and that blew up when trying to do
> > > > something with arch/arm/util/libperf-in.o (log below). I bisected that
> > > > to f169fbc4c59dd9d4 "perf build: Add arch x86 objects building". I'm
> > > > looking into why now.
> > > 
> > > I get a similar failure doing a native arm64 build. I think the problem is
> > > because the arch/ files for arm and arm64 aren't always required (i.e. there
> > > are configurations where nothing is built under there) and, consequently,
> > > libperf-in.o isn't actually needed and we try to link against something that
> > > doesn't exist.
> > 
> > exactly ;-) I'll spin v3 shortly..
> 
> this fixes the issue for me

Same for me, thanks!

Tested-by: Will Deacon <will.deacon@arm.com>

Will

> ---
> diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
> index d35b66014992..396b33b124d1 100644
> --- a/tools/build/Makefile.build
> +++ b/tools/build/Makefile.build
> @@ -52,7 +52,7 @@ quiet_cmd_cc_s_c = AS       $@
>  
>  # Link agregate command
>  quiet_cmd_ld_multi = LD       $@
> -      cmd_ld_multi = $(LD) -r -o $@ $^
> +      cmd_ld_multi = $(LD) -r -o $@ $(wildcard $^)
>  
>  # Build rules
>  $(OUTPUT)%.o: %.c FORCE
> 

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-16 12:43         ` Jiri Olsa
  2015-01-16 13:41           ` Will Deacon
@ 2015-01-16 13:49           ` Mark Rutland
  2015-01-16 14:15             ` Jiri Olsa
  1 sibling, 1 reply; 55+ messages in thread
From: Mark Rutland @ 2015-01-16 13:49 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Will Deacon, 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, Ingo Molnar, msalter, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, S. Lockwood-Childs, Sam Ravnborg,
	Sasha Levin, Stephane Eranian, Steven Rostedt,
	Sukadev Bhattiprolu

Hi,

[...]

> > > > I just tried a cross-build for arm, and that blew up when trying to do
> > > > something with arch/arm/util/libperf-in.o (log below). I bisected that
> > > > to f169fbc4c59dd9d4 "perf build: Add arch x86 objects building". I'm
> > > > looking into why now.
> > > 
> > > I get a similar failure doing a native arm64 build. I think the problem is
> > > because the arch/ files for arm and arm64 aren't always required (i.e. there
> > > are configurations where nothing is built under there) and, consequently,
> > > libperf-in.o isn't actually needed and we try to link against something that
> > > doesn't exist.
> > 
> > exactly ;-) I'll spin v3 shortly..
> 
> this fixes the issue for me
> 
> jirka
> 
> 
> ---
> diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
> index d35b66014992..396b33b124d1 100644
> --- a/tools/build/Makefile.build
> +++ b/tools/build/Makefile.build
> @@ -52,7 +52,7 @@ quiet_cmd_cc_s_c = AS       $@
>  
>  # Link agregate command
>  quiet_cmd_ld_multi = LD       $@
> -      cmd_ld_multi = $(LD) -r -o $@ $^
> +      cmd_ld_multi = $(LD) -r -o $@ $(wildcard $^)
>  
>  # Build rules
>  $(OUTPUT)%.o: %.c FORCE
> 

Unfortunately that doesn't seem to be sufficient for me when
cross-compiling. It looks like it supresses the warning from Make, but
then LD explodes anyway because it wasn't provided any input files (log
below).

Thanks,
Mark.

[mark@leverpostej:~/src/linux/tools/perf]% uselinaro 14.09 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
  BUILD:   Doing 'make -j8' parallel build
config/Makefile:341: No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev
config/Makefile:417: Disabling post unwind, no support found.
config/Makefile:458: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:473: slang not found, disables TUI support. Please install slang-devel or libslang-dev
config/Makefile:487: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
config/Makefile:515: Missing perl devel files. Disabling perl scripting support, consider installing perl-ExtUtils-Embed
config/Makefile:560: No Python.h (for Python 2.x) was found
config/Makefile:560: Python support will not be built
config/Makefile:653: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev

Auto-detecting system features:
...                         dwarf: [ OFF ]
...                         glibc: [ on  ]
...                          gtk2: [ OFF ]
...                      libaudit: [ OFF ]
...                        libbfd: [ OFF ]
...                        libelf: [ OFF ]
...                       libnuma: [ OFF ]
...                       libperl: [ OFF ]
...                     libpython: [ OFF ]
...                      libslang: [ OFF ]
...                     libunwind: [ OFF ]
...            libdw-dwarf-unwind: [ OFF ]
...                          zlib: [ OFF ]

  SUBDIR   /home/mark/src/linux/tools/lib/api/
  FLAGS:   * new build flags or prefix
  GEN      common-cmds.h
  MKDIR    libapi_dirs
  SUBDIR   /home/mark/src/linux/tools/lib/traceevent/
  CC       fs/debugfs.o
  CC       arch/common.o
  CC       fs/fs.o
  CC       fd/array.o
  CC       util/abspath.o
  FLAGS:   * new build flags or cross compiler
  CC       ui/setup.o
  CC       ui/helpline.o
  CC       ui/progress.o
  AR       libapikfs.a
  CC       util/alias.o
  CC       util/annotate.o
  CC       ui/util.o
  CC       ui/hist.o
  CC       ui/stdio/hist.o
  PERF_VERSION = 3.19.rc2.gb7973a
  CC       builtin-bench.o
  LD       arch/libperf-in.o
arm-linux-gnueabihf-ld: no input files
make[3]: *** [arch/libperf-in.o] Error 1
make[2]: *** [arch] Error 2
make[2]: *** Waiting for unfinished jobs....
  CC       builtin-annotate.o
  CC       util/build-id.o
  CC FPIC  event-parse.o
  CC FPIC  event-plugin.o
  CC FPIC  trace-seq.o
  CC       builtin-diff.o
  CC FPIC  parse-filter.o
  CC       builtin-evlist.o
  CC       util/config.o
  CC       util/ctype.o
  CC FPIC  parse-utils.o
  CC       util/db-export.o
  CC FPIC  kbuffer-parse.o
  CC       builtin-help.o
  CC       util/environment.o
  CC FPIC  plugin_jbd2.o
  CC FPIC  plugin_hrtimer.o
  CC       util/event.o
  CC FPIC  plugin_kmem.o
  CC FPIC  plugin_kvm.o
  CC FPIC  plugin_mac80211.o
  CC       util/evlist.o
  CC FPIC  plugin_sched_switch.o
  CC       builtin-sched.o
  CC       util/evsel.o
  CC       util/exec_cmd.o
  CC FPIC  plugin_function.o
  CC FPIC  plugin_xen.o
  CC       builtin-buildid-list.o
  CC FPIC  plugin_scsi.o
  CC FPIC  plugin_cfg80211.o
  CC       builtin-buildid-cache.o
  LINK     libtraceevent.a
  LINK     plugin_jbd2.so
  GEN      perf-archive
  CC       util/find_next_bit.o
  LINK     plugin_hrtimer.so
  LINK     plugin_kmem.so
  LINK     plugin_kvm.so
  CC       util/help.o
  LINK     plugin_mac80211.so
  CC       util/kallsyms.o
  LINK     plugin_sched_switch.so
  LINK     plugin_function.so
  LINK     plugin_xen.so
  LD       ui/libperf-in.o
  CC       builtin-list.o
arm-linux-gnueabihf-ld: no input files
make[3]: *** [ui/libperf-in.o] Error 1
make[2]: *** [ui] Error 2
  CC       builtin-record.o
  LINK     plugin_scsi.so
  LINK     plugin_cfg80211.so
  GEN      perf-with-kcore
  CC       builtin-report.o
  CC       builtin-stat.o
  CC       builtin-timechart.o
  CC       util/levenshtein.o
  CC       builtin-top.o
  CC       builtin-script.o
  CC       builtin-kmem.o
  CC       builtin-lock.o
  CC       util/parse-options.o
  CC       builtin-kvm.o
  CC       builtin-inject.o
  CC       builtin-mem.o
  CC       bench/sched-messaging.o
  CC       tests/builtin-test.o
  CC       perf.o
  BISON    util/parse-events-bison.c
  CC       util/path.o
  CC       util/rbtree.o
  CC       util/bitmap.o
  CC       tests/parse-events.o
  CC       bench/sched-pipe.o
  CC       util/hweight.o
  CC       util/run-command.o
  CC       bench/mem-memcpy.o
  CC       bench/futex-hash.o
  CC       bench/futex-wake.o
  CC       util/quote.o
  CC       bench/futex-requeue.o
  CC       tests/dso-data.o
  CC       util/strbuf.o
  CC       util/string.o
  CC       util/strlist.o
  CC       tests/attr.o
  CC       tests/vmlinux-kallsyms.o
  LD       bench/perf-in.o
arm-linux-gnueabihf-ld: no input files
make[3]: *** [bench/perf-in.o] Error 1
make[2]: *** [bench] Error 2
make[2]: *** Waiting for unfinished jobs....
  CC       tests/open-syscall.o
  CC       util/strfilter.o
  CC       util/top.o
  CC       util/usage.o
  CC       tests/open-syscall-all-cpus.o
  CC       tests/open-syscall-tp-fields.o
  CC       tests/mmap-basic.o
  CC       tests/perf-record.o
  CC       util/wrapper.o
  CC       tests/rdpmc.o
  CC       util/sigchain.o
  CC       tests/evsel-roundtrip-name.o
  CC       tests/evsel-tp-sched.o
  CC       tests/fdarray.o
  CC       util/dso.o
  CC       tests/pmu.o
  CC       tests/hists_common.o
  CC       util/symbol.o
  CC       tests/hists_link.o
  CC       tests/hists_filter.o
  CC       tests/hists_output.o
  CC       tests/hists_cumulate.o
  CC       tests/python-use.o
  CC       tests/bp_signal.o
  CC       util/color.o
  CC       tests/bp_signal_overflow.o
  CC       tests/task-exit.o
  CC       util/pager.o
  CC       util/header.o
  CC       util/callchain.o
  CC       tests/sw-clock.o
  CC       tests/mmap-thread-lookup.o
  CC       util/values.o
  CC       tests/thread-mg-share.o
  CC       tests/switch-tracking.o
  CC       tests/keep-tracking.o
  CC       tests/code-reading.o
  CC       util/debug.o
  CC       tests/sample-parsing.o
  CC       util/machine.o
  CC       tests/parse-no-sample-id-all.o
  CC       util/map.o
  CC       util/pstack.o
  CC       util/session.o
  CC       util/ordered-events.o
  LD       tests/perf-in.o
arm-linux-gnueabihf-ld: no input files
make[3]: *** [tests/perf-in.o] Error 1
make[2]: *** [tests] Error 2
make[1]: *** [perf-in.o] Error 2
make[1]: *** Waiting for unfinished jobs....
  CC       util/comm.o
  CC       util/thread.o
  CC       util/thread_map.o
  CC       util/trace-event-parse.o
  CC       util/parse-events-bison.o
  BISON    util/pmu-bison.c
  CC       util/trace-event-read.o
  CC       util/trace-event-info.o
  CC       util/trace-event-scripting.o
  CC       util/trace-event.o
  CC       util/svghelper.o
  CC       util/sort.o
  CC       util/hist.o
  CC       util/util.o
  CC       util/xyarray.o
  CC       util/cpumap.o
  CC       util/cgroup.o
  CC       util/target.o
  CC       util/rblist.o
  CC       util/intlist.o
  CC       util/vdso.o
  CC       util/stat.o
  CC       util/record.o
  CC       util/srcline.o
  CC       util/data.o
  CC       util/tsc.o
  CC       util/cloexec.o
  CC       util/thread-stack.o
  CC       util/symbol-minimal.o
  CC       util/perf_regs.o
  FLEX     util/parse-events-flex.c
  FLEX     util/pmu-flex.c
  CC       util/pmu-bison.o
  CC       util/parse-events.o
  CC       util/parse-events-flex.o
  CC       util/pmu.o
  CC       util/pmu-flex.o
  LD       util/libperf-in.o
arm-linux-gnueabihf-ld: no input files
make[3]: *** [util/libperf-in.o] Error 1
make[2]: *** [util] Error 2
make[1]: *** [libperf-in.o] Error 2
make: *** [all] Error 2

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-16 13:49           ` Mark Rutland
@ 2015-01-16 14:15             ` Jiri Olsa
  2015-01-19 12:13               ` Jiri Olsa
  0 siblings, 1 reply; 55+ messages in thread
From: Jiri Olsa @ 2015-01-16 14:15 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Will Deacon, 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, Ingo Molnar, msalter, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, S. Lockwood-Childs, Sam Ravnborg,
	Sasha Levin, Stephane Eranian, Steven Rostedt,
	Sukadev Bhattiprolu

On Fri, Jan 16, 2015 at 01:49:10PM +0000, Mark Rutland wrote:
> Hi,
> 
> [...]
> 
> > > > > I just tried a cross-build for arm, and that blew up when trying to do
> > > > > something with arch/arm/util/libperf-in.o (log below). I bisected that
> > > > > to f169fbc4c59dd9d4 "perf build: Add arch x86 objects building". I'm
> > > > > looking into why now.
> > > > 
> > > > I get a similar failure doing a native arm64 build. I think the problem is
> > > > because the arch/ files for arm and arm64 aren't always required (i.e. there
> > > > are configurations where nothing is built under there) and, consequently,
> > > > libperf-in.o isn't actually needed and we try to link against something that
> > > > doesn't exist.
> > > 
> > > exactly ;-) I'll spin v3 shortly..
> > 
> > this fixes the issue for me
> > 
> > jirka
> > 
> > 
> > ---
> > diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
> > index d35b66014992..396b33b124d1 100644
> > --- a/tools/build/Makefile.build
> > +++ b/tools/build/Makefile.build
> > @@ -52,7 +52,7 @@ quiet_cmd_cc_s_c = AS       $@
> >  
> >  # Link agregate command
> >  quiet_cmd_ld_multi = LD       $@
> > -      cmd_ld_multi = $(LD) -r -o $@ $^
> > +      cmd_ld_multi = $(LD) -r -o $@ $(wildcard $^)
> >  
> >  # Build rules
> >  $(OUTPUT)%.o: %.c FORCE
> > 
> 
> Unfortunately that doesn't seem to be sufficient for me when
> cross-compiling. It looks like it supresses the warning from Make, but
> then LD explodes anyway because it wasn't provided any input files (log
> below).

argh.. right, when there are no source objects at all :-\ fix is comming ;-)

thanks,
jirka

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

* Re: [PATCHv2 00/36] perf tools: New build framework
  2015-01-16 14:15             ` Jiri Olsa
@ 2015-01-19 12:13               ` Jiri Olsa
  0 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-19 12:13 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Will Deacon, 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, Ingo Molnar, msalter, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, S. Lockwood-Childs, Sam Ravnborg,
	Sasha Levin, Stephane Eranian, Steven Rostedt,
	Sukadev Bhattiprolu

On Fri, Jan 16, 2015 at 03:15:52PM +0100, Jiri Olsa wrote:
> On Fri, Jan 16, 2015 at 01:49:10PM +0000, Mark Rutland wrote:
> > Hi,
> > 
> > [...]
> > 
> > > > > > I just tried a cross-build for arm, and that blew up when trying to do
> > > > > > something with arch/arm/util/libperf-in.o (log below). I bisected that
> > > > > > to f169fbc4c59dd9d4 "perf build: Add arch x86 objects building". I'm
> > > > > > looking into why now.
> > > > > 
> > > > > I get a similar failure doing a native arm64 build. I think the problem is
> > > > > because the arch/ files for arm and arm64 aren't always required (i.e. there
> > > > > are configurations where nothing is built under there) and, consequently,
> > > > > libperf-in.o isn't actually needed and we try to link against something that
> > > > > doesn't exist.
> > > > 
> > > > exactly ;-) I'll spin v3 shortly..
> > > 
> > > this fixes the issue for me
> > > 
> > > jirka
> > > 
> > > 
> > > ---
> > > diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build
> > > index d35b66014992..396b33b124d1 100644
> > > --- a/tools/build/Makefile.build
> > > +++ b/tools/build/Makefile.build
> > > @@ -52,7 +52,7 @@ quiet_cmd_cc_s_c = AS       $@
> > >  
> > >  # Link agregate command
> > >  quiet_cmd_ld_multi = LD       $@
> > > -      cmd_ld_multi = $(LD) -r -o $@ $^
> > > +      cmd_ld_multi = $(LD) -r -o $@ $(wildcard $^)
> > >  
> > >  # Build rules
> > >  $(OUTPUT)%.o: %.c FORCE
> > > 
> > 
> > Unfortunately that doesn't seem to be sufficient for me when
> > cross-compiling. It looks like it supresses the warning from Make, but
> > then LD explodes anyway because it wasn't provided any input files (log
> > below).
> 
> argh.. right, when there are no source objects at all :-\ fix is comming ;-)

ok, for a minute I forgot I'm stealing this from kbuild..
aaand they have a solution of course ;-)

so I'm now always creating $(obj)-in.o objects (even empty ones),
and it seems to work nicely.. as in kbuild ;-)

the update 'perf/build' branch' with the fix is in:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  perf/build

I tried on arm64,ppc64,s390,x86_64,i386

I'll spin v3 shortly (after doc updates), but any testing would be great

thanks,
jirka

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

* [PATCH 04/36] perf tools: Remove api fs object from python build
  2015-01-26 10:12 [PATCHv4 00/36] perf tools: New build framework Jiri Olsa
@ 2015-01-26 10:12 ` Jiri Olsa
  0 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-26 10:12 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

It's already included in libapikfs.a library, which
is already used to link perf.so.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Tested-by: Will Deacon <will.deacon@arm.com>
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/util/python-ext-sources | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index 6c6a6953fa93..4d28624a1eca 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -17,6 +17,5 @@ util/xyarray.c
 util/cgroup.c
 util/rblist.c
 util/strlist.c
-../lib/api/fs/fs.c
 util/trace-event.c
 ../../lib/rbtree.c
-- 
1.9.3


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

* [PATCH 04/36] perf tools: Remove api fs object from python build
  2015-01-20 16:38 [PATCHv3 " Jiri Olsa
@ 2015-01-20 16:39 ` Jiri Olsa
  0 siblings, 0 replies; 55+ messages in thread
From: Jiri Olsa @ 2015-01-20 16:39 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

It's already included in libapikfs.a library, which
is already used to link perf.so.

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/util/python-ext-sources | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index 6c6a6953fa93..4d28624a1eca 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -17,6 +17,5 @@ util/xyarray.c
 util/cgroup.c
 util/rblist.c
 util/strlist.c
-../lib/api/fs/fs.c
 util/trace-event.c
 ../../lib/rbtree.c
-- 
1.9.3


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

end of thread, other threads:[~2015-01-26 10:27 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-15 12:54 [PATCHv2 00/36] perf tools: New build framework Jiri Olsa
2015-01-15 12:54 ` [PATCH 01/36] tools build: Add new build support Jiri Olsa
2015-01-15 12:54 ` [PATCH 02/36] tools build: Add detected config support Jiri Olsa
2015-01-15 15:50   ` David Ahern
2015-01-15 16:21     ` Jiri Olsa
2015-01-15 12:54 ` [PATCH 03/36] tools build: Add subdir support Jiri Olsa
2015-01-15 12:55 ` [PATCH 04/36] perf tools: Remove api fs object from python build Jiri Olsa
2015-01-15 12:55 ` [PATCH 05/36] perf build: Disable make's built-in rules and variables Jiri Olsa
2015-01-15 16:01   ` David Ahern
2015-01-15 16:24     ` Jiri Olsa
2015-01-15 12:55 ` [PATCH 06/36] perf build: Add bench objects building Jiri Olsa
2015-01-15 12:55 ` [PATCH 07/36] perf build: Add tests " Jiri Olsa
2015-01-15 12:55 ` [PATCH 08/36] perf build: Add builtin " Jiri Olsa
2015-01-15 12:55 ` [PATCH 09/36] perf build: Add libperf " Jiri Olsa
2015-01-15 12:55 ` [PATCH 10/36] perf build: Add probe " Jiri Olsa
2015-01-15 12:55 ` [PATCH 11/36] perf build: Add dwarf " Jiri Olsa
2015-01-15 12:55 ` [PATCH 12/36] perf build: Add dwarf unwind " Jiri Olsa
2015-01-15 12:55 ` [PATCH 13/36] perf build: Add ui " Jiri Olsa
2015-01-15 12:55 ` [PATCH 14/36] perf build: Add slang " Jiri Olsa
2015-01-15 12:55 ` [PATCH 15/36] perf build: Add gtk " Jiri Olsa
2015-01-15 12:55 ` [PATCH 16/36] perf build: Add scripts " Jiri Olsa
2015-01-15 12:55 ` [PATCH 17/36] perf build: Add perf regs " Jiri Olsa
2015-01-15 12:55 ` [PATCH 18/36] perf build: Add zlib " Jiri Olsa
2015-01-15 12:55 ` [PATCH 19/36] perf build: Add perf.o object building Jiri Olsa
2015-01-15 12:55 ` [PATCH 20/36] perf build: Add arch x86 objects building Jiri Olsa
2015-01-15 12:55 ` [PATCH 21/36] perf build: Add arch arm " Jiri Olsa
2015-01-15 12:55 ` [PATCH 22/36] perf build: Add arch arm64 " Jiri Olsa
2015-01-15 12:55 ` [PATCH 23/36] perf build: Add arch powerpc " Jiri Olsa
2015-01-15 12:55 ` [PATCH 24/36] perf build: Add arch s390 " Jiri Olsa
2015-01-15 12:55 ` [PATCH 25/36] perf build: Add arch sh " Jiri Olsa
2015-01-15 12:55 ` [PATCH 26/36] perf build: Add arch sparc " Jiri Olsa
2015-01-15 12:55 ` [PATCH 27/36] perf build: Add single target build framework support Jiri Olsa
2015-01-15 12:55 ` [PATCH 28/36] perf build: Remove directory dependency rules Jiri Olsa
2015-01-15 12:55 ` [PATCH 29/36] perf build: Remove uneeded variables Jiri Olsa
2015-01-15 12:55 ` [PATCH 30/36] perf build: Remove PERF-CFLAGS file Jiri Olsa
2015-01-15 12:55 ` [PATCH 31/36] perf build: Add build documentation Jiri Olsa
2015-01-15 12:55 ` [PATCH 32/36] tools lib api: Use tools build framework Jiri Olsa
2015-01-15 12:55 ` [PATCH 33/36] tools lib api: Rename libapikfs.a to libapi.a Jiri Olsa
2015-01-15 12:55 ` [PATCH 34/36] tools lib traceevent: Use tools build framework Jiri Olsa
2015-01-15 12:55 ` [PATCH 35/36] tools lib lockdep: " Jiri Olsa
2015-01-15 12:55 ` [PATCH 36/36] perf build: Display make commands on V=1 Jiri Olsa
2015-01-15 16:08 ` [PATCHv2 00/36] perf tools: New build framework David Ahern
2015-01-15 16:31   ` Jiri Olsa
2015-01-16 11:39 ` Will Deacon
2015-01-16 12:12   ` Mark Rutland
2015-01-16 12:22     ` Will Deacon
2015-01-16 12:30       ` Jiri Olsa
2015-01-16 12:43         ` Jiri Olsa
2015-01-16 13:41           ` Will Deacon
2015-01-16 13:49           ` Mark Rutland
2015-01-16 14:15             ` Jiri Olsa
2015-01-19 12:13               ` Jiri Olsa
2015-01-16 12:29     ` Jiri Olsa
2015-01-20 16:38 [PATCHv3 " Jiri Olsa
2015-01-20 16:39 ` [PATCH 04/36] perf tools: Remove api fs object from python build Jiri Olsa
2015-01-26 10:12 [PATCHv4 00/36] perf tools: New build framework Jiri Olsa
2015-01-26 10:12 ` [PATCH 04/36] perf tools: Remove api fs object from python build Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).