kernel-shark: Make some top level "make" changes
cover kernel-shark: Make some top level "make" changes
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.
Steven Rostedt (VMware) (2):
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 | 23 +++++++++++++++++------ 3 files changed, 23 insertions(+), 8 deletions(-)
PATCH 1/2 kernel-shark: Have "make clean" run cmake-clean.sh
From: "Steven Rostedt (VMware)" <[email protected]>
A make clean should clean up the cmake files as well.
Update the kernel-shark/README to reflect some of the changes that have been made, and options done by the "make" command line.
--- Makefile | 1 + kernel-shark/README | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-)
Makefile +1 -0
@@ -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 #####
kernel-shark/README +12 -5
@@ -31,6 +31,11 @@ Building: the original trace-cmd end traceevent libraries. 2. Do: + make gui + +This will perform the following, in case you want to do it directly +yourself: + cd kernel-shark/build cmake ../ make
@@ -39,7 +44,11 @@ the original trace-cmd end traceevent libraries. as a CMake Command-Line option. 2.1.2 By default, installation prefix is "/usr/local". It can be changed using --D_INSTALL_PREFIX= as a CMake Command-Line option. +-D_INSTALL_PREFIX= as a CMake Command-Line option. Which can also be +done by passing in "prefix=" to the make command line. + + make prefix=/my/local/dir gui + 2.1.3 In addition to the standard CMake build types (Debug, Release, RelWithDebInfo, MinSizeRel) KernelShark supports a "Package" build type.
@@ -57,10 +66,8 @@ 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 -compiled objects and all files generated by CMake. +2.2 Use "make clean" if you want to delete all already compiled objects +and all files generated by CMake. 3. After building the code "kernel-shark/lib" will contain all libraries and "kernel-shark/bin" will contain all executables.
Signature · 1 line
2.20.1
Re: [PATCH 1/2] kernel-shark: Have "make clean" run cmake-clean.sh
Quoted 42 lines · Steven Rostedt
From: "Steven Rostedt (VMware)" <[email protected]>
A make clean should clean up the cmake files as well.
Update the kernel-shark/README to reflect some of the changes that have been made, and options done by the "make" command line.
Signed-off-by Steven Rostedt (VMware) <[email protected]>--- Makefile | 1 + kernel-shark/README | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-)Makefile +1
-0@@ -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 #####kernel-shark/README +5
-0@@ -31,6 +31,11 @@ Building: the original trace-cmd end traceevent libraries. 2. Do: + make gui + +This will perform the following, in case you want to do it directly +yourself: + cd kernel-shark/build cmake ../ make
kernel-shark/README the original trace-cmd end traceevent libraries. · line 45
Quoted 2 lines
kernel-shark/README +0
-0@@ -39,7 +44,11 @@ the original trace-cmd end traceevent libraries. as a CMake Command-Line option.
I agree with all functional changes in those patches. However, the README file becomes a bit ambiguous.
I would prefer having something like this
2. Building KernelShark:
2.1 Option 1 : build KernelShark as part of trace-cmd
make gui
All explanations for this build option are following
...
2.2 Option 2 : standalone build of KernelShark (for hackers only)
cd kernel-shark/build
cmake ../
make
All explanations for this build option are following ...
...Note that in Option 1
make clean
is equivalent to
make clean
./cmake_clean.sh
in Option 2.
Thanks!
Yordan
Quoted 24 lines
kernel-shark/README +7
-52.1.2 By default, installation prefix is "/usr/local". It can be changed using --D_INSTALL_PREFIX= as a CMake Command-Line option. +-D_INSTALL_PREFIX= as a CMake Command-Line option. Which can also be +done by passing in "prefix=" to the make command line. + + make prefix=/my/local/dir gui + 2.1.3 In addition to the standard CMake build types (Debug, Release, RelWithDebInfo, MinSizeRel) KernelShark supports a "Package" build type.@@ -57,10 +66,8 @@ 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 -compiled objects and all files generated by CMake. +2.2 Use "make clean" if you want to delete all already compiled objects +and all files generated by CMake. 3. After building the code "kernel-shark/lib" will contain all libraries and "kernel-shark/bin" will contain all executables.
Re: [PATCH 1/2] kernel-shark: Have "make clean" run cmake-clean.sh
Quoted 2 lines · On Tue, 18 Jun 2019 13:54:30 +0300 "Yordan Karadzhov (VMware)"…
I agree with all functional changes in those patches. However, the README file becomes a bit ambiguous.
Heh, I wrote that at the last minute and was a bit tired. I was hoping for a better write up from someone ;-)
Quoted 20 lines
I would prefer having something like this
2. Building KernelShark:
2.1 Option 1 : build KernelShark as part of trace-cmdmake gui
All explanations for this build option are following
...2.2 Option 2 : standalone build of KernelShark (for hackers only)
cd kernel-shark/build cmake ../ make All explanations for this build option are following ... ...Note that in Option 1
Quoted 8 lines
make clean
is equivalent to
make clean
./cmake_clean.shin Option 2.
Makes sense.
Thanks!
-- Steve
PATCH 2/2 kernel-shark: Add make BUILD_TYPE=X gui to change how the gui is made
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
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.
--- Makefile | 5 ++++- kernel-shark/CMakeLists.txt | 2 +- kernel-shark/README | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-)
Makefile +4 -1
@@ -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
kernel-shark/CMakeLists.txt +1 -1
@@ -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}")
kernel-shark/README +5 -1
@@ -59,9 +59,13 @@ 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: + make BUILD_TYPE=Release + + or directly with cmake in the kernel-shark/build directory: + cmake -D_DOXYGEN_DOC=1 -D_INSTALL_PREFIX=/usr ../ cmake -DCMAKE_BUILD_TYPE=Package -DCMAKE_C_FLAGS_PACKAGE="-O3 -pedantic" ../
Signature · 1 line
2.20.1