diff mbox series

[v2,3/3] kernel-shark: Add make BUILD_TYPE=X gui to change how the gui is made

Message ID 20190627170733.279595354@goodmis.org (mailing list archive)
State Accepted
Commit b9f86b16548bd57a2667c54f008246e27160a060
Headers show
Series kernel-shark: Make some top level "make" changes and documention updates | expand

Commit Message

Steven Rostedt June 27, 2019, 5:05 p.m. UTC
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(-)

Comments

Yordan Karadzhov June 28, 2019, 1:26 p.m. UTC | #1
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"  ../
>
diff mbox series

Patch

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"  ../