linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] kernel-shark: Make some top level "make" changes and documention updates
@ 2019-06-27 17:05 Steven Rostedt
  2019-06-27 17:05 ` [PATCH v2 1/3] kernelshark: Update the README for changes to the make process Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Steven Rostedt @ 2019-06-27 17:05 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov, Troy Engel

This is built on top of the three patches from Yordan that can be
found here:

  https://patchwork.kernel.org/project/linux-trace-devel/list/?series=132531

It makes "make clean" remove cmake generated files (my build failed
and I couldn't figure out why. "make clean" should allow builds to
build again when CMake files change).

I also adde a "make BUILD_TYPE=foo" to pass to the cmake command to
change the CMAKE_BUILD_TYPE to allow an easy build by the package
maintainers to change how KernelShark is built.

It also updates the README with the current way to build KernelShark.

Changes from v1:

 - Added a patch to first change the README to the latest make process

 - Incorporated Yordan's suggestions about breaking up the build
   documentation into two sections, one explaining the "simple"
   method from the toplevel git repo, and the other explaining
   the "expert" method using cmake directly.

Steven Rostedt (VMware) (3):
      kernelshark: Update the README for changes to the make process
      kernel-shark: Have "make clean" run cmake-clean.sh
      kernel-shark: Add 'make BUILD_TYPE=X gui' to change how the gui is made

----
 Makefile                    |  6 ++++-
 kernel-shark/CMakeLists.txt |  2 +-
 kernel-shark/README         | 63 +++++++++++++++++++++++++++++++++++++--------
 3 files changed, 58 insertions(+), 13 deletions(-)

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

* [PATCH v2 1/3] kernelshark: Update the README for changes to the make process
  2019-06-27 17:05 [PATCH v2 0/3] kernel-shark: Make some top level "make" changes and documention updates Steven Rostedt
@ 2019-06-27 17:05 ` Steven Rostedt
  2019-06-27 17:05 ` [PATCH v2 2/3] kernel-shark: Have "make clean" run cmake-clean.sh Steven Rostedt
  2019-06-27 17:05 ` [PATCH v2 3/3] kernel-shark: Add make BUILD_TYPE=X gui to change how the gui is made Steven Rostedt
  2 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2019-06-27 17:05 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov, Troy Engel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The top level git tree's Makefile has code added to build the cmake portion
of KernelShark. But the README does not document the process. Bring the
README up to speed with how to actually build KernelShark.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel-shark/README | 50 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 10 deletions(-)

diff --git a/kernel-shark/README b/kernel-shark/README
index 75a0dd08dcac..7155e13b17fc 100644
--- a/kernel-shark/README
+++ b/kernel-shark/README
@@ -30,18 +30,47 @@ Building:
 1. Follow the instructions given in trace-cmd/README and build
 the original trace-cmd end traceevent libraries.
 
-2. Do:
-    cd kernel-shark/build
-    cmake ../
-    make
+2. Building KernelShark:
+
+2.1 There is a simple and expert way to build KernelShark
+
+2.1.1 Option 1 (simple) : build KernelShark as part of trace-cmd
+
+   (from the toplevel git tree)
+
+      make gui
+
+   This will build the necessary parts of trace-cmd needed
+   by KernelShark.
+
+2.1.1.1 By default, the installation prefix is "/usr/local". It can be
+changed by passing in "prefix" to the build.
+
+   make prefix=/usr gui
 
-2.1.1 In order to create a Doxygen documentation add -D_DOXYGEN_DOC=1
+2.1.1.2 Use "make clean" if you want to delete all already compiled objects.
+Note, this will not clean up the files created by cmake. See section 2.1.2.4
+
+2.1.2 Option 2 (expert) : standalone build of KernelShark (for hackers only)
+
+   (note, you may need to do a normal make from the toplevel git
+    tree before performing the following)
+
+      make
+      cd kernel-shark/build
+      cmake ../
+      make
+
+    This gives you a bit more control as you may easily pass in
+    your own cmake options.
+
+2.1.2.1 In order to create a Doxygen documentation add -D_DOXYGEN_DOC=1
 as a CMake Command-Line option.
 
-2.1.2 By default, installation prefix is "/usr/local". It can be changed using
+2.1.2.2 By default, installation prefix is "/usr/local". It can be changed using
 -D_INSTALL_PREFIX= as a CMake Command-Line option.
 
-2.1.3 In addition to the standard CMake build types (Debug, Release,
+2.1.2.3 In addition to the standard CMake build types (Debug, Release,
 RelWithDebInfo, MinSizeRel) KernelShark supports a "Package" build type.
 By default this build type adds the "-O2" compiler flag. Package maintainers
 can chose their own compiler flags by providing the corresponding
@@ -57,10 +86,11 @@ Examples:
 
     cmake -DCMAKE_BUILD_TYPE=Package -DCMAKE_C_FLAGS_PACKAGE="-O3 -pedantic"  ../
 
-2.2.1 Use "make clean" if you want to delete all already compiled objects.
-
-2.2.2 Use the script "cmake_clean.sh" if you want to delete all already
+2.1.2.4 Use the script "cmake_clean.sh" if you want to delete all already
 compiled objects and all files generated by CMake.
 
+    cd kernel-shark/build
+    ./cmake-clean.sh
+
 3. After building the code "kernel-shark/lib" will contain all libraries
 and "kernel-shark/bin" will contain all executables.
-- 
2.20.1



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

* [PATCH v2 2/3] kernel-shark: Have "make clean" run cmake-clean.sh
  2019-06-27 17:05 [PATCH v2 0/3] kernel-shark: Make some top level "make" changes and documention updates Steven Rostedt
  2019-06-27 17:05 ` [PATCH v2 1/3] kernelshark: Update the README for changes to the make process Steven Rostedt
@ 2019-06-27 17:05 ` Steven Rostedt
  2019-06-27 17:05 ` [PATCH v2 3/3] kernel-shark: Add make BUILD_TYPE=X gui to change how the gui is made Steven Rostedt
  2 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2019-06-27 17:05 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov, Troy Engel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

A make clean should clean up the cmake files as well.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile            | 1 +
 kernel-shark/README | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 693f33b69b4e..c9679d42fdbd 100644
--- a/Makefile
+++ b/Makefile
@@ -357,6 +357,7 @@ clean:
 	$(MAKE) -C $(src)/python clean
 	$(MAKE) -C $(src)/tracecmd clean
 	if [ -f $(kshark-dir)/build/Makefile ]; then $(MAKE) -C $(kshark-dir)/build clean; fi
+	cd $(kshark-dir)/build; ./cmake_clean.sh
 
 
 ##### PYTHON STUFF #####
diff --git a/kernel-shark/README b/kernel-shark/README
index 7155e13b17fc..b133f1848fd2 100644
--- a/kernel-shark/README
+++ b/kernel-shark/README
@@ -49,7 +49,7 @@ changed by passing in "prefix" to the build.
    make prefix=/usr gui
 
 2.1.1.2 Use "make clean" if you want to delete all already compiled objects.
-Note, this will not clean up the files created by cmake. See section 2.1.2.4
+This will also clean up all the files created by cmake.
 
 2.1.2 Option 2 (expert) : standalone build of KernelShark (for hackers only)
 
-- 
2.20.1



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

* [PATCH v2 3/3] kernel-shark: Add make BUILD_TYPE=X gui to change how the gui is made
  2019-06-27 17:05 [PATCH v2 0/3] kernel-shark: Make some top level "make" changes and documention updates Steven Rostedt
  2019-06-27 17:05 ` [PATCH v2 1/3] kernelshark: Update the README for changes to the make process Steven Rostedt
  2019-06-27 17:05 ` [PATCH v2 2/3] kernel-shark: Have "make clean" run cmake-clean.sh Steven Rostedt
@ 2019-06-27 17:05 ` Steven Rostedt
  2019-06-28 13:26   ` Yordan Karadzhov (VMware)
  2 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2019-06-27 17:05 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Yordan Karadzhov, Troy Engel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Add a option to the Makefile called "BUILD_TYPE" that is passed to the CMake
commonds to change how kernelshark is built. The current options are:

 make BUILD_TYPE=Debug gui          - for "-g" option
 make BUILD_TYPE=Release gui        - for "-O3" option
 make BUILD_TYPE=RelWithDebInfo gui - for "-g -O2" option (default)
 make BUILD_TYPE=MinSizeRel gui     - for "-Os" option

By default, BUILD_TYPE is set to RelWithDebInfo.

Also change the CMakeLists.txt to use RelWithDebInfo as the default
instead of just Debug.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile                    |  5 ++++-
 kernel-shark/CMakeLists.txt |  2 +-
 kernel-shark/README         | 13 ++++++++++++-
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index c9679d42fdbd..ad74a969249f 100644
--- a/Makefile
+++ b/Makefile
@@ -252,8 +252,11 @@ all_cmd: $(CMD_TARGETS)
 
 CMAKE_COMMAND = /usr/bin/cmake
 
+# Build with "BUILD_TYPE=Release" to remove cmake debug info
+BUILD_TYPE ?= RelWithDebInfo
+
 $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt
-	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -D_INSTALL_PREFIX=$(prefix) ..
+	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) ..
 
 gui: force $(CMD_TARGETS) $(kshark-dir)/build/Makefile
 	$(Q)$(MAKE) $(S) -C $(kshark-dir)/build
diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt
index d932c396e4a6..58a3c3b84309 100644
--- a/kernel-shark/CMakeLists.txt
+++ b/kernel-shark/CMakeLists.txt
@@ -37,7 +37,7 @@ set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fPIC")
 
 if (NOT CMAKE_BUILD_TYPE)
-    set(CMAKE_BUILD_TYPE Debug)
+    set(CMAKE_BUILD_TYPE RelWithDebInfo)
 endif (NOT CMAKE_BUILD_TYPE)
 
 message("\n Build type: ${CMAKE_BUILD_TYPE}")
diff --git a/kernel-shark/README b/kernel-shark/README
index b133f1848fd2..7e50479fd824 100644
--- a/kernel-shark/README
+++ b/kernel-shark/README
@@ -51,6 +51,16 @@ changed by passing in "prefix" to the build.
 2.1.1.2 Use "make clean" if you want to delete all already compiled objects.
 This will also clean up all the files created by cmake.
 
+2.1.1.3 KernelShark has multiple build types (See section 2.1.2.3 for more
+details. By default, the build type is RelWithDebInfo, which will build
+a release candidate with debug information. To change the type, pass in
+the option BUILD_TYPE=<type> to the make process.
+
+    make BUILD_TYPE=Debug gui          - for "-g" option
+    make BUILD_TYPE=Release gui        - for "-O3" option
+    make BUILD_TYPE=RelWithDebInfo gui - for "-g -O2" option (default)
+    make BUILD_TYPE=MinSizeRel gui     - for "-Os" option
+
 2.1.2 Option 2 (expert) : standalone build of KernelShark (for hackers only)
 
    (note, you may need to do a normal make from the toplevel git
@@ -79,9 +89,10 @@ CMAKE_XXXX_FLAGS_PACKAGE Command-Line options (see the example below).
 Note that when built as a "Package" the RPATH-s of the executables are
 set directly to _INSTALL_PREFIX/lib/kernelshark/
 
-If no build types is specified, the type will be "Debug".
+If no build types is specified, the type will be "RelWithDebInfo".
 
 Examples:
+
     cmake -D_DOXYGEN_DOC=1 -D_INSTALL_PREFIX=/usr ../
 
     cmake -DCMAKE_BUILD_TYPE=Package -DCMAKE_C_FLAGS_PACKAGE="-O3 -pedantic"  ../
-- 
2.20.1



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

* Re: [PATCH v2 3/3] kernel-shark: Add make BUILD_TYPE=X gui to change how the gui is made
  2019-06-27 17:05 ` [PATCH v2 3/3] kernel-shark: Add make BUILD_TYPE=X gui to change how the gui is made Steven Rostedt
@ 2019-06-28 13:26   ` Yordan Karadzhov (VMware)
  0 siblings, 0 replies; 5+ messages in thread
From: Yordan Karadzhov (VMware) @ 2019-06-28 13:26 UTC (permalink / raw)
  To: Steven Rostedt, linux-trace-devel; +Cc: Troy Engel



On 27.06.19 г. 20:05 ч., Steven Rostedt wrote:
> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> Add a option to the Makefile called "BUILD_TYPE" that is passed to the CMake
> commonds to change how kernelshark is built. The current options are:
> 

Just fix the typos:

Add a option -> Add an option
commonds -> commands

All patches look good.
Reviewed-by: Yordan Karadzhov <ykaradzhov@vmware.com>



>   make BUILD_TYPE=Debug gui          - for "-g" option
>   make BUILD_TYPE=Release gui        - for "-O3" option
>   make BUILD_TYPE=RelWithDebInfo gui - for "-g -O2" option (default)
>   make BUILD_TYPE=MinSizeRel gui     - for "-Os" option
> 
> By default, BUILD_TYPE is set to RelWithDebInfo.
> 
> Also change the CMakeLists.txt to use RelWithDebInfo as the default
> instead of just Debug.
> 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
>   Makefile                    |  5 ++++-
>   kernel-shark/CMakeLists.txt |  2 +-
>   kernel-shark/README         | 13 ++++++++++++-
>   3 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index c9679d42fdbd..ad74a969249f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -252,8 +252,11 @@ all_cmd: $(CMD_TARGETS)
>   
>   CMAKE_COMMAND = /usr/bin/cmake
>   
> +# Build with "BUILD_TYPE=Release" to remove cmake debug info
> +BUILD_TYPE ?= RelWithDebInfo
> +
>   $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt
> -	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -D_INSTALL_PREFIX=$(prefix) ..
> +	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) ..
>   
>   gui: force $(CMD_TARGETS) $(kshark-dir)/build/Makefile
>   	$(Q)$(MAKE) $(S) -C $(kshark-dir)/build
> diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt
> index d932c396e4a6..58a3c3b84309 100644
> --- a/kernel-shark/CMakeLists.txt
> +++ b/kernel-shark/CMakeLists.txt
> @@ -37,7 +37,7 @@ set(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS} -Wall -pthread -fPIC")
>   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -pthread -fPIC")
>   
>   if (NOT CMAKE_BUILD_TYPE)
> -    set(CMAKE_BUILD_TYPE Debug)
> +    set(CMAKE_BUILD_TYPE RelWithDebInfo)
>   endif (NOT CMAKE_BUILD_TYPE)
>   
>   message("\n Build type: ${CMAKE_BUILD_TYPE}")
> diff --git a/kernel-shark/README b/kernel-shark/README
> index b133f1848fd2..7e50479fd824 100644
> --- a/kernel-shark/README
> +++ b/kernel-shark/README
> @@ -51,6 +51,16 @@ changed by passing in "prefix" to the build.
>   2.1.1.2 Use "make clean" if you want to delete all already compiled objects.
>   This will also clean up all the files created by cmake.
>   
> +2.1.1.3 KernelShark has multiple build types (See section 2.1.2.3 for more
> +details. By default, the build type is RelWithDebInfo, which will build
> +a release candidate with debug information. To change the type, pass in
> +the option BUILD_TYPE=<type> to the make process.
> +
> +    make BUILD_TYPE=Debug gui          - for "-g" option
> +    make BUILD_TYPE=Release gui        - for "-O3" option
> +    make BUILD_TYPE=RelWithDebInfo gui - for "-g -O2" option (default)
> +    make BUILD_TYPE=MinSizeRel gui     - for "-Os" option
> +
>   2.1.2 Option 2 (expert) : standalone build of KernelShark (for hackers only)
>   
>      (note, you may need to do a normal make from the toplevel git
> @@ -79,9 +89,10 @@ CMAKE_XXXX_FLAGS_PACKAGE Command-Line options (see the example below).
>   Note that when built as a "Package" the RPATH-s of the executables are
>   set directly to _INSTALL_PREFIX/lib/kernelshark/
>   
> -If no build types is specified, the type will be "Debug".
> +If no build types is specified, the type will be "RelWithDebInfo".
>   
>   Examples:
> +
>       cmake -D_DOXYGEN_DOC=1 -D_INSTALL_PREFIX=/usr ../
>   
>       cmake -DCMAKE_BUILD_TYPE=Package -DCMAKE_C_FLAGS_PACKAGE="-O3 -pedantic"  ../
> 

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

end of thread, other threads:[~2019-06-28 13:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 17:05 [PATCH v2 0/3] kernel-shark: Make some top level "make" changes and documention updates Steven Rostedt
2019-06-27 17:05 ` [PATCH v2 1/3] kernelshark: Update the README for changes to the make process Steven Rostedt
2019-06-27 17:05 ` [PATCH v2 2/3] kernel-shark: Have "make clean" run cmake-clean.sh Steven Rostedt
2019-06-27 17:05 ` [PATCH v2 3/3] kernel-shark: Add make BUILD_TYPE=X gui to change how the gui is made Steven Rostedt
2019-06-28 13:26   ` Yordan Karadzhov (VMware)

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