From patchwork Tue Feb 6 08:48:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758493 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pg0-f65.google.com ([74.125.83.65]:44980 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752278AbeBFItJ (ORCPT ); Tue, 6 Feb 2018 03:49:09 -0500 Received: by mail-pg0-f65.google.com with SMTP id r1so820523pgn.11 for ; Tue, 06 Feb 2018 00:49:09 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 01/24] trace-cmd: Rename libparsevent to libtraceevent Date: Tue, 6 Feb 2018 10:48:43 +0200 Message-Id: <20180206084906.9854-2-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2480 This simple patch renames libparsevent to libtraceevent in order to trace-cmd to be consistent with the kernel. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index a5d2c38..a3a60bf 100644 --- a/Makefile +++ b/Makefile @@ -351,8 +351,8 @@ TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ trace-capture.o kernel-shark.o -PEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o str_error_r.o -TCMD_LIB_OBJS = $(PEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \ +TRACEEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o str_error_r.o +TCMD_LIB_OBJS = $(TRACEEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \ trace-output.o trace-recorder.o \ trace-usage.o trace-blk-hack.o \ kbuffer-parse.o event-plugin.o trace-hooks.o \ @@ -377,7 +377,7 @@ PLUGINS := $(PLUGIN_OBJS:.o=.so) ALL_OBJS = $(TRACE_CMD_OBJS) $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) \ $(TRACE_GRAPH_MAIN_OBJS) $(TCMD_LIB_OBJS) $(PLUGIN_OBJS) -CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h libparsevent.a $(LIB_FILE) \ +CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h libtraceevent.a $(LIB_FILE) \ trace-cmd $(PLUGINS) $(BUILD_PYTHON) GUI_TARGETS = ks_version.h trace-graph trace-view kernelshark @@ -423,10 +423,10 @@ kernelshark: libtracecmd.a trace-view: libtracecmd.a trace-graph: libtracecmd.a -libparsevent.so: $(PEVENT_LIB_OBJS) +libtraceevent.so: $(TRACEEVENT_LIB_OBJS) $(Q)$(do_compile_shared_library) -libparsevent.a: $(PEVENT_LIB_OBJS) +libtraceevent.a: $(TRACEEVENT_LIB_OBJS) $(Q)$(do_build_static_lib) $(TCMD_LIB_OBJS): %.o: $(src)/%.c @@ -438,7 +438,7 @@ libtracecmd.so: $(TCMD_LIB_OBJS) libtracecmd.a: $(TCMD_LIB_OBJS) $(Q)$(do_build_static_lib) -libs: libtracecmd.so libparsevent.so +libs: libtracecmd.so libtraceevent.so trace-util.o: trace_plugin_dir @@ -609,7 +609,7 @@ install_gui: install_cmd gui install_libs: libs $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) - $(Q)$(call do_install,libparsevent.so,$(libdir_SQ)) + $(Q)$(call do_install,libtraceevent.so,$(libdir_SQ)) $(Q)$(call do_install,event-parse.h,$(includedir_SQ)) $(Q)$(call do_install,trace-cmd.h,$(includedir_SQ)) From patchwork Tue Feb 6 08:48:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758495 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f67.google.com ([209.85.160.67]:39338 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752278AbeBFItL (ORCPT ); Tue, 6 Feb 2018 03:49:11 -0500 Received: by mail-pl0-f67.google.com with SMTP id o13so847497pli.6 for ; Tue, 06 Feb 2018 00:49:11 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 02/24] trace-cmd: Move libtraceevent headers in include/traceevent Date: Tue, 6 Feb 2018 10:48:44 +0200 Message-Id: <20180206084906.9854-3-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2173 This patch moves event-parse.h and kbuffer.h in include/traceevent as part of a bigger restructuring plan of trace-cmd's code base. In this case, the new directory will be the "public headers" directory of the traceevent library. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 5 +++-- event-parse.h => include/traceevent/event-parse.h | 0 kbuffer.h => include/traceevent/kbuffer.h | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename event-parse.h => include/traceevent/event-parse.h (100%) rename kbuffer.h => include/traceevent/kbuffer.h (100%) diff --git a/Makefile b/Makefile index a3a60bf..b79f91f 100644 --- a/Makefile +++ b/Makefile @@ -238,6 +238,7 @@ TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) INCLUDES = -I. -I ./include -I $(srctree)/../../include $(CONFIG_INCLUDES) +INCLUDES += -I$(src)/include/traceevent include $(src)/features.mk @@ -610,7 +611,7 @@ install_gui: install_cmd gui install_libs: libs $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) $(Q)$(call do_install,libtraceevent.so,$(libdir_SQ)) - $(Q)$(call do_install,event-parse.h,$(includedir_SQ)) + $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)) $(Q)$(call do_install,trace-cmd.h,$(includedir_SQ)) doc: @@ -640,7 +641,7 @@ PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \ PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0` ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i - swig -Wall -python -noproxy ctracecmd.i + swig -Wall -python -noproxy -I$(src)/include/traceevent ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c $(CC) --shared $(TCMD_LIB_OBJS) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so diff --git a/event-parse.h b/include/traceevent/event-parse.h similarity index 100% rename from event-parse.h rename to include/traceevent/event-parse.h diff --git a/kbuffer.h b/include/traceevent/kbuffer.h similarity index 100% rename from kbuffer.h rename to include/traceevent/kbuffer.h From patchwork Tue Feb 6 08:48:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758497 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f67.google.com ([209.85.160.67]:36618 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752278AbeBFItN (ORCPT ); Tue, 6 Feb 2018 03:49:13 -0500 Received: by mail-pl0-f67.google.com with SMTP id v3so854496plg.3 for ; Tue, 06 Feb 2018 00:49:13 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 03/24] trace-cmd: Move trace-cmd headers in include/trace-cmd Date: Tue, 6 Feb 2018 10:48:45 +0200 Message-Id: <20180206084906.9854-4-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2219 This patch moves trace-cmd.h and trace-hash.h in include/trace-cmd as part of a bigger restructuring plan of trace-cmd's code base. In this case, the new directory will be the "public headers" directory of the trace-cmd library. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 5 +++-- trace-cmd.h => include/trace-cmd/trace-cmd.h | 0 trace-hash.h => include/trace-cmd/trace-hash.h | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename trace-cmd.h => include/trace-cmd/trace-cmd.h (100%) rename trace-hash.h => include/trace-cmd/trace-hash.h (100%) diff --git a/Makefile b/Makefile index b79f91f..1a25aa2 100644 --- a/Makefile +++ b/Makefile @@ -239,6 +239,7 @@ KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) INCLUDES = -I. -I ./include -I $(srctree)/../../include $(CONFIG_INCLUDES) INCLUDES += -I$(src)/include/traceevent +INCLUDES += -I$(src)/include/trace-cmd include $(src)/features.mk @@ -612,7 +613,7 @@ install_libs: libs $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) $(Q)$(call do_install,libtraceevent.so,$(libdir_SQ)) $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)) - $(Q)$(call do_install,trace-cmd.h,$(includedir_SQ)) + $(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)) doc: $(MAKE) -C $(src)/Documentation all @@ -641,7 +642,7 @@ PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \ PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0` ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i - swig -Wall -python -noproxy -I$(src)/include/traceevent ctracecmd.i + swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c $(CC) --shared $(TCMD_LIB_OBJS) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so diff --git a/trace-cmd.h b/include/trace-cmd/trace-cmd.h similarity index 100% rename from trace-cmd.h rename to include/trace-cmd/trace-cmd.h diff --git a/trace-hash.h b/include/trace-cmd/trace-hash.h similarity index 100% rename from trace-hash.h rename to include/trace-cmd/trace-hash.h From patchwork Tue Feb 6 08:48:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758499 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f66.google.com ([209.85.160.66]:40362 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752278AbeBFItP (ORCPT ); Tue, 6 Feb 2018 03:49:15 -0500 Received: by mail-pl0-f66.google.com with SMTP id g18so849217plo.7 for ; Tue, 06 Feb 2018 00:49:15 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 04/24] trace-cmd: Move event-utils.h in lib/traceevent/include Date: Tue, 6 Feb 2018 10:48:46 +0200 Message-Id: <20180206084906.9854-5-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1203 This patch moves event-utils.h in lib/traceevent/include as part of a bigger restructuring plan of trace-cmd's code base. In this case event-utils.h has been moved into the private headers directory the traceevent library. In the next steps, the source files of the traceevent lib will be moved there as well. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 1 + event-utils.h => lib/traceevent/include/event-utils.h | 0 2 files changed, 1 insertion(+) rename event-utils.h => lib/traceevent/include/event-utils.h (100%) diff --git a/Makefile b/Makefile index 1a25aa2..3c21a27 100644 --- a/Makefile +++ b/Makefile @@ -240,6 +240,7 @@ KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) INCLUDES = -I. -I ./include -I $(srctree)/../../include $(CONFIG_INCLUDES) INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd +INCLUDES += -I$(src)/lib/traceevent/include include $(src)/features.mk diff --git a/event-utils.h b/lib/traceevent/include/event-utils.h similarity index 100% rename from event-utils.h rename to lib/traceevent/include/event-utils.h From patchwork Tue Feb 6 08:48:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758501 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f67.google.com ([209.85.160.67]:38201 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752403AbeBFItR (ORCPT ); Tue, 6 Feb 2018 03:49:17 -0500 Received: by mail-pl0-f67.google.com with SMTP id 13so848755plb.5 for ; Tue, 06 Feb 2018 00:49:16 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 05/24] trace-cmd: Extract part of Makefile in scripts/utils.mk Date: Tue, 6 Feb 2018 10:48:47 +0200 Message-Id: <20180206084906.9854-6-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 4796 This patch extracts useful functions for Makefile in order to allow the new Makefiles that will be introduced in the next steps to reuse them. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 57 +++---------------------------------------------- scripts/utils.mk | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 54 deletions(-) create mode 100644 scripts/utils.mk diff --git a/Makefile b/Makefile index 3c21a27..3b5045e 100644 --- a/Makefile +++ b/Makefile @@ -204,10 +204,6 @@ VERSION = $(KS_VERSION) PATCHLEVEL = $(KS_PATCHLEVEL) EXTRAVERSION = $(KS_EXTRAVERSION) -GUI = 'GUI ' -GOBJ = $@ -GSPACE = - REBUILD_GUI = /bin/true G = N = @/bin/true || @@ -223,10 +219,6 @@ VERSION = $(TC_VERSION) PATCHLEVEL = $(TC_PATCHLEVEL) EXTRAVERSION = $(TC_EXTRAVERSION) -GUI = -GSPACE = " " -GOBJ = $(GSPACE)$@ - REBUILD_GUI = $(MAKE) -f $(src)/Makefile BUILDGUI=1 $@ G = $(REBUILD_GUI); /bin/true || N = @@ -234,6 +226,9 @@ endif export Q VERBOSE +# Include the utils +include scripts/utils.mk + TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) @@ -280,52 +275,6 @@ endif override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR) override CFLAGS += $(udis86-flags) $(blk-flags) -ifeq ($(VERBOSE),1) - Q = - print_compile = - print_app_build = - print_fpic_compile = - print_shared_lib_compile = - print_plugin_obj_compile = - print_plugin_build = - print_install = -else - Q = @ - print_compile = echo ' $(GUI)COMPILE '$(GOBJ); - print_app_build = echo ' $(GUI)BUILD '$(GOBJ); - print_fpic_compile = echo ' $(GUI)COMPILE FPIC '$(GOBJ); - print_shared_lib_compile = echo ' $(GUI)COMPILE SHARED LIB '$(GOBJ); - print_plugin_obj_compile = echo ' $(GUI)COMPILE PLUGIN OBJ '$(GOBJ); - print_plugin_build = echo ' $(GUI)BUILD PLUGIN '$(GOBJ); - print_static_lib_build = echo ' $(GUI)BUILD STATIC LIB '$(GOBJ); - print_install = echo ' $(GUI)INSTALL '$(GSPACE)$1' to $(DESTDIR_SQ)$2'; -endif - -do_fpic_compile = \ - ($(print_fpic_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@) - -do_app_build = \ - ($(print_app_build) \ - $(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS)) - -do_compile_shared_library = \ - ($(print_shared_lib_compile) \ - $(CC) --shared $^ -o $@) - -do_compile_plugin_obj = \ - ($(print_plugin_obj_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $<) - -do_plugin_build = \ - ($(print_plugin_build) \ - $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<) - -do_build_static_lib = \ - ($(print_static_lib_build) \ - $(RM) $@; $(AR) rcs $@ $^) - - define check_gui if [ $(BUILDGUI) -ne 1 -a ! -z "$(filter $(gui_objs),$(@))" ]; then \ $(REBUILD_GUI); \ diff --git a/scripts/utils.mk b/scripts/utils.mk new file mode 100644 index 0000000..39cb387 --- /dev/null +++ b/scripts/utils.mk @@ -0,0 +1,64 @@ + +# Utils + +ifeq ($(BUILDGUI), 1) + GUI = 'GUI ' + GOBJ = $@ + GSPACE = +else + GUI = + GSPACE = " " + GOBJ = $(GSPACE)$@ +endif + + +ifeq ($(VERBOSE),1) + Q = + print_compile = + print_app_build = + print_fpic_compile = + print_shared_lib_compile = + print_plugin_obj_compile = + print_plugin_build = + print_install = +else + Q = @ + print_compile = echo ' $(GUI)COMPILE '$(GOBJ); + print_app_build = echo ' $(GUI)BUILD '$(GOBJ); + print_fpic_compile = echo ' $(GUI)COMPILE FPIC '$(GOBJ); + print_shared_lib_compile = echo ' $(GUI)COMPILE SHARED LIB '$(GOBJ); + print_plugin_obj_compile = echo ' $(GUI)COMPILE PLUGIN OBJ '$(GOBJ); + print_plugin_build = echo ' $(GUI)BUILD PLUGIN '$(GOBJ); + print_static_lib_build = echo ' $(GUI)BUILD STATIC LIB '$(GOBJ); + print_install = echo ' $(GUI)INSTALL '$(GSPACE)$1' to $(DESTDIR_SQ)$2'; +endif + + +do_compile = \ + ($(print_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $@) + +do_fpic_compile = \ + ($(print_fpic_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@) + +do_app_build = \ + ($(print_app_build) \ + $(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS)) + +do_build_static_lib = \ + ($(print_static_lib_build) \ + $(RM) $@; $(AR) rcs $@ $^) + +do_compile_shared_library = \ + ($(print_shared_lib_compile) \ + $(CC) --shared $^ -o $@) + +do_compile_plugin_obj = \ + ($(print_plugin_obj_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $<) + +do_plugin_build = \ + ($(print_plugin_build) \ + $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<) + From patchwork Tue Feb 6 08:48:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758503 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f65.google.com ([209.85.160.65]:37000 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbeBFItT (ORCPT ); Tue, 6 Feb 2018 03:49:19 -0500 Received: by mail-pl0-f65.google.com with SMTP id ay8so847058plb.4 for ; Tue, 06 Feb 2018 00:49:19 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 06/24] trace-cmd: Move libtraceevent *.c files in lib/traceevent Date: Tue, 6 Feb 2018 10:48:48 +0200 Message-Id: <20180206084906.9854-7-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 7429 This patch moves all the files belonging to the traceevent lib in a dedicated directory. The build system has been updated to support this by introducing a Makefile in lib/traceevent and by making the parent Makefile to run it with the classic recursive make approach. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 42 ++++++++++++--------- lib/traceevent/Makefile | 45 +++++++++++++++++++++++ event-parse.c => lib/traceevent/event-parse.c | 0 event-plugin.c => lib/traceevent/event-plugin.c | 0 kbuffer-parse.c => lib/traceevent/kbuffer-parse.c | 0 parse-filter.c => lib/traceevent/parse-filter.c | 0 parse-utils.c => lib/traceevent/parse-utils.c | 0 str_error_r.c => lib/traceevent/str_error_r.c | 0 trace-seq.c => lib/traceevent/trace-seq.c | 0 9 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 lib/traceevent/Makefile rename event-parse.c => lib/traceevent/event-parse.c (100%) rename event-plugin.c => lib/traceevent/event-plugin.c (100%) rename kbuffer-parse.c => lib/traceevent/kbuffer-parse.c (100%) rename parse-filter.c => lib/traceevent/parse-filter.c (100%) rename parse-utils.c => lib/traceevent/parse-utils.c (100%) rename str_error_r.c => lib/traceevent/str_error_r.c (100%) rename trace-seq.c => lib/traceevent/trace-seq.c (100%) diff --git a/Makefile b/Makefile index 3b5045e..c18bf2f 100644 --- a/Makefile +++ b/Makefile @@ -181,7 +181,11 @@ bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) python_dir_SQ = $(subst ','\'',$(python_dir)) -LIBS = -L. -ltracecmd -ldl +LIBS = -L. -ldl +LIBTRACEEVENT_DIR = $(obj)/lib/traceevent +LIBTRACEEVENT_STATIC = $(LIBTRACEEVENT_DIR)/libtraceevent.a +LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so + LIB_FILE = libtracecmd.a PACKAGES= gtk+-2.0 libxml-2.0 gthread-2.0 @@ -232,7 +236,7 @@ include scripts/utils.mk TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) -INCLUDES = -I. -I ./include -I $(srctree)/../../include $(CONFIG_INCLUDES) +INCLUDES = -I$(src) -I $(src)/include -I $(srctree)/../../include $(CONFIG_INCLUDES) INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include @@ -244,6 +248,8 @@ CFLAGS ?= -g -Wall CPPFLAGS ?= LDFLAGS ?= +export CFLAGS + # Required CFLAGS override CFLAGS += -D_GNU_SOURCE @@ -303,12 +309,10 @@ TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ trace-capture.o kernel-shark.o -TRACEEVENT_LIB_OBJS = event-parse.o trace-seq.o parse-filter.o parse-utils.o str_error_r.o -TCMD_LIB_OBJS = $(TRACEEVENT_LIB_OBJS) trace-util.o trace-input.o trace-ftrace.o \ +TCMD_LIB_OBJS = trace-util.o trace-input.o trace-ftrace.o \ trace-output.o trace-recorder.o \ trace-usage.o trace-blk-hack.o \ - kbuffer-parse.o event-plugin.o trace-hooks.o \ - trace-msg.o + trace-hooks.o trace-msg.o PLUGIN_OBJS = PLUGIN_OBJS += plugin_jbd2.o @@ -329,7 +333,7 @@ PLUGINS := $(PLUGIN_OBJS:.o=.so) ALL_OBJS = $(TRACE_CMD_OBJS) $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) \ $(TRACE_GRAPH_MAIN_OBJS) $(TCMD_LIB_OBJS) $(PLUGIN_OBJS) -CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h libtraceevent.a $(LIB_FILE) \ +CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h $(LIB_FILE) \ trace-cmd $(PLUGINS) $(BUILD_PYTHON) GUI_TARGETS = ks_version.h trace-graph trace-view kernelshark @@ -370,16 +374,19 @@ trace-view: $(TRACE_VIEW_MAIN_OBJS) trace-graph: $(TRACE_GRAPH_MAIN_OBJS) $(Q)$(G)$(do_app_build) -trace-cmd: libtracecmd.a -kernelshark: libtracecmd.a -trace-view: libtracecmd.a -trace-graph: libtracecmd.a +trace-cmd: libtracecmd.a $(LIBTRACEEVENT_STATIC) +kernelshark: libtracecmd.a $(LIBTRACEEVENT_STATIC) +trace-view: libtracecmd.a $(LIBTRACEEVENT_STATIC) +trace-graph: libtracecmd.a $(LIBTRACEEVENT_STATIC) -libtraceevent.so: $(TRACEEVENT_LIB_OBJS) - $(Q)$(do_compile_shared_library) +$(LIBTRACEEVENT_SHARED): force + $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.so -libtraceevent.a: $(TRACEEVENT_LIB_OBJS) - $(Q)$(do_build_static_lib) +$(LIBTRACEEVENT_STATIC): force + $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.a + +libtraceevent.so: $(LIBTRACEEVENT_SHARED) +libtraceevent.a: $(LIBTRACEEVENT_STATIC) $(TCMD_LIB_OBJS): %.o: $(src)/%.c $(Q)$(do_fpic_compile) @@ -390,7 +397,7 @@ libtracecmd.so: $(TCMD_LIB_OBJS) libtracecmd.a: $(TCMD_LIB_OBJS) $(Q)$(do_build_static_lib) -libs: libtracecmd.so libtraceevent.so +libs: libtracecmd.so $(LIBTRACEEVENT_SHARED) trace-util.o: trace_plugin_dir @@ -561,7 +568,7 @@ install_gui: install_cmd gui install_libs: libs $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) - $(Q)$(call do_install,libtraceevent.so,$(libdir_SQ)) + $(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)) $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)) $(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)) @@ -577,6 +584,7 @@ install_doc: clean: $(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d $(RM) tags TAGS cscope* + $(MAKE) -C $(src)/lib/traceevent clean ##### PYTHON STUFF ##### diff --git a/lib/traceevent/Makefile b/lib/traceevent/Makefile new file mode 100644 index 0000000..f9c595c --- /dev/null +++ b/lib/traceevent/Makefile @@ -0,0 +1,45 @@ + + +include $(src)/scripts/utils.mk + +DEFAULT_TARGET = libtraceevent.a + +OBJS = +OBJS += event-parse.o +OBJS += event-plugin.o +OBJS += kbuffer-parse.o +OBJS += trace-seq.o +OBJS += parse-filter.o +OBJS += parse-utils.o + +# Additional util objects +OBJS += str_error_r.o + +DEPS := $(OBJS:%.o=.%.d) + +all: $(DEFAULT_TARGET) + +libtraceevent.a: $(OBJS) + $(Q)$(call do_build_static_lib) + +libtraceevent.so: $(OBJS) + $(Q)$(call do_compile_shared_library) + +%.o: %.c + $(Q)$(call do_fpic_compile) + +$(DEPS): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(OBJS): %.o : .%.d + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d + +.PHONY: clean diff --git a/event-parse.c b/lib/traceevent/event-parse.c similarity index 100% rename from event-parse.c rename to lib/traceevent/event-parse.c diff --git a/event-plugin.c b/lib/traceevent/event-plugin.c similarity index 100% rename from event-plugin.c rename to lib/traceevent/event-plugin.c diff --git a/kbuffer-parse.c b/lib/traceevent/kbuffer-parse.c similarity index 100% rename from kbuffer-parse.c rename to lib/traceevent/kbuffer-parse.c diff --git a/parse-filter.c b/lib/traceevent/parse-filter.c similarity index 100% rename from parse-filter.c rename to lib/traceevent/parse-filter.c diff --git a/parse-utils.c b/lib/traceevent/parse-utils.c similarity index 100% rename from parse-utils.c rename to lib/traceevent/parse-utils.c diff --git a/str_error_r.c b/lib/traceevent/str_error_r.c similarity index 100% rename from str_error_r.c rename to lib/traceevent/str_error_r.c diff --git a/trace-seq.c b/lib/traceevent/trace-seq.c similarity index 100% rename from trace-seq.c rename to lib/traceevent/trace-seq.c From patchwork Tue Feb 6 08:48:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758505 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pf0-f194.google.com ([209.85.192.194]:35276 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbeBFItV (ORCPT ); Tue, 6 Feb 2018 03:49:21 -0500 Received: by mail-pf0-f194.google.com with SMTP id y9so315983pfl.2 for ; Tue, 06 Feb 2018 00:49:20 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 07/24] trace-cmd: Move trace-hash-local.h in lib/trace-cmd/include Date: Tue, 6 Feb 2018 10:48:49 +0200 Message-Id: <20180206084906.9854-8-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1218 This patch moves trace-hash-local.h in lib/trace-cmd/include, as part of a bigger restructuring plan of trace-cmd's code base. In this case, the new directory in the "private headers" directory in the trace-cmd library. In the next step, the source files of that library will be moved in lib/trace-cmd. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 1 + trace-hash-local.h => lib/trace-cmd/include/trace-hash-local.h | 0 2 files changed, 1 insertion(+) rename trace-hash-local.h => lib/trace-cmd/include/trace-hash-local.h (100%) diff --git a/Makefile b/Makefile index c18bf2f..26b97e5 100644 --- a/Makefile +++ b/Makefile @@ -240,6 +240,7 @@ INCLUDES = -I$(src) -I $(src)/include -I $(srctree)/../../include $(CONFIG_INCLU INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include +INCLUDES += -I$(src)/lib/trace-cmd/include include $(src)/features.mk diff --git a/trace-hash-local.h b/lib/trace-cmd/include/trace-hash-local.h similarity index 100% rename from trace-hash-local.h rename to lib/trace-cmd/include/trace-hash-local.h From patchwork Tue Feb 6 08:48:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758507 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pf0-f195.google.com ([209.85.192.195]:44160 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbeBFItX (ORCPT ); Tue, 6 Feb 2018 03:49:23 -0500 Received: by mail-pf0-f195.google.com with SMTP id 17so316954pfw.11 for ; Tue, 06 Feb 2018 00:49:23 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 08/24] trace-cmd: Move libtracecmd *.c files in lib/trace-cmd Date: Tue, 6 Feb 2018 10:48:50 +0200 Message-Id: <20180206084906.9854-9-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 8689 This patch moves all the source files belonging to the trace-cmd library into the dedicated directory lib/trace-cmd. The build system has been updated to support this new directory structure by adding a dedicated Makefile in lib/trace-cmd and by making the parent Makefile to invoke it. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 54 ++++++++++------------ lib/trace-cmd/Makefile | 45 ++++++++++++++++++ trace-blk-hack.c => lib/trace-cmd/trace-blk-hack.c | 0 trace-ftrace.c => lib/trace-cmd/trace-ftrace.c | 0 trace-hash.c => lib/trace-cmd/trace-hash.c | 0 trace-hooks.c => lib/trace-cmd/trace-hooks.c | 0 trace-input.c => lib/trace-cmd/trace-input.c | 0 trace-recorder.c => lib/trace-cmd/trace-recorder.c | 0 trace-util.c => lib/trace-cmd/trace-util.c | 0 9 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 lib/trace-cmd/Makefile rename trace-blk-hack.c => lib/trace-cmd/trace-blk-hack.c (100%) rename trace-ftrace.c => lib/trace-cmd/trace-ftrace.c (100%) rename trace-hash.c => lib/trace-cmd/trace-hash.c (100%) rename trace-hooks.c => lib/trace-cmd/trace-hooks.c (100%) rename trace-input.c => lib/trace-cmd/trace-input.c (100%) rename trace-recorder.c => lib/trace-cmd/trace-recorder.c (100%) rename trace-util.c => lib/trace-cmd/trace-util.c (100%) diff --git a/Makefile b/Makefile index 26b97e5..2c08162 100644 --- a/Makefile +++ b/Makefile @@ -186,7 +186,9 @@ LIBTRACEEVENT_DIR = $(obj)/lib/traceevent LIBTRACEEVENT_STATIC = $(LIBTRACEEVENT_DIR)/libtraceevent.a LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so -LIB_FILE = libtracecmd.a +LIBTRACECMD_DIR = $(obj)/lib/trace-cmd +LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a +LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so PACKAGES= gtk+-2.0 libxml-2.0 gthread-2.0 @@ -301,8 +303,9 @@ TRACE_GUI_OBJS = trace-filter.o trace-compat.o trace-filter-hash.o trace-dialog. trace-xml.o TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ trace-stack.o trace-hist.o trace-mem.o trace-snapshot.o trace-stat.o \ - trace-hash.o trace-profile.o trace-stream.o trace-record.o trace-restore.o \ - trace-check-events.o trace-show.o trace-list.o + trace-profile.o trace-stream.o trace-record.o trace-restore.o \ + trace-check-events.o trace-show.o trace-list.o \ + trace-output.o trace-usage.o trace-msg.o TRACE_VIEW_OBJS = trace-view.o trace-view-store.o TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o trace-plot-cpu.o trace-plot-task.o TRACE_VIEW_MAIN_OBJS = trace-view-main.o $(TRACE_VIEW_OBJS) $(TRACE_GUI_OBJS) @@ -310,11 +313,6 @@ TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ trace-capture.o kernel-shark.o -TCMD_LIB_OBJS = trace-util.o trace-input.o trace-ftrace.o \ - trace-output.o trace-recorder.o \ - trace-usage.o trace-blk-hack.o \ - trace-hooks.o trace-msg.o - PLUGIN_OBJS = PLUGIN_OBJS += plugin_jbd2.o PLUGIN_OBJS += plugin_hrtimer.o @@ -332,9 +330,9 @@ PLUGIN_OBJS += plugin_tlb.o PLUGINS := $(PLUGIN_OBJS:.o=.so) ALL_OBJS = $(TRACE_CMD_OBJS) $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) \ - $(TRACE_GRAPH_MAIN_OBJS) $(TCMD_LIB_OBJS) $(PLUGIN_OBJS) + $(TRACE_GRAPH_MAIN_OBJS) $(PLUGIN_OBJS) -CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h $(LIB_FILE) \ +CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h \ trace-cmd $(PLUGINS) $(BUILD_PYTHON) GUI_TARGETS = ks_version.h trace-graph trace-view kernelshark @@ -375,10 +373,10 @@ trace-view: $(TRACE_VIEW_MAIN_OBJS) trace-graph: $(TRACE_GRAPH_MAIN_OBJS) $(Q)$(G)$(do_app_build) -trace-cmd: libtracecmd.a $(LIBTRACEEVENT_STATIC) -kernelshark: libtracecmd.a $(LIBTRACEEVENT_STATIC) -trace-view: libtracecmd.a $(LIBTRACEEVENT_STATIC) -trace-graph: libtracecmd.a $(LIBTRACEEVENT_STATIC) +trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) +kernelshark: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) +trace-view: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) +trace-graph: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) $(LIBTRACEEVENT_SHARED): force $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.so @@ -386,21 +384,18 @@ $(LIBTRACEEVENT_SHARED): force $(LIBTRACEEVENT_STATIC): force $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.a +$(LIBTRACECMD_STATIC): force trace_plugin_dir + $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.a + +$(LIBTRACECMD_SHARED): force trace_plugin_dir + $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.so + libtraceevent.so: $(LIBTRACEEVENT_SHARED) libtraceevent.a: $(LIBTRACEEVENT_STATIC) +libtracecmd.a: $(LIBTRACECMD_STATIC) +libtracecmd.so: $(LIBTRACECMD_SHARED) -$(TCMD_LIB_OBJS): %.o: $(src)/%.c - $(Q)$(do_fpic_compile) - -libtracecmd.so: $(TCMD_LIB_OBJS) - $(Q)$(do_compile_shared_library) - -libtracecmd.a: $(TCMD_LIB_OBJS) - $(Q)$(do_build_static_lib) - -libs: libtracecmd.so $(LIBTRACEEVENT_SHARED) - -trace-util.o: trace_plugin_dir +libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED) $(PLUGIN_OBJS): %.o : $(src)/%.c $(Q)$(do_compile_plugin_obj) @@ -568,7 +563,7 @@ install_gui: install_cmd gui $(Q)$(call do_install,kernelshark,$(bindir_SQ)) install_libs: libs - $(Q)$(call do_install,libtracecmd.so,$(libdir_SQ)) + $(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)) $(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)) $(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)) $(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)) @@ -586,6 +581,7 @@ clean: $(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d $(RM) tags TAGS cscope* $(MAKE) -C $(src)/lib/traceevent clean + $(MAKE) -C $(src)/lib/trace-cmd clean ##### PYTHON STUFF ##### @@ -603,9 +599,9 @@ PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0` ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c - $(CC) --shared $(TCMD_LIB_OBJS) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so + $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so -ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIB_FILE) +ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) swig -Wall -python -noproxy ctracecmdgui.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c $(CC) --shared $^ $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile new file mode 100644 index 0000000..dcb5cd5 --- /dev/null +++ b/lib/trace-cmd/Makefile @@ -0,0 +1,45 @@ + + +include $(src)/scripts/utils.mk + +DEFAULT_TARGET = libtracecmd.a + +OBJS = +OBJS += trace-hash.o +OBJS += trace-hooks.o +OBJS += trace-input.o +OBJS += trace-recorder.o +OBJS += trace-util.o + +# Additional util objects +OBJS += trace-blk-hack.o +OBJS += trace-ftrace.o + +DEPS := $(OBJS:%.o=.%.d) + +all: $(DEFAULT_TARGET) + +libtracecmd.a: $(OBJS) + $(Q)$(call do_build_static_lib) + +libtracecmd.so: $(OBJS) + $(Q)$(call do_compile_shared_library) + +%.o: %.c + $(Q)$(call do_fpic_compile) + +$(DEPS): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(OBJS): %.o : .%.d + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d + +.PHONY: clean diff --git a/trace-blk-hack.c b/lib/trace-cmd/trace-blk-hack.c similarity index 100% rename from trace-blk-hack.c rename to lib/trace-cmd/trace-blk-hack.c diff --git a/trace-ftrace.c b/lib/trace-cmd/trace-ftrace.c similarity index 100% rename from trace-ftrace.c rename to lib/trace-cmd/trace-ftrace.c diff --git a/trace-hash.c b/lib/trace-cmd/trace-hash.c similarity index 100% rename from trace-hash.c rename to lib/trace-cmd/trace-hash.c diff --git a/trace-hooks.c b/lib/trace-cmd/trace-hooks.c similarity index 100% rename from trace-hooks.c rename to lib/trace-cmd/trace-hooks.c diff --git a/trace-input.c b/lib/trace-cmd/trace-input.c similarity index 100% rename from trace-input.c rename to lib/trace-cmd/trace-input.c diff --git a/trace-recorder.c b/lib/trace-cmd/trace-recorder.c similarity index 100% rename from trace-recorder.c rename to lib/trace-cmd/trace-recorder.c diff --git a/trace-util.c b/lib/trace-cmd/trace-util.c similarity index 100% rename from trace-util.c rename to lib/trace-cmd/trace-util.c From patchwork Tue Feb 6 08:48:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758509 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pf0-f194.google.com ([209.85.192.194]:39108 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbeBFItZ (ORCPT ); Tue, 6 Feb 2018 03:49:25 -0500 Received: by mail-pf0-f194.google.com with SMTP id l9so316590pfi.6 for ; Tue, 06 Feb 2018 00:49:25 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 09/24] trace-cmd: Move GUI headers in kernel-shark/include Date: Tue, 6 Feb 2018 10:48:51 +0200 Message-Id: <20180206084906.9854-10-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 4848 This patch moves, as part of a bigger code base restructuring, all the header files of kernelshark in a dedicated directory. The next patch will move all of kernelshark's source files in kernel-shark/. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 3 ++- cpu.h => kernel-shark/include/cpu.h | 0 kernel-shark.h => kernel-shark/include/kernel-shark.h | 0 kshark-plugin.h => kernel-shark/include/kshark-plugin.h | 0 trace-capture.h => kernel-shark/include/trace-capture.h | 0 trace-compat.h => kernel-shark/include/trace-compat.h | 0 trace-filter-hash.h => kernel-shark/include/trace-filter-hash.h | 0 trace-filter.h => kernel-shark/include/trace-filter.h | 0 trace-graph.h => kernel-shark/include/trace-graph.h | 0 trace-gui.h => kernel-shark/include/trace-gui.h | 0 trace-view-store.h => kernel-shark/include/trace-view-store.h | 0 trace-view.h => kernel-shark/include/trace-view.h | 0 trace-xml.h => kernel-shark/include/trace-xml.h | 0 13 files changed, 2 insertions(+), 1 deletion(-) rename cpu.h => kernel-shark/include/cpu.h (100%) rename kernel-shark.h => kernel-shark/include/kernel-shark.h (100%) rename kshark-plugin.h => kernel-shark/include/kshark-plugin.h (100%) rename trace-capture.h => kernel-shark/include/trace-capture.h (100%) rename trace-compat.h => kernel-shark/include/trace-compat.h (100%) rename trace-filter-hash.h => kernel-shark/include/trace-filter-hash.h (100%) rename trace-filter.h => kernel-shark/include/trace-filter.h (100%) rename trace-graph.h => kernel-shark/include/trace-graph.h (100%) rename trace-gui.h => kernel-shark/include/trace-gui.h (100%) rename trace-view-store.h => kernel-shark/include/trace-view-store.h (100%) rename trace-view.h => kernel-shark/include/trace-view.h (100%) rename trace-xml.h => kernel-shark/include/trace-xml.h (100%) diff --git a/Makefile b/Makefile index 2c08162..2269a96 100644 --- a/Makefile +++ b/Makefile @@ -243,6 +243,7 @@ INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include INCLUDES += -I$(src)/lib/trace-cmd/include +INCLUDES += -I$(src)/kernel-shark/include include $(src)/features.mk @@ -602,7 +603,7 @@ ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) - swig -Wall -python -noproxy ctracecmdgui.i + swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c $(CC) --shared $^ $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so diff --git a/cpu.h b/kernel-shark/include/cpu.h similarity index 100% rename from cpu.h rename to kernel-shark/include/cpu.h diff --git a/kernel-shark.h b/kernel-shark/include/kernel-shark.h similarity index 100% rename from kernel-shark.h rename to kernel-shark/include/kernel-shark.h diff --git a/kshark-plugin.h b/kernel-shark/include/kshark-plugin.h similarity index 100% rename from kshark-plugin.h rename to kernel-shark/include/kshark-plugin.h diff --git a/trace-capture.h b/kernel-shark/include/trace-capture.h similarity index 100% rename from trace-capture.h rename to kernel-shark/include/trace-capture.h diff --git a/trace-compat.h b/kernel-shark/include/trace-compat.h similarity index 100% rename from trace-compat.h rename to kernel-shark/include/trace-compat.h diff --git a/trace-filter-hash.h b/kernel-shark/include/trace-filter-hash.h similarity index 100% rename from trace-filter-hash.h rename to kernel-shark/include/trace-filter-hash.h diff --git a/trace-filter.h b/kernel-shark/include/trace-filter.h similarity index 100% rename from trace-filter.h rename to kernel-shark/include/trace-filter.h diff --git a/trace-graph.h b/kernel-shark/include/trace-graph.h similarity index 100% rename from trace-graph.h rename to kernel-shark/include/trace-graph.h diff --git a/trace-gui.h b/kernel-shark/include/trace-gui.h similarity index 100% rename from trace-gui.h rename to kernel-shark/include/trace-gui.h diff --git a/trace-view-store.h b/kernel-shark/include/trace-view-store.h similarity index 100% rename from trace-view-store.h rename to kernel-shark/include/trace-view-store.h diff --git a/trace-view.h b/kernel-shark/include/trace-view.h similarity index 100% rename from trace-view.h rename to kernel-shark/include/trace-view.h diff --git a/trace-xml.h b/kernel-shark/include/trace-xml.h similarity index 100% rename from trace-xml.h rename to kernel-shark/include/trace-xml.h From patchwork Tue Feb 6 08:48:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758511 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f67.google.com ([209.85.160.67]:39368 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbeBFIt1 (ORCPT ); Tue, 6 Feb 2018 03:49:27 -0500 Received: by mail-pl0-f67.google.com with SMTP id o13so847849pli.6 for ; Tue, 06 Feb 2018 00:49:27 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 10/24] trace-cmd: Move GUI *.c files in kernel-shark/ Date: Tue, 6 Feb 2018 10:48:52 +0200 Message-Id: <20180206084906.9854-11-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 18219 This patch moves all the source files belonging to the GUI (kernelshark, trace-view and trace-graph) into the dedicated directory kernel-shark/. The build system has been updated to support this new directory structure by adding a separate Makefile in kernel-shark/ and by making the parent Makefile to invoke it. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 190 ++++----------------- kernel-shark/Makefile | 84 +++++++++ kernel-shark.c => kernel-shark/kernel-shark.c | 0 trace-capture.c => kernel-shark/trace-capture.c | 0 trace-compat.c => kernel-shark/trace-compat.c | 0 trace-dialog.c => kernel-shark/trace-dialog.c | 0 .../trace-filter-hash.c | 0 trace-filter.c => kernel-shark/trace-filter.c | 0 .../trace-graph-main.c | 0 trace-graph.c => kernel-shark/trace-graph.c | 0 trace-plot-cpu.c => kernel-shark/trace-plot-cpu.c | 0 .../trace-plot-task.c | 0 trace-plot.c => kernel-shark/trace-plot.c | 0 .../trace-view-main.c | 0 .../trace-view-store.c | 0 trace-view.c => kernel-shark/trace-view.c | 0 trace-xml.c => kernel-shark/trace-xml.c | 0 scripts/utils.mk | 21 +++ 18 files changed, 140 insertions(+), 155 deletions(-) create mode 100644 kernel-shark/Makefile rename kernel-shark.c => kernel-shark/kernel-shark.c (100%) rename trace-capture.c => kernel-shark/trace-capture.c (100%) rename trace-compat.c => kernel-shark/trace-compat.c (100%) rename trace-dialog.c => kernel-shark/trace-dialog.c (100%) rename trace-filter-hash.c => kernel-shark/trace-filter-hash.c (100%) rename trace-filter.c => kernel-shark/trace-filter.c (100%) rename trace-graph-main.c => kernel-shark/trace-graph-main.c (100%) rename trace-graph.c => kernel-shark/trace-graph.c (100%) rename trace-plot-cpu.c => kernel-shark/trace-plot-cpu.c (100%) rename trace-plot-task.c => kernel-shark/trace-plot-task.c (100%) rename trace-plot.c => kernel-shark/trace-plot.c (100%) rename trace-view-main.c => kernel-shark/trace-view-main.c (100%) rename trace-view-store.c => kernel-shark/trace-view-store.c (100%) rename trace-view.c => kernel-shark/trace-view.c (100%) rename trace-xml.c => kernel-shark/trace-xml.c (100%) diff --git a/Makefile b/Makefile index 2269a96..b6a023a 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,6 @@ TC_VERSION = 2 TC_PATCHLEVEL = 7 TC_EXTRAVERSION = -# Kernel Shark version -KS_VERSION = 0 -KS_PATCHLEVEL = 2 -KS_EXTRAVERSION = - # file format version FILE_VERSION = 6 @@ -147,27 +142,9 @@ 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) - $(call build_output, BUILDGUI=1 all_gui) - -$(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 := $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR)) objtree := $(CURDIR) src := $(srctree) @@ -181,7 +158,8 @@ bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) python_dir_SQ = $(subst ','\'',$(python_dir)) -LIBS = -L. -ldl +LIBS = -ldl + LIBTRACEEVENT_DIR = $(obj)/lib/traceevent LIBTRACEEVENT_STATIC = $(LIBTRACEEVENT_DIR)/libtraceevent.a LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so @@ -190,32 +168,8 @@ LIBTRACECMD_DIR = $(obj)/lib/trace-cmd LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so -PACKAGES= gtk+-2.0 libxml-2.0 gthread-2.0 - -ifndef BUILDGUI - BUILDGUI = 0 -endif - -ifeq ($(BUILDGUI), 1) - -CONFIG_INCLUDES = $(shell pkg-config --cflags $(PACKAGES)) -I$(obj) - -CONFIG_FLAGS = -DBUILDGUI \ - -DGTK_VERSION=$(shell pkg-config --modversion gtk+-2.0 | \ - awk 'BEGIN{FS="."}{ a = ($$1 * (2^16)) + $$2 * (2^8) + $$3; printf ("%d", a);}') - -CONFIG_LIBS = $(shell pkg-config --libs $(PACKAGES)) - -VERSION = $(KS_VERSION) -PATCHLEVEL = $(KS_PATCHLEVEL) -EXTRAVERSION = $(KS_EXTRAVERSION) - -REBUILD_GUI = /bin/true -G = -N = @/bin/true || - -CONFIG_FLAGS += $(HELP_DIR_SQ) -else +export LIBS +export LIBTRACEEVENT_DIR LIBTRACECMD_DIR CONFIG_INCLUDES = CONFIG_LIBS = @@ -225,18 +179,14 @@ VERSION = $(TC_VERSION) PATCHLEVEL = $(TC_PATCHLEVEL) EXTRAVERSION = $(TC_EXTRAVERSION) -REBUILD_GUI = $(MAKE) -f $(src)/Makefile BUILDGUI=1 $@ -G = $(REBUILD_GUI); /bin/true || N = -endif -export Q VERBOSE +export Q VERBOSE EXT # Include the utils include scripts/utils.mk TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) -KERNELSHARK_VERSION = $(KS_VERSION).$(KS_PATCHLEVEL).$(KS_EXTRAVERSION) INCLUDES = -I$(src) -I $(src)/include -I $(srctree)/../../include $(CONFIG_INCLUDES) INCLUDES += -I$(src)/include/traceevent @@ -253,6 +203,7 @@ CPPFLAGS ?= LDFLAGS ?= export CFLAGS +export INCLUDES # Required CFLAGS override CFLAGS += -D_GNU_SOURCE @@ -285,34 +236,21 @@ endif override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR) override CFLAGS += $(udis86-flags) $(blk-flags) -define check_gui - if [ $(BUILDGUI) -ne 1 -a ! -z "$(filter $(gui_objs),$(@))" ]; then \ - $(REBUILD_GUI); \ - else \ - $(print_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $(obj)/$@; \ - fi; -endef - $(obj)/%.o: $(src)/%.c - $(Q)$(call check_gui) + $(Q)$(call do_compile) %.o: $(src)/%.c - $(Q)$(call check_gui) + $(Q)$(call do_compile) + +TRACE_VIEW_OBJS = +TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view.o +TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view-store.o -TRACE_GUI_OBJS = trace-filter.o trace-compat.o trace-filter-hash.o trace-dialog.o \ - trace-xml.o TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ trace-stack.o trace-hist.o trace-mem.o trace-snapshot.o trace-stat.o \ trace-profile.o trace-stream.o trace-record.o trace-restore.o \ trace-check-events.o trace-show.o trace-list.o \ trace-output.o trace-usage.o trace-msg.o -TRACE_VIEW_OBJS = trace-view.o trace-view-store.o -TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o trace-plot-cpu.o trace-plot-task.o -TRACE_VIEW_MAIN_OBJS = trace-view-main.o $(TRACE_VIEW_OBJS) $(TRACE_GUI_OBJS) -TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) -KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ - trace-capture.o kernel-shark.o PLUGIN_OBJS = PLUGIN_OBJS += plugin_jbd2.o @@ -330,15 +268,13 @@ PLUGIN_OBJS += plugin_tlb.o PLUGINS := $(PLUGIN_OBJS:.o=.so) -ALL_OBJS = $(TRACE_CMD_OBJS) $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) \ - $(TRACE_GRAPH_MAIN_OBJS) $(PLUGIN_OBJS) +ALL_OBJS = $(TRACE_CMD_OBJS) $(PLUGIN_OBJS) CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h \ trace-cmd $(PLUGINS) $(BUILD_PYTHON) -GUI_TARGETS = ks_version.h trace-graph trace-view kernelshark -TARGETS = $(CMD_TARGETS) $(GUI_TARGETS) +TARGETS = $(CMD_TARGETS) # cpp $(INCLUDES) @@ -353,31 +289,23 @@ all: all_cmd show_gui_make all_cmd: $(CMD_TARGETS) -gui: $(CMD_TARGETS) - $(Q)$(MAKE) -f $(src)/Makefile BUILDGUI=1 all_gui - -all_gui: $(GUI_TARGETS) show_gui_done - -GUI_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS) - -gui_objs := $(sort $(GUI_OBJS)) +gui: force $(CMD_TARGETS) + $(Q)$(MAKE) -C $(src)/kernel-shark; \ + echo "gui build complete" trace-cmd: $(TRACE_CMD_OBJS) $(Q)$(do_app_build) -kernelshark: $(KERNEL_SHARK_OBJS) - $(Q)$(G)$(do_app_build) - -trace-view: $(TRACE_VIEW_MAIN_OBJS) - $(Q)$(G)$(do_app_build) - -trace-graph: $(TRACE_GRAPH_MAIN_OBJS) - $(Q)$(G)$(do_app_build) - trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) -kernelshark: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) -trace-view: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) -trace-graph: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) + +kernelshark: force $(CMD_TARGETS) + $(Q)$(MAKE) -C $(src)/kernel-shark $@ + +trace-view: force $(CMD_TARGETS) + $(Q)$(MAKE) -C $(src)/kernel-shark $@ + +trace-graph: force $(CMD_TARGETS) + $(Q)$(MAKE) -C $(src)/kernel-shark $@ $(LIBTRACEEVENT_SHARED): force $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.so @@ -404,29 +332,6 @@ $(PLUGIN_OBJS): %.o : $(src)/%.c $(PLUGINS): %.so: %.o $(Q)$(do_plugin_build) -define make_version.h - (echo '/* This file is automatically generated. Do not modify. */'; \ - echo \#define VERSION_CODE $(shell \ - expr $(VERSION) \* 256 + $(PATCHLEVEL)); \ - echo '#define EXTRAVERSION ' $(EXTRAVERSION); \ - echo '#define VERSION_STRING "'$(VERSION).$(PATCHLEVEL).$(EXTRAVERSION)'"'; \ - echo '#define FILE_VERSION '$(FILE_VERSION); \ - ) > $1 -endef - -define update_version.h - ($(call make_version.h, $@.tmp); \ - if [ -r $@ ] && cmp -s $@ $@.tmp; then \ - rm -f $@.tmp; \ - else \ - echo ' UPDATE $@'; \ - mv -f $@.tmp $@; \ - fi); -endef - -ks_version.h: force - $(Q)$(G)$(call update_version.h) - tc_version.h: force $(Q)$(N)$(call update_version.h) @@ -450,36 +355,15 @@ trace_python_dir: force all_objs := $(sort $(ALL_OBJS)) all_deps := $(all_objs:%.o=.%.d) -gui_deps := $(gui_objs:%.o=.%.d) -non_gui_deps = $(filter-out $(gui_deps),$(all_deps)) -define check_gui_deps - if [ ! -z "$(filter $(gui_deps),$(@))" ]; then \ - if [ $(BUILDGUI) -ne 1 ]; then \ - $(REBUILD_GUI); \ - else \ - $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; \ - fi \ - elif [ $(BUILDGUI) -eq 0 ]; then \ - $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; \ - else \ - echo SKIPPING $@; \ - fi; -endef - -$(gui_deps): ks_version.h -$(non_gui_deps): tc_version.h +$(all_deps): tc_version.h $(all_deps): .%.d: $(src)/%.c - $(Q)$(call check_gui_deps) + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; $(all_objs) : %.o : .%.d -ifeq ($(BUILDGUI), 1) -dep_includes := $(wildcard $(gui_deps)) -else -dep_includes := $(wildcard $(non_gui_deps)) -endif +dep_includes := $(wildcard $(all_deps)) ifneq ($(dep_includes),) include $(dep_includes) @@ -489,9 +373,6 @@ show_gui_make: @echo "Note: to build the gui, type \"make gui\"" @echo " to build man pages, type \"make doc\"" -show_gui_done: - @echo "gui build complete" - PHONY += show_gui_make define find_tag_files @@ -559,9 +440,9 @@ install: install_cmd @echo " to install man pages, type \"make install_doc\"" install_gui: install_cmd gui - $(Q)$(call do_install,trace-view,$(bindir_SQ)) - $(Q)$(call do_install,trace-graph,$(bindir_SQ)) - $(Q)$(call do_install,kernelshark,$(bindir_SQ)) + $(Q)$(call do_install,$(obj)/kernel-shark/trace-view,$(bindir_SQ)) + $(Q)$(call do_install,$(obj)/kernel-shark/trace-graph,$(bindir_SQ)) + $(Q)$(call do_install,$(obj)/kernel-shark/kernelshark,$(bindir_SQ)) install_libs: libs $(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)) @@ -583,6 +464,7 @@ clean: $(RM) tags TAGS cscope* $(MAKE) -C $(src)/lib/traceevent clean $(MAKE) -C $(src)/lib/trace-cmd clean + $(MAKE) -C $(src)/kernel-shark clean ##### PYTHON STUFF ##### @@ -602,10 +484,10 @@ ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so -ctracecmdgui.so: $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) +ctracecmdgui.so: trace-view $(LIBTRACECMD_STATIC) swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c - $(CC) --shared $^ $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so + $(CC) --shared $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so PHONY += python python: $(PYTHON) @@ -632,8 +514,6 @@ plugin_python.o: %.o : $(src)/%.c trace_python_dir plugin_python.so: %.so: %.o $(Q)$(do_python_plugin_build) -endif # skip-makefile - dist: git archive --format=tar --prefix=trace-cmd-$(TRACECMD_VERSION)/ HEAD \ > ../trace-cmd-$(TRACECMD_VERSION).tar diff --git a/kernel-shark/Makefile b/kernel-shark/Makefile new file mode 100644 index 0000000..247f4d1 --- /dev/null +++ b/kernel-shark/Makefile @@ -0,0 +1,84 @@ +# Kernel Shark version + +VERSION = 0 +PATCHLEVEL = 2 +EXTRAVERSION = +KERNELSHARK_VERSION = $(VERSION).$(PATCHLEVEL).$(EXTRAVERSION) + +BUILDGUI := 1 +include $(src)/scripts/utils.mk + + +PACKAGES = gtk+-2.0 libxml-2.0 gthread-2.0 + +CONFIG_INCLUDES = $(shell pkg-config --cflags $(PACKAGES)) -I$(obj) + +CONFIG_FLAGS = -DBUILDGUI \ + -DGTK_VERSION=$(shell pkg-config --modversion gtk+-2.0 | \ + awk 'BEGIN{FS="."}{ a = ($$1 * (2^16)) + $$2 * (2^8) + $$3; printf ("%d", a);}') + +CONFIG_LIBS = $(shell pkg-config --libs $(PACKAGES)) + +CONFIG_FLAGS += $(HELP_DIR_SQ) + +KS_VERSION := $(obj)/kernel-shark/include/ks_version.h + +GUI_TARGETS = $(KS_VERSION) trace-graph trace-view kernelshark + +TRACE_GUI_OBJS = trace-filter.o trace-compat.o trace-filter-hash.o \ + trace-dialog.o trace-xml.o +TRACE_VIEW_OBJS = trace-view.o trace-view-store.o +TRACE_GRAPH_OBJS = trace-graph.o trace-plot.o trace-plot-cpu.o trace-plot-task.o +TRACE_VIEW_MAIN_OBJS = trace-view-main.o $(TRACE_VIEW_OBJS) $(TRACE_GUI_OBJS) +TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) +KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ + trace-capture.o kernel-shark.o + +GUI_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS) + +all_objs := $(sort $(GUI_OBJS)) +all_deps := $(all_objs:%.o=.%.d) + +# Temporary HACK! +# This hack is OK only until the non-gui builds do not have any config_includes +# nor config flags. In case they do, keeping this hack might be a problem. +override CFLAGS += $(CONFIG_INCLUDES) $(CONFIG_FLAGS) + +LIBS += -L$(LIBTRACEEVENT_DIR) -L$(LIBTRACECMD_DIR) +LIBS += -ltracecmd -ltraceevent -ldl + +all: $(GUI_TARGETS) + +$(KS_VERSION): force + $(Q)$(call update_version.h) + +kernelshark: $(KERNEL_SHARK_OBJS) + $(Q)$(do_app_build) + +trace-view: $(TRACE_VIEW_MAIN_OBJS) + $(Q)$(do_app_build) + +trace-graph: $(TRACE_GRAPH_MAIN_OBJS) + $(Q)$(do_app_build) + +%.o: %.c + $(Q)$(call do_compile) + +$(all_deps): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(all_deps): $(KS_VERSION) + +$(GUI_OBJS): %.o : .%.d + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d $(GUI_TARGETS) + +force: +.PHONY: clean diff --git a/kernel-shark.c b/kernel-shark/kernel-shark.c similarity index 100% rename from kernel-shark.c rename to kernel-shark/kernel-shark.c diff --git a/trace-capture.c b/kernel-shark/trace-capture.c similarity index 100% rename from trace-capture.c rename to kernel-shark/trace-capture.c diff --git a/trace-compat.c b/kernel-shark/trace-compat.c similarity index 100% rename from trace-compat.c rename to kernel-shark/trace-compat.c diff --git a/trace-dialog.c b/kernel-shark/trace-dialog.c similarity index 100% rename from trace-dialog.c rename to kernel-shark/trace-dialog.c diff --git a/trace-filter-hash.c b/kernel-shark/trace-filter-hash.c similarity index 100% rename from trace-filter-hash.c rename to kernel-shark/trace-filter-hash.c diff --git a/trace-filter.c b/kernel-shark/trace-filter.c similarity index 100% rename from trace-filter.c rename to kernel-shark/trace-filter.c diff --git a/trace-graph-main.c b/kernel-shark/trace-graph-main.c similarity index 100% rename from trace-graph-main.c rename to kernel-shark/trace-graph-main.c diff --git a/trace-graph.c b/kernel-shark/trace-graph.c similarity index 100% rename from trace-graph.c rename to kernel-shark/trace-graph.c diff --git a/trace-plot-cpu.c b/kernel-shark/trace-plot-cpu.c similarity index 100% rename from trace-plot-cpu.c rename to kernel-shark/trace-plot-cpu.c diff --git a/trace-plot-task.c b/kernel-shark/trace-plot-task.c similarity index 100% rename from trace-plot-task.c rename to kernel-shark/trace-plot-task.c diff --git a/trace-plot.c b/kernel-shark/trace-plot.c similarity index 100% rename from trace-plot.c rename to kernel-shark/trace-plot.c diff --git a/trace-view-main.c b/kernel-shark/trace-view-main.c similarity index 100% rename from trace-view-main.c rename to kernel-shark/trace-view-main.c diff --git a/trace-view-store.c b/kernel-shark/trace-view-store.c similarity index 100% rename from trace-view-store.c rename to kernel-shark/trace-view-store.c diff --git a/trace-view.c b/kernel-shark/trace-view.c similarity index 100% rename from trace-view.c rename to kernel-shark/trace-view.c diff --git a/trace-xml.c b/kernel-shark/trace-xml.c similarity index 100% rename from trace-xml.c rename to kernel-shark/trace-xml.c diff --git a/scripts/utils.mk b/scripts/utils.mk index 39cb387..abfe115 100644 --- a/scripts/utils.mk +++ b/scripts/utils.mk @@ -62,3 +62,24 @@ do_plugin_build = \ ($(print_plugin_build) \ $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<) + +define make_version.h + (echo '/* This file is automatically generated. Do not modify. */'; \ + echo \#define VERSION_CODE $(shell \ + expr $(VERSION) \* 256 + $(PATCHLEVEL)); \ + echo '#define EXTRAVERSION ' $(EXTRAVERSION); \ + echo '#define VERSION_STRING "'$(VERSION).$(PATCHLEVEL).$(EXTRAVERSION)'"'; \ + echo '#define FILE_VERSION '$(FILE_VERSION); \ + ) > $1 +endef + +define update_version.h + ($(call make_version.h, $@.tmp); \ + if [ -r $@ ] && cmp -s $@ $@.tmp; then \ + rm -f $@.tmp; \ + else \ + echo ' UPDATE $@'; \ + mv -f $@.tmp $@; \ + fi); +endef + From patchwork Tue Feb 6 08:48:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758513 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f67.google.com ([209.85.160.67]:46904 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752263AbeBFIta (ORCPT ); Tue, 6 Feb 2018 03:49:30 -0500 Received: by mail-pl0-f67.google.com with SMTP id 36so834623ple.13 for ; Tue, 06 Feb 2018 00:49:29 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 11/24] trace-cmd: Move plugin_* files in plugins/ Date: Tue, 6 Feb 2018 10:48:53 +0200 Message-Id: <20180206084906.9854-12-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 13907 This patch moves the source files of all plugins to a dedicated directory, as part of a bigger restructuring plan of trace-cmd's code base. The build system has been updated to support this new directory structure by adding a separate Makefile in plugins/ and by making the parent Makefile to invoke it. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 115 ++++++--------------- lib/trace-cmd/Makefile | 2 + plugins/Makefile | 69 +++++++++++++ plugin_blk.c => plugins/plugin_blk.c | 0 plugin_cfg80211.c => plugins/plugin_cfg80211.c | 0 plugin_function.c => plugins/plugin_function.c | 0 plugin_hrtimer.c => plugins/plugin_hrtimer.c | 0 plugin_jbd2.c => plugins/plugin_jbd2.c | 0 plugin_kmem.c => plugins/plugin_kmem.c | 0 plugin_kvm.c => plugins/plugin_kvm.c | 0 plugin_mac80211.c => plugins/plugin_mac80211.c | 0 plugin_python.c => plugins/plugin_python.c | 0 .../plugin_sched_switch.c | 0 plugin_scsi.c => plugins/plugin_scsi.c | 0 plugin_tlb.c => plugins/plugin_tlb.c | 0 plugin_xen.c => plugins/plugin_xen.c | 0 scripts/utils.mk | 32 ++++++ 17 files changed, 135 insertions(+), 83 deletions(-) create mode 100644 plugins/Makefile rename plugin_blk.c => plugins/plugin_blk.c (100%) rename plugin_cfg80211.c => plugins/plugin_cfg80211.c (100%) rename plugin_function.c => plugins/plugin_function.c (100%) rename plugin_hrtimer.c => plugins/plugin_hrtimer.c (100%) rename plugin_jbd2.c => plugins/plugin_jbd2.c (100%) rename plugin_kmem.c => plugins/plugin_kmem.c (100%) rename plugin_kvm.c => plugins/plugin_kvm.c (100%) rename plugin_mac80211.c => plugins/plugin_mac80211.c (100%) rename plugin_python.c => plugins/plugin_python.c (100%) rename plugin_sched_switch.c => plugins/plugin_sched_switch.c (100%) rename plugin_scsi.c => plugins/plugin_scsi.c (100%) rename plugin_tlb.c => plugins/plugin_tlb.c (100%) rename plugin_xen.c => plugins/plugin_xen.c (100%) diff --git a/Makefile b/Makefile index b6a023a..2dfb8fd 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,12 @@ PYTHON_DIR_SQ = '$(subst ','\'',$(PYTHON_DIR))' var_dir = /var endif +# Shell quotes +bindir_SQ = $(subst ','\'',$(bindir)) +bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) +plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) +python_dir_SQ = $(subst ','\'',$(python_dir)) + VAR_DIR = -DVAR_DIR="$(var_dir)" VAR_DIR_SQ = '$(subst ','\'',$(VAR_DIR))' var_dir_SQ = '$(subst ','\'',$(var_dir))' @@ -76,6 +82,10 @@ HELP_DIR_SQ = '$(subst ','\'',$(HELP_DIR))' BASH_COMPLETE_DIR ?= /etc/bash_completion.d +export PLUGIN_DIR +export PYTHON_DIR +export PYTHON_DIR_SQ +export plugin_dir_SQ export var_dir # copy a bit from Linux kbuild @@ -109,6 +119,8 @@ ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && whic endif endif # NO_PYTHON +export PYTHON_PLUGINS + # $(call test-build, snippet, ret) -> ret if snippet compiles # -> empty otherwise test-build = $(if $(shell sh -c 'echo "$(1)" | \ @@ -152,12 +164,6 @@ obj := $(objtree) export prefix bindir src obj -# Shell quotes -bindir_SQ = $(subst ','\'',$(bindir)) -bindir_relative_SQ = $(subst ','\'',$(bindir_relative)) -plugin_dir_SQ = $(subst ','\'',$(plugin_dir)) -python_dir_SQ = $(subst ','\'',$(python_dir)) - LIBS = -ldl LIBTRACEEVENT_DIR = $(obj)/lib/traceevent @@ -252,26 +258,9 @@ TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-lis trace-check-events.o trace-show.o trace-list.o \ trace-output.o trace-usage.o trace-msg.o -PLUGIN_OBJS = -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 -PLUGIN_OBJS += plugin_blk.o -PLUGIN_OBJS += plugin_tlb.o +ALL_OBJS = $(TRACE_CMD_OBJS) -PLUGINS := $(PLUGIN_OBJS:.o=.so) - -ALL_OBJS = $(TRACE_CMD_OBJS) $(PLUGIN_OBJS) - -CMD_TARGETS = trace_plugin_dir trace_python_dir tc_version.h \ - trace-cmd $(PLUGINS) $(BUILD_PYTHON) +CMD_TARGETS = tc_version.h trace-cmd $(BUILD_PYTHON) TARGETS = $(CMD_TARGETS) @@ -285,7 +274,7 @@ TARGETS = $(CMD_TARGETS) # If you want kernelshark, then do: make gui ### -all: all_cmd show_gui_make +all: all_cmd plugins show_gui_make all_cmd: $(CMD_TARGETS) @@ -313,10 +302,10 @@ $(LIBTRACEEVENT_SHARED): force $(LIBTRACEEVENT_STATIC): force $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.a -$(LIBTRACECMD_STATIC): force trace_plugin_dir +$(LIBTRACECMD_STATIC): force $(obj)/plugins/trace_plugin_dir $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.a -$(LIBTRACECMD_SHARED): force trace_plugin_dir +$(LIBTRACECMD_SHARED): force $(obj)/plugins/trace_plugin_dir $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.so libtraceevent.so: $(LIBTRACEEVENT_SHARED) @@ -326,30 +315,18 @@ libtracecmd.so: $(LIBTRACECMD_SHARED) libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED) -$(PLUGIN_OBJS): %.o : $(src)/%.c - $(Q)$(do_compile_plugin_obj) - -$(PLUGINS): %.so: %.o - $(Q)$(do_plugin_build) +plugins: force $(obj)/plugins/trace_plugin_dir $(obj)/plugins/trace_python_dir + $(Q)$(MAKE) -C $(src)/plugins tc_version.h: force $(Q)$(N)$(call update_version.h) -define update_dir - (echo $1 > $@.tmp; \ - if [ -r $@ ] && cmp -s $@ $@.tmp; then \ - rm -f $@.tmp; \ - else \ - echo ' UPDATE $@'; \ - mv -f $@.tmp $@; \ - fi); -endef +$(obj)/plugins/trace_plugin_dir: force + $(Q)$(MAKE) -C $(src)/plugins trace_plugin_dir -trace_plugin_dir: force - $(Q)$(N)$(call update_dir, 'PLUGIN_DIR=$(PLUGIN_DIR)') +$(obj)/plugins/trace_python_dir: force + $(Q)$(MAKE) -C $(src)/plugins trace_python_dir -trace_python_dir: force - $(Q)$(N)$(call update_dir, 'PYTHON_DIR=$(PYTHON_DIR)') ## make deps @@ -392,28 +369,8 @@ cscope: force $(RM) cscope* $(call find_tag_files) | cscope -b -q -PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS)) $(subst .so,.install,$(PYTHON_PLUGINS)) - -define do_install - $(print_install) \ - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ - fi; \ - $(INSTALL) $1 '$(DESTDIR_SQ)$2' -endef - -define do_install_data - $(print_install) \ - if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ - $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ - fi; \ - $(INSTALL) -m 644 $1 '$(DESTDIR_SQ)$2' -endef - -$(PLUGINS_INSTALL): %.install : %.so force - $(Q)$(call do_install_data,$<,$(plugin_dir_SQ)) - -install_plugins: $(PLUGINS_INSTALL) +install_plugins: force + $(Q)$(MAKE) -C $(src)/plugins $@ $(PYTHON_SO_INSTALL): %.install : %.so force $(Q)$(call do_install_data,$<,$(python_dir_SQ)) @@ -465,6 +422,7 @@ clean: $(MAKE) -C $(src)/lib/traceevent clean $(MAKE) -C $(src)/lib/trace-cmd clean $(MAKE) -C $(src)/kernel-shark clean + $(MAKE) -C $(src)/plugins clean ##### PYTHON STUFF ##### @@ -479,6 +437,10 @@ PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \ $(shell python2 -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LINKFORSHARED')") PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0` +export PYTHON_INCLUDES +export PYTHON_LDFLAGS +export PYGTK_CFLAGS + ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c @@ -498,21 +460,8 @@ python-gui: $(PYTHON_GUI) PHONY += python-plugin python-plugin: $(PYTHON_PLUGINS) -CFLAGS_plugin_python.o += $(PYTHON_DIR_SQ) - -do_compile_python_plugin_obj = \ - ($(print_plugin_obj_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$@) $(PYTHON_INCLUDES) -fPIC -o $@ $<) - -do_python_plugin_build = \ - ($(print_plugin_build) \ - $(CC) $< -shared $(LDFLAGS) $(PYTHON_LDFLAGS) -o $@) - -plugin_python.o: %.o : $(src)/%.c trace_python_dir - $(Q)$(do_compile_python_plugin_obj) - -plugin_python.so: %.so: %.o - $(Q)$(do_python_plugin_build) +plugin_python.so: force $(obj)/plugins/trace_python_dir + $(Q)$(MAKE) -C $(src)/plugins plugin_python.so dist: git archive --format=tar --prefix=trace-cmd-$(TRACECMD_VERSION)/ HEAD \ diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile index dcb5cd5..e8fb088 100644 --- a/lib/trace-cmd/Makefile +++ b/lib/trace-cmd/Makefile @@ -28,6 +28,8 @@ libtracecmd.so: $(OBJS) %.o: %.c $(Q)$(call do_fpic_compile) +trace-util.o: $(obj)/plugins/trace_plugin_dir + $(DEPS): .%.d: %.c $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ diff --git a/plugins/Makefile b/plugins/Makefile new file mode 100644 index 0000000..7a09b82 --- /dev/null +++ b/plugins/Makefile @@ -0,0 +1,69 @@ +include $(src)/scripts/utils.mk + +PLUGIN_OBJS = +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 +PLUGIN_OBJS += plugin_blk.o +PLUGIN_OBJS += plugin_tlb.o + +PLUGINS := $(PLUGIN_OBJS:.o=.so) +DEPS := $(PLUGIN_OBJS:%.o=.%.d) + +all: $(PLUGINS) + +$(PLUGIN_OBJS): %.o : %.c + $(Q)$(do_compile_plugin_obj) + +$(PLUGINS): %.so: %.o + $(Q)$(do_plugin_build) + +$(DEPS): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(PLUGIN_OBJS): %.o : .%.d + +CFLAGS_plugin_python.o += $(PYTHON_DIR_SQ) + +plugin_python.o: %.o : %.c trace_python_dir + $(Q)$(do_compile_python_plugin_obj) + +plugin_python.so: %.so: %.o + $(Q)$(do_python_plugin_build) + +PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS)) $(subst .so,.install,$(PYTHON_PLUGINS)) + +$(PLUGINS_INSTALL): %.install : %.so force + $(Q)$(call do_install_data,$<,$(plugin_dir_SQ)) + +install_plugins: $(PLUGINS_INSTALL) + +# The following targets are necessary to trigger a rebuild when $(PLUGIN_DIR) +# and $(PYTHON_DIR) change. Without them, a full clean build would necessary +# in order to get the binaries updated. + +trace_plugin_dir: force + $(Q)$(N)$(call update_dir, 'PLUGIN_DIR=$(PLUGIN_DIR)') + +trace_python_dir: force + $(Q)$(N)$(call update_dir, 'PYTHON_DIR=$(PYTHON_DIR)') + + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d trace_plugin_dir trace_python_dir + +force: +.PHONY: clean force \ No newline at end of file diff --git a/plugin_blk.c b/plugins/plugin_blk.c similarity index 100% rename from plugin_blk.c rename to plugins/plugin_blk.c diff --git a/plugin_cfg80211.c b/plugins/plugin_cfg80211.c similarity index 100% rename from plugin_cfg80211.c rename to plugins/plugin_cfg80211.c diff --git a/plugin_function.c b/plugins/plugin_function.c similarity index 100% rename from plugin_function.c rename to plugins/plugin_function.c diff --git a/plugin_hrtimer.c b/plugins/plugin_hrtimer.c similarity index 100% rename from plugin_hrtimer.c rename to plugins/plugin_hrtimer.c diff --git a/plugin_jbd2.c b/plugins/plugin_jbd2.c similarity index 100% rename from plugin_jbd2.c rename to plugins/plugin_jbd2.c diff --git a/plugin_kmem.c b/plugins/plugin_kmem.c similarity index 100% rename from plugin_kmem.c rename to plugins/plugin_kmem.c diff --git a/plugin_kvm.c b/plugins/plugin_kvm.c similarity index 100% rename from plugin_kvm.c rename to plugins/plugin_kvm.c diff --git a/plugin_mac80211.c b/plugins/plugin_mac80211.c similarity index 100% rename from plugin_mac80211.c rename to plugins/plugin_mac80211.c diff --git a/plugin_python.c b/plugins/plugin_python.c similarity index 100% rename from plugin_python.c rename to plugins/plugin_python.c diff --git a/plugin_sched_switch.c b/plugins/plugin_sched_switch.c similarity index 100% rename from plugin_sched_switch.c rename to plugins/plugin_sched_switch.c diff --git a/plugin_scsi.c b/plugins/plugin_scsi.c similarity index 100% rename from plugin_scsi.c rename to plugins/plugin_scsi.c diff --git a/plugin_tlb.c b/plugins/plugin_tlb.c similarity index 100% rename from plugin_tlb.c rename to plugins/plugin_tlb.c diff --git a/plugin_xen.c b/plugins/plugin_xen.c similarity index 100% rename from plugin_xen.c rename to plugins/plugin_xen.c diff --git a/scripts/utils.mk b/scripts/utils.mk index abfe115..31fc9e9 100644 --- a/scripts/utils.mk +++ b/scripts/utils.mk @@ -62,6 +62,13 @@ do_plugin_build = \ ($(print_plugin_build) \ $(CC) $(CFLAGS) $(LDFLAGS) -shared -nostartfiles -o $@ $<) +do_compile_python_plugin_obj = \ + ($(print_plugin_obj_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$@) $(PYTHON_INCLUDES) -fPIC -o $@ $<) + +do_python_plugin_build = \ + ($(print_plugin_build) \ + $(CC) $< -shared $(LDFLAGS) $(PYTHON_LDFLAGS) -o $@) define make_version.h (echo '/* This file is automatically generated. Do not modify. */'; \ @@ -83,3 +90,28 @@ define update_version.h fi); endef +define update_dir + (echo $1 > $@.tmp; \ + if [ -r $@ ] && cmp -s $@ $@.tmp; then \ + rm -f $@.tmp; \ + else \ + echo ' UPDATE $@'; \ + mv -f $@.tmp $@; \ + fi); +endef + +define do_install + $(print_install) \ + if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + fi; \ + $(INSTALL) $1 '$(DESTDIR_SQ)$2' +endef + +define do_install_data + $(print_install) \ + if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ + fi; \ + $(INSTALL) -m 644 $1 '$(DESTDIR_SQ)$2' +endef From patchwork Tue Feb 6 08:48:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758515 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pg0-f65.google.com ([74.125.83.65]:42848 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752324AbeBFItb (ORCPT ); Tue, 6 Feb 2018 03:49:31 -0500 Received: by mail-pg0-f65.google.com with SMTP id m28so824770pgc.9 for ; Tue, 06 Feb 2018 00:49:31 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 12/24] trace-cmd: Fix the broken target ctracecmdgui.so Date: Tue, 6 Feb 2018 10:48:54 +0200 Message-Id: <20180206084906.9854-13-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2220 Currenly the ctracecmdgui.so target is broken beacause the object files trace-view.o trace-view-store.o are not built with -fPIC. This patch just fixes the kernel-shark/Makefile in order to those files to be built with -fPIC. Signed-off-by: Vladislav Valtchev (VMware) --- kernel-shark/Makefile | 10 +++++++--- scripts/utils.mk | 10 +++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel-shark/Makefile b/kernel-shark/Makefile index 247f4d1..8e3ba8b 100644 --- a/kernel-shark/Makefile +++ b/kernel-shark/Makefile @@ -34,9 +34,11 @@ TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ trace-capture.o kernel-shark.o -GUI_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS) +ALL_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS) +PIC_OBJS = $(TRACE_VIEW_OBJS) -all_objs := $(sort $(GUI_OBJS)) +all_objs := $(sort $(ALL_OBJS)) +pic_objs = $(sort $(PIC_OBJS)) all_deps := $(all_objs:%.o=.%.d) # Temporary HACK! @@ -61,6 +63,8 @@ trace-view: $(TRACE_VIEW_MAIN_OBJS) trace-graph: $(TRACE_GRAPH_MAIN_OBJS) $(Q)$(do_app_build) +$(pic_objs): GENERATE_PIC := 1 + %.o: %.c $(Q)$(call do_compile) @@ -69,7 +73,7 @@ $(all_deps): .%.d: %.c $(all_deps): $(KS_VERSION) -$(GUI_OBJS): %.o : .%.d +$(all_objs): %.o : .%.d dep_includes := $(wildcard $(DEPS)) diff --git a/scripts/utils.mk b/scripts/utils.mk index 31fc9e9..043a68a 100644 --- a/scripts/utils.mk +++ b/scripts/utils.mk @@ -33,15 +33,15 @@ else print_install = echo ' $(GUI)INSTALL '$(GSPACE)$1' to $(DESTDIR_SQ)$2'; endif - -do_compile = \ - ($(print_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $@) - do_fpic_compile = \ ($(print_fpic_compile) \ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) -fPIC $< -o $@) +do_compile = \ + ($(if $(GENERATE_PIC), $(do_fpic_compile), \ + $(print_compile) \ + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(EXT) $< -o $@)) + do_app_build = \ ($(print_app_build) \ $(CC) $^ -rdynamic -o $@ $(LDFLAGS) $(CONFIG_LIBS) $(LIBS)) From patchwork Tue Feb 6 08:48:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758517 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pf0-f196.google.com ([209.85.192.196]:35293 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270AbeBFItd (ORCPT ); Tue, 6 Feb 2018 03:49:33 -0500 Received: by mail-pf0-f196.google.com with SMTP id y9so316166pfl.2 for ; Tue, 06 Feb 2018 00:49:33 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 13/24] trace-cmd: Move python-related files in python/ Date: Tue, 6 Feb 2018 10:48:55 +0200 Message-Id: <20180206084906.9854-14-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 7205 This patch moves all the files related with trace-cmd's python support to a dedicated directory, as part of a bigger restructuring plan of trace-cmd's code base. The build system has been updated to support this new directory structure by adding a separate Makefile in python/ and by making the parent Makefile to invoke it. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 42 +++++++++---------------------- python/Makefile | 40 +++++++++++++++++++++++++++++ ctracecmd.i => python/ctracecmd.i | 0 ctracecmdgui.i => python/ctracecmdgui.i | 0 event-viewer.py => python/event-viewer.py | 0 tracecmd.py => python/tracecmd.py | 0 tracecmdgui.py => python/tracecmdgui.py | 0 7 files changed, 52 insertions(+), 30 deletions(-) create mode 100644 python/Makefile rename ctracecmd.i => python/ctracecmd.i (100%) rename ctracecmdgui.i => python/ctracecmdgui.i (100%) rename event-viewer.py => python/event-viewer.py (100%) rename tracecmd.py => python/tracecmd.py (100%) rename tracecmdgui.py => python/tracecmdgui.py (100%) diff --git a/Makefile b/Makefile index 2dfb8fd..b1f4c2c 100644 --- a/Makefile +++ b/Makefile @@ -113,13 +113,12 @@ PYTHON_VERS ?= python ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && which swig && echo y"), y) PYTHON_PLUGINS := plugin_python.so BUILD_PYTHON := $(PYTHON) $(PYTHON_PLUGINS) - PYTHON_SO_INSTALL := ctracecmd.install - PYTHON_PY_PROGS := event-viewer.install - PYTHON_PY_LIBS := tracecmd.install tracecmdgui.install + BUILD_PYTHON_WORKS := 1 endif endif # NO_PYTHON export PYTHON_PLUGINS +export BUILD_PYTHON_WORKS # $(call test-build, snippet, ret) -> ret if snippet compiles # -> empty otherwise @@ -176,6 +175,7 @@ LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so export LIBS export LIBTRACEEVENT_DIR LIBTRACECMD_DIR +export LIBTRACECMD_STATIC LIBTRACECMD_SHARED CONFIG_INCLUDES = CONFIG_LIBS = @@ -248,10 +248,6 @@ $(obj)/%.o: $(src)/%.c %.o: $(src)/%.c $(Q)$(call do_compile) -TRACE_VIEW_OBJS = -TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view.o -TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view-store.o - TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ trace-stack.o trace-hist.o trace-mem.o trace-snapshot.o trace-stat.o \ trace-profile.o trace-stream.o trace-record.o trace-restore.o \ @@ -372,19 +368,8 @@ cscope: force install_plugins: force $(Q)$(MAKE) -C $(src)/plugins $@ -$(PYTHON_SO_INSTALL): %.install : %.so force - $(Q)$(call do_install_data,$<,$(python_dir_SQ)) - -$(PYTHON_PY_PROGS): %.install : %.py force - $(Q)$(call do_install,$<,$(python_dir_SQ)) - -$(PYTHON_PY_LIBS): %.install : %.py force - $(Q)$(call do_install_data,$<,$(python_dir_SQ)) - -$(PYTHON_PY_PLUGINS): %.install : %.py force - $(Q)$(call do_install_data,$<,$(plugin_dir_SQ)) - -install_python: $(PYTHON_SO_INSTALL) $(PYTHON_PY_PROGS) $(PYTHON_PY_LIBS) $(PYTHON_PY_PLUGINS) +install_python: force + $(Q)$(MAKE) -C $(src)/python $@ install_bash_completion: force $(Q)$(call do_install_data,trace-cmd.bash,$(BASH_COMPLETE_DIR)) @@ -417,19 +402,20 @@ install_doc: $(MAKE) -C $(src)/Documentation install clean: - $(RM) *.o *~ $(TARGETS) *.a *.so ctracecmd_wrap.c .*.d + $(RM) *.o *~ $(TARGETS) *.a *.so .*.d $(RM) tags TAGS cscope* $(MAKE) -C $(src)/lib/traceevent clean $(MAKE) -C $(src)/lib/trace-cmd clean $(MAKE) -C $(src)/kernel-shark clean $(MAKE) -C $(src)/plugins clean + $(MAKE) -C $(src)/python clean ##### PYTHON STUFF ##### report_noswig: force $(Q)echo - $(Q)echo " NO_PYTHON forced: swig not installed, not compling python plugins" + $(Q)echo " NO_PYTHON forced: swig not installed, not compiling python plugins" $(Q)echo PYTHON_INCLUDES = `pkg-config --cflags $(PYTHON_VERS)` @@ -441,15 +427,11 @@ export PYTHON_INCLUDES export PYTHON_LDFLAGS export PYGTK_CFLAGS -ctracecmd.so: $(TCMD_LIB_OBJS) ctracecmd.i - swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i - $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c - $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so +ctracecmd.so: force $(LIBTRACECMD_STATIC) + $(Q)$(MAKE) -C $(src)/python $@ -ctracecmdgui.so: trace-view $(LIBTRACECMD_STATIC) - swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i - $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c - $(CC) --shared $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so +ctracecmdgui.so: force $(LIBTRACECMD_STATIC) trace-view + $(Q)$(MAKE) -C $(src)/python $@ PHONY += python python: $(PYTHON) diff --git a/python/Makefile b/python/Makefile new file mode 100644 index 0000000..b07c0d8 --- /dev/null +++ b/python/Makefile @@ -0,0 +1,40 @@ +include $(src)/scripts/utils.mk + +TRACE_VIEW_OBJS = +TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view.o +TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view-store.o + +ifdef BUILD_PYTHON_WORKS +PYTHON_SO_INSTALL := ctracecmd.install +PYTHON_PY_PROGS := event-viewer.install +PYTHON_PY_LIBS := tracecmd.install tracecmdgui.install +endif + +ctracecmd.so: ctracecmd.i $(LIBTRACECMD_STATIC) + swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i + $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c + $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so + +ctracecmdgui.so: ctracecmdgui.i $(LIBTRACECMD_STATIC) $(TRACE_VIEW_OBJS) + swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i + $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c + $(CC) --shared $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so + + +$(PYTHON_SO_INSTALL): %.install : %.so force + $(Q)$(call do_install_data,$<,$(python_dir_SQ)) + +$(PYTHON_PY_PROGS): %.install : %.py force + $(Q)$(call do_install,$<,$(python_dir_SQ)) + +$(PYTHON_PY_LIBS): %.install : %.py force + $(Q)$(call do_install_data,$<,$(python_dir_SQ)) + +install_python: $(PYTHON_SO_INSTALL) $(PYTHON_PY_PROGS) $(PYTHON_PY_LIBS) + + +clean: + $(RM) *.a *.so *.o .*.d ctracecmd_wrap.* ctracecmdgui_wrap.* + +force: +.PHONY: clean force diff --git a/ctracecmd.i b/python/ctracecmd.i similarity index 100% rename from ctracecmd.i rename to python/ctracecmd.i diff --git a/ctracecmdgui.i b/python/ctracecmdgui.i similarity index 100% rename from ctracecmdgui.i rename to python/ctracecmdgui.i diff --git a/event-viewer.py b/python/event-viewer.py similarity index 100% rename from event-viewer.py rename to python/event-viewer.py diff --git a/tracecmd.py b/python/tracecmd.py similarity index 100% rename from tracecmd.py rename to python/tracecmd.py diff --git a/tracecmdgui.py b/python/tracecmdgui.py similarity index 100% rename from tracecmdgui.py rename to python/tracecmdgui.py From patchwork Tue Feb 6 08:48:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758519 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pf0-f194.google.com ([209.85.192.194]:42242 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752263AbeBFItf (ORCPT ); Tue, 6 Feb 2018 03:49:35 -0500 Received: by mail-pf0-f194.google.com with SMTP id b25so317714pfd.9 for ; Tue, 06 Feb 2018 00:49:35 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 14/24] trace-cmd: Move tracecmd headers in tracecmd/include Date: Tue, 6 Feb 2018 10:48:56 +0200 Message-Id: <20180206084906.9854-15-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1989 This patch moves trace-cmd's private headers in a dedicated directory called tracecmd/include, as part of a bigger restructuring plan of trace-cmd's code base. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 1 + bug.h => tracecmd/include/bug.h | 0 list.h => tracecmd/include/list.h | 0 trace-cmd-local.h => tracecmd/include/trace-cmd-local.h | 0 trace-local.h => tracecmd/include/trace-local.h | 0 trace-msg.h => tracecmd/include/trace-msg.h | 0 6 files changed, 1 insertion(+) rename bug.h => tracecmd/include/bug.h (100%) rename list.h => tracecmd/include/list.h (100%) rename trace-cmd-local.h => tracecmd/include/trace-cmd-local.h (100%) rename trace-local.h => tracecmd/include/trace-local.h (100%) rename trace-msg.h => tracecmd/include/trace-msg.h (100%) diff --git a/Makefile b/Makefile index b1f4c2c..4e604b4 100644 --- a/Makefile +++ b/Makefile @@ -200,6 +200,7 @@ INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include INCLUDES += -I$(src)/lib/trace-cmd/include INCLUDES += -I$(src)/kernel-shark/include +INCLUDES += -I$(src)/tracecmd/include include $(src)/features.mk diff --git a/bug.h b/tracecmd/include/bug.h similarity index 100% rename from bug.h rename to tracecmd/include/bug.h diff --git a/list.h b/tracecmd/include/list.h similarity index 100% rename from list.h rename to tracecmd/include/list.h diff --git a/trace-cmd-local.h b/tracecmd/include/trace-cmd-local.h similarity index 100% rename from trace-cmd-local.h rename to tracecmd/include/trace-cmd-local.h diff --git a/trace-local.h b/tracecmd/include/trace-local.h similarity index 100% rename from trace-local.h rename to tracecmd/include/trace-local.h diff --git a/trace-msg.h b/tracecmd/include/trace-msg.h similarity index 100% rename from trace-msg.h rename to tracecmd/include/trace-msg.h From patchwork Tue Feb 6 08:48:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758521 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pf0-f195.google.com ([209.85.192.195]:35296 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752324AbeBFIth (ORCPT ); Tue, 6 Feb 2018 03:49:37 -0500 Received: by mail-pf0-f195.google.com with SMTP id y9so316208pfl.2 for ; Tue, 06 Feb 2018 00:49:37 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 15/24] trace-cmd: Move version.h in include/ Date: Tue, 6 Feb 2018 10:48:57 +0200 Message-Id: <20180206084906.9854-16-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: This trivial patch just moves the only header file remained in project's root directory to the include/ directory, common for all of the trace-cmd's sub-projects. Signed-off-by: Vladislav Valtchev (VMware) --- version.h => include/version.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename version.h => include/version.h (100%) diff --git a/version.h b/include/version.h similarity index 100% rename from version.h rename to include/version.h From patchwork Tue Feb 6 08:48:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758527 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pg0-f67.google.com ([74.125.83.67]:41227 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752298AbeBFItk (ORCPT ); Tue, 6 Feb 2018 03:49:40 -0500 Received: by mail-pg0-f67.google.com with SMTP id 141so827789pgd.8 for ; Tue, 06 Feb 2018 00:49:39 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 16/24] trace-cmd: Move trace-cmd app files in tracecmd/ Date: Tue, 6 Feb 2018 10:48:58 +0200 Message-Id: <20180206084906.9854-17-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 11478 This patch moves all the remaining C files in the project's root directory to tracecmd, a directory dedicated to the trace-cmd application itself. This patch completes the bigger restructuring plan of trace-cmd's code base. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 77 +++++----------------- tracecmd/Makefile | 73 ++++++++++++++++++++ .../trace-check-events.c | 0 trace-cmd.bash => tracecmd/trace-cmd.bash | 0 trace-cmd.c => tracecmd/trace-cmd.c | 0 trace-hist.c => tracecmd/trace-hist.c | 0 trace-list.c => tracecmd/trace-list.c | 0 trace-listen.c => tracecmd/trace-listen.c | 0 trace-mem.c => tracecmd/trace-mem.c | 0 trace-msg.c => tracecmd/trace-msg.c | 0 trace-output.c => tracecmd/trace-output.c | 0 trace-profile.c => tracecmd/trace-profile.c | 0 trace-read.c => tracecmd/trace-read.c | 0 trace-record.c => tracecmd/trace-record.c | 0 trace-restore.c => tracecmd/trace-restore.c | 0 trace-show.c => tracecmd/trace-show.c | 0 trace-snapshot.c => tracecmd/trace-snapshot.c | 0 trace-split.c => tracecmd/trace-split.c | 0 trace-stack.c => tracecmd/trace-stack.c | 0 trace-stat.c => tracecmd/trace-stat.c | 0 trace-stream.c => tracecmd/trace-stream.c | 0 trace-usage.c => tracecmd/trace-usage.c | 0 22 files changed, 88 insertions(+), 62 deletions(-) create mode 100644 tracecmd/Makefile rename trace-check-events.c => tracecmd/trace-check-events.c (100%) rename trace-cmd.bash => tracecmd/trace-cmd.bash (100%) rename trace-cmd.c => tracecmd/trace-cmd.c (100%) rename trace-hist.c => tracecmd/trace-hist.c (100%) rename trace-list.c => tracecmd/trace-list.c (100%) rename trace-listen.c => tracecmd/trace-listen.c (100%) rename trace-mem.c => tracecmd/trace-mem.c (100%) rename trace-msg.c => tracecmd/trace-msg.c (100%) rename trace-output.c => tracecmd/trace-output.c (100%) rename trace-profile.c => tracecmd/trace-profile.c (100%) rename trace-read.c => tracecmd/trace-read.c (100%) rename trace-record.c => tracecmd/trace-record.c (100%) rename trace-restore.c => tracecmd/trace-restore.c (100%) rename trace-show.c => tracecmd/trace-show.c (100%) rename trace-snapshot.c => tracecmd/trace-snapshot.c (100%) rename trace-split.c => tracecmd/trace-split.c (100%) rename trace-stack.c => tracecmd/trace-stack.c (100%) rename trace-stat.c => tracecmd/trace-stat.c (100%) rename trace-stream.c => tracecmd/trace-stream.c (100%) rename trace-usage.c => tracecmd/trace-usage.c (100%) diff --git a/Makefile b/Makefile index 4e604b4..cc96534 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,12 @@ TC_VERSION = 2 TC_PATCHLEVEL = 7 TC_EXTRAVERSION = +TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) + +export TC_VERSION +export TC_PATCHLEVEL +export TC_EXTRAVERSION +export TRACECMD_VERSION # file format version FILE_VERSION = 6 @@ -176,25 +182,14 @@ LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so export LIBS export LIBTRACEEVENT_DIR LIBTRACECMD_DIR export LIBTRACECMD_STATIC LIBTRACECMD_SHARED - -CONFIG_INCLUDES = -CONFIG_LIBS = -CONFIG_FLAGS = - -VERSION = $(TC_VERSION) -PATCHLEVEL = $(TC_PATCHLEVEL) -EXTRAVERSION = $(TC_EXTRAVERSION) - -N = +export LIBTRACEEVENT_STATIC LIBTRACEEVENT_SHARED export Q VERBOSE EXT # Include the utils include scripts/utils.mk -TRACECMD_VERSION = $(TC_VERSION).$(TC_PATCHLEVEL).$(TC_EXTRAVERSION) - -INCLUDES = -I$(src) -I $(src)/include -I $(srctree)/../../include $(CONFIG_INCLUDES) +INCLUDES = -I$(src)/include -I$(src)/../../include INCLUDES += -I$(src)/include/traceevent INCLUDES += -I$(src)/include/trace-cmd INCLUDES += -I$(src)/lib/traceevent/include @@ -243,27 +238,8 @@ endif override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR) override CFLAGS += $(udis86-flags) $(blk-flags) -$(obj)/%.o: $(src)/%.c - $(Q)$(call do_compile) -%.o: $(src)/%.c - $(Q)$(call do_compile) - -TRACE_CMD_OBJS = trace-cmd.o trace-record.o trace-read.o trace-split.o trace-listen.o \ - trace-stack.o trace-hist.o trace-mem.o trace-snapshot.o trace-stat.o \ - trace-profile.o trace-stream.o trace-record.o trace-restore.o \ - trace-check-events.o trace-show.o trace-list.o \ - trace-output.o trace-usage.o trace-msg.o - -ALL_OBJS = $(TRACE_CMD_OBJS) - -CMD_TARGETS = tc_version.h trace-cmd $(BUILD_PYTHON) - - -TARGETS = $(CMD_TARGETS) - - -# cpp $(INCLUDES) +CMD_TARGETS = trace-cmd $(BUILD_PYTHON) ### # Default we just build trace-cmd @@ -279,10 +255,8 @@ gui: force $(CMD_TARGETS) $(Q)$(MAKE) -C $(src)/kernel-shark; \ echo "gui build complete" -trace-cmd: $(TRACE_CMD_OBJS) - $(Q)$(do_app_build) - -trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) +trace-cmd: force $(LIBTRACEEVENT_STATIC) $(LIBTRACECMD_STATIC) + $(Q)$(MAKE) -C $(src)/tracecmd $@ kernelshark: force $(CMD_TARGETS) $(Q)$(MAKE) -C $(src)/kernel-shark $@ @@ -315,34 +289,12 @@ libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED) plugins: force $(obj)/plugins/trace_plugin_dir $(obj)/plugins/trace_python_dir $(Q)$(MAKE) -C $(src)/plugins -tc_version.h: force - $(Q)$(N)$(call update_version.h) - $(obj)/plugins/trace_plugin_dir: force $(Q)$(MAKE) -C $(src)/plugins trace_plugin_dir $(obj)/plugins/trace_python_dir: force $(Q)$(MAKE) -C $(src)/plugins trace_python_dir - -## make deps - -all_objs := $(sort $(ALL_OBJS)) -all_deps := $(all_objs:%.o=.%.d) - -$(all_deps): tc_version.h - -$(all_deps): .%.d: $(src)/%.c - $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@; - -$(all_objs) : %.o : .%.d - -dep_includes := $(wildcard $(all_deps)) - -ifneq ($(dep_includes),) - include $(dep_includes) -endif - show_gui_make: @echo "Note: to build the gui, type \"make gui\"" @echo " to build man pages, type \"make doc\"" @@ -373,10 +325,10 @@ install_python: force $(Q)$(MAKE) -C $(src)/python $@ install_bash_completion: force - $(Q)$(call do_install_data,trace-cmd.bash,$(BASH_COMPLETE_DIR)) + $(Q)$(call do_install_data,$(src)/tracecmd/trace-cmd.bash,$(BASH_COMPLETE_DIR)) install_cmd: all_cmd install_plugins install_python install_bash_completion - $(Q)$(call do_install,trace-cmd,$(bindir_SQ)) + $(Q)$(call do_install,$(obj)/tracecmd/trace-cmd,$(bindir_SQ)) install: install_cmd @echo "Note: to install the gui, type \"make install_gui\"" @@ -403,13 +355,14 @@ install_doc: $(MAKE) -C $(src)/Documentation install clean: - $(RM) *.o *~ $(TARGETS) *.a *.so .*.d + $(RM) *.o *~ *.a *.so .*.d $(RM) tags TAGS cscope* $(MAKE) -C $(src)/lib/traceevent clean $(MAKE) -C $(src)/lib/trace-cmd clean $(MAKE) -C $(src)/kernel-shark clean $(MAKE) -C $(src)/plugins clean $(MAKE) -C $(src)/python clean + $(MAKE) -C $(src)/tracecmd clean ##### PYTHON STUFF ##### diff --git a/tracecmd/Makefile b/tracecmd/Makefile new file mode 100644 index 0000000..860dc89 --- /dev/null +++ b/tracecmd/Makefile @@ -0,0 +1,73 @@ + +VERSION := $(TC_VERSION) +PATCHLEVEL := $(TC_PATCHLEVEL) +EXTRAVERSION := $(TC_EXTRAVERSION) + +TC_VERSION := $(obj)/tracecmd/include/tc_version.h +TARGETS = trace-cmd $(TC_VERSION) + +BUILDGUI := 0 +include $(src)/scripts/utils.mk + +TRACE_CMD_OBJS = +TRACE_CMD_OBJS += trace-cmd.o +TRACE_CMD_OBJS += trace-record.o +TRACE_CMD_OBJS += trace-read.o +TRACE_CMD_OBJS += trace-split.o +TRACE_CMD_OBJS += trace-listen.o +TRACE_CMD_OBJS += trace-stack.o +TRACE_CMD_OBJS += trace-hist.o +TRACE_CMD_OBJS += trace-mem.o +TRACE_CMD_OBJS += trace-snapshot.o +TRACE_CMD_OBJS += trace-stat.o +TRACE_CMD_OBJS += trace-profile.o +TRACE_CMD_OBJS += trace-stream.o +TRACE_CMD_OBJS += trace-record.o +TRACE_CMD_OBJS += trace-restore.o +TRACE_CMD_OBJS += trace-check-events.o +TRACE_CMD_OBJS += trace-show.o +TRACE_CMD_OBJS += trace-list.o +TRACE_CMD_OBJS += trace-output.o +TRACE_CMD_OBJS += trace-usage.o +TRACE_CMD_OBJS += trace-msg.o + +ALL_OBJS = $(TRACE_CMD_OBJS) + +all_objs := $(sort $(ALL_OBJS)) +all_deps := $(all_objs:%.o=.%.d) + +CONFIG_INCLUDES = +CONFIG_LIBS = +CONFIG_FLAGS = + +all: $(TARGETS) + +$(TC_VERSION): force + $(Q)$(call update_version.h) + +trace-cmd: $(ALL_OBJS) + $(Q)$(do_app_build) + +trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) + +%.o: %.c + $(Q)$(call do_compile) + +$(all_deps): .%.d: %.c + $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ + +$(all_deps): $(TC_VERSION) + +$(all_objs): %.o : .%.d + +dep_includes := $(wildcard $(DEPS)) + +ifneq ($(dep_includes),) + include $(dep_includes) +endif + +clean: + $(RM) *.a *.so *.o .*.d $(TARGETS) + +force: +.PHONY: clean diff --git a/trace-check-events.c b/tracecmd/trace-check-events.c similarity index 100% rename from trace-check-events.c rename to tracecmd/trace-check-events.c diff --git a/trace-cmd.bash b/tracecmd/trace-cmd.bash similarity index 100% rename from trace-cmd.bash rename to tracecmd/trace-cmd.bash diff --git a/trace-cmd.c b/tracecmd/trace-cmd.c similarity index 100% rename from trace-cmd.c rename to tracecmd/trace-cmd.c diff --git a/trace-hist.c b/tracecmd/trace-hist.c similarity index 100% rename from trace-hist.c rename to tracecmd/trace-hist.c diff --git a/trace-list.c b/tracecmd/trace-list.c similarity index 100% rename from trace-list.c rename to tracecmd/trace-list.c diff --git a/trace-listen.c b/tracecmd/trace-listen.c similarity index 100% rename from trace-listen.c rename to tracecmd/trace-listen.c diff --git a/trace-mem.c b/tracecmd/trace-mem.c similarity index 100% rename from trace-mem.c rename to tracecmd/trace-mem.c diff --git a/trace-msg.c b/tracecmd/trace-msg.c similarity index 100% rename from trace-msg.c rename to tracecmd/trace-msg.c diff --git a/trace-output.c b/tracecmd/trace-output.c similarity index 100% rename from trace-output.c rename to tracecmd/trace-output.c diff --git a/trace-profile.c b/tracecmd/trace-profile.c similarity index 100% rename from trace-profile.c rename to tracecmd/trace-profile.c diff --git a/trace-read.c b/tracecmd/trace-read.c similarity index 100% rename from trace-read.c rename to tracecmd/trace-read.c diff --git a/trace-record.c b/tracecmd/trace-record.c similarity index 100% rename from trace-record.c rename to tracecmd/trace-record.c diff --git a/trace-restore.c b/tracecmd/trace-restore.c similarity index 100% rename from trace-restore.c rename to tracecmd/trace-restore.c diff --git a/trace-show.c b/tracecmd/trace-show.c similarity index 100% rename from trace-show.c rename to tracecmd/trace-show.c diff --git a/trace-snapshot.c b/tracecmd/trace-snapshot.c similarity index 100% rename from trace-snapshot.c rename to tracecmd/trace-snapshot.c diff --git a/trace-split.c b/tracecmd/trace-split.c similarity index 100% rename from trace-split.c rename to tracecmd/trace-split.c diff --git a/trace-stack.c b/tracecmd/trace-stack.c similarity index 100% rename from trace-stack.c rename to tracecmd/trace-stack.c diff --git a/trace-stat.c b/tracecmd/trace-stat.c similarity index 100% rename from trace-stat.c rename to tracecmd/trace-stat.c diff --git a/trace-stream.c b/tracecmd/trace-stream.c similarity index 100% rename from trace-stream.c rename to tracecmd/trace-stream.c diff --git a/trace-usage.c b/tracecmd/trace-usage.c similarity index 100% rename from trace-usage.c rename to tracecmd/trace-usage.c From patchwork Tue Feb 6 08:48:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758523 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f67.google.com ([209.85.160.67]:35186 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752489AbeBFItm (ORCPT ); Tue, 6 Feb 2018 03:49:42 -0500 Received: by mail-pl0-f67.google.com with SMTP id j19so855126pll.2 for ; Tue, 06 Feb 2018 00:49:42 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 17/24] trace-cmd: Fix the logic behind SWIG_DEFINED in the Makefile Date: Tue, 6 Feb 2018 10:48:59 +0200 Message-Id: <20180206084906.9854-18-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1383 At least on Ubuntu, the $(shell ...) command used in the master Makefile to test for the existence of the 'swig' command does not work in the negative case. That causes the build to report ugly errors in case 'swig' is not installed on the system. This one-line patch, fixes the problem by using the POSIX 'comamnd -v {CMD}' in $(shell ...) to detect the presence of the swig and restores this way the fake report_noswig target. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cc96534..6016bec 100644 --- a/Makefile +++ b/Makefile @@ -103,7 +103,7 @@ ifndef VERBOSE VERBOSE = 0 endif -SWIG_DEFINED := $(shell if swig -help &> /dev/null; then echo 1; else echo 0; fi) +SWIG_DEFINED := $(shell if command -v swig; then echo 1; else echo 0; fi) ifeq ($(SWIG_DEFINED), 0) BUILD_PYTHON := report_noswig NO_PYTHON = 1 @@ -116,7 +116,7 @@ PYTHON_GUI := ctracecmd.so ctracecmdgui.so PYTHON_VERS ?= python # Can build python? -ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && which swig && echo y"), y) +ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && echo y"), y) PYTHON_PLUGINS := plugin_python.so BUILD_PYTHON := $(PYTHON) $(PYTHON_PLUGINS) BUILD_PYTHON_WORKS := 1 From patchwork Tue Feb 6 08:49:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758525 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f66.google.com ([209.85.160.66]:33969 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752544AbeBFIto (ORCPT ); Tue, 6 Feb 2018 03:49:44 -0500 Received: by mail-pl0-f66.google.com with SMTP id q17so857897pll.1 for ; Tue, 06 Feb 2018 00:49:44 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 18/24] trace-cmd: Make the build to tell when python-dev is missing Date: Tue, 6 Feb 2018 10:49:00 +0200 Message-Id: <20180206084906.9854-19-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 1301 Currently, the build system will complain when swig is missing, since that will prevent it to build the python C modules, but in case swig is present but python-dev is not installed, the build will just silently skip them. This patch just makes the build to report a message when that happens. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 6016bec..4f17dd3 100644 --- a/Makefile +++ b/Makefile @@ -120,6 +120,8 @@ ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_VERS) > /dev/null 2>&1 && echo PYTHON_PLUGINS := plugin_python.so BUILD_PYTHON := $(PYTHON) $(PYTHON_PLUGINS) BUILD_PYTHON_WORKS := 1 +else + BUILD_PYTHON := report_nopythondev endif endif # NO_PYTHON @@ -372,6 +374,11 @@ report_noswig: force $(Q)echo " NO_PYTHON forced: swig not installed, not compiling python plugins" $(Q)echo +report_nopythondev: force + $(Q)echo + $(Q)echo " python-dev is not installed, not compiling python plugins" + $(Q)echo + PYTHON_INCLUDES = `pkg-config --cflags $(PYTHON_VERS)` PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_VERS)` \ $(shell python2 -c "import distutils.sysconfig; print distutils.sysconfig.get_config_var('LINKFORSHARED')") From patchwork Tue Feb 6 08:49:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758529 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pf0-f195.google.com ([209.85.192.195]:33291 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752628AbeBFItq (ORCPT ); Tue, 6 Feb 2018 03:49:46 -0500 Received: by mail-pf0-f195.google.com with SMTP id u15so318206pfa.0 for ; Tue, 06 Feb 2018 00:49:46 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 19/24] trace-cmd: Make libtraceevent builable out-of-tree Date: Tue, 6 Feb 2018 10:49:01 +0200 Message-Id: <20180206084906.9854-20-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 3678 This patch allows the libtraceevent to be buildable out-of-tree when the 'O' variable is set at command line while invoking make. At this stage, when the 'O' variable is set, the out-of-tree build will fail (as it *already* does on the master branch) but with errors unrelated with libtraceevent: with this patch the final goal of a fully working out-of-tree build gets significantly closer. In successive steps, the remaining Makefiles will be made to support out-of-tree builds, until everything works. NOTE: the regular in-tree build of all targets clearly continues to work. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 31 +++++++++++-------------------- lib/traceevent/Makefile | 25 +++++++++++++++++-------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 4f17dd3..6cd54d9 100644 --- a/Makefile +++ b/Makefile @@ -145,27 +145,18 @@ endef blk-flags := $(call test-build,$(BLK_TC_FLUSH_SOURCE),-DHAVE_BLK_TC_FLUSH) ifeq ("$(origin O)", "command line") - BUILD_OUTPUT := $(O) + + saved-output := $(O) + BUILD_OUTPUT := $(shell cd $(O) && /bin/pwd) + $(if $(BUILD_OUTPUT),, \ + $(error output directory "$(saved-output)" does not exist)) + +else + BUILD_OUTPUT = $(CURDIR) 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)) - -endif # BUILD_OUTPUT -endif # BUILD_SRC - srctree := $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR)) -objtree := $(CURDIR) +objtree := $(BUILD_OUTPUT) src := $(srctree) obj := $(objtree) @@ -270,10 +261,10 @@ trace-graph: force $(CMD_TARGETS) $(Q)$(MAKE) -C $(src)/kernel-shark $@ $(LIBTRACEEVENT_SHARED): force - $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.so + $(Q)$(MAKE) -C $(src)/lib/traceevent $(obj)/lib/traceevent/libtraceevent.so $(LIBTRACEEVENT_STATIC): force - $(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent.a + $(Q)$(MAKE) -C $(src)/lib/traceevent $(obj)/lib/traceevent/libtraceevent.a $(LIBTRACECMD_STATIC): force $(obj)/plugins/trace_plugin_dir $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.a diff --git a/lib/traceevent/Makefile b/lib/traceevent/Makefile index f9c595c..60246aa 100644 --- a/lib/traceevent/Makefile +++ b/lib/traceevent/Makefile @@ -2,7 +2,9 @@ include $(src)/scripts/utils.mk -DEFAULT_TARGET = libtraceevent.a +bdir:=$(obj)/lib/traceevent + +DEFAULT_TARGET = $(bdir)/libtraceevent.a OBJS = OBJS += event-parse.o @@ -15,23 +17,30 @@ OBJS += parse-utils.o # Additional util objects OBJS += str_error_r.o -DEPS := $(OBJS:%.o=.%.d) +OBJS := $(OBJS:%.o=$(bdir)/%.o) +DEPS := $(OBJS:$(bdir)/%.o=$(bdir)/.%.d) all: $(DEFAULT_TARGET) -libtraceevent.a: $(OBJS) +$(bdir): + @mkdir -p $(bdir) + +$(OBJS): | $(bdir) +$(DEPS): | $(bdir) + +$(bdir)/libtraceevent.a: $(OBJS) $(Q)$(call do_build_static_lib) -libtraceevent.so: $(OBJS) +$(bdir)/libtraceevent.so: $(OBJS) $(Q)$(call do_compile_shared_library) -%.o: %.c +$(bdir)/%.o: %.c $(Q)$(call do_fpic_compile) -$(DEPS): .%.d: %.c +$(DEPS): $(bdir)/.%.d: %.c $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ -$(OBJS): %.o : .%.d +$(OBJS): $(bdir)/%.o : $(bdir)/.%.d dep_includes := $(wildcard $(DEPS)) @@ -40,6 +49,6 @@ ifneq ($(dep_includes),) endif clean: - $(RM) *.a *.so *.o .*.d + $(RM) -f $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d .PHONY: clean From patchwork Tue Feb 6 08:49:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758531 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f66.google.com ([209.85.160.66]:36675 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752278AbeBFItt (ORCPT ); Tue, 6 Feb 2018 03:49:49 -0500 Received: by mail-pl0-f66.google.com with SMTP id v3so855183plg.3 for ; Tue, 06 Feb 2018 00:49:49 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 20/24] trace-cmd: Make the plugins buildable out-of-tree Date: Tue, 6 Feb 2018 10:49:02 +0200 Message-Id: <20180206084906.9854-21-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 5122 This patch allows the plugins to be buildable out-of-tree when the 'O' variable is set at command line while invoking make. At this stage, when the 'O' variable is set, the out-of-tree build will fail (as it *already* does on the master branch) but with errors unrelated with the plugins: with this patch the final goal of a fully working out-of-tree build gets closer. In successive steps, the remaining Makefiles will be made to support out-of-tree builds, until everything works. NOTE: the regular in-tree build of all targets clearly continues to work. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 10 +++++----- plugins/Makefile | 37 ++++++++++++++++++++++--------------- scripts/utils.mk | 2 +- 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 6cd54d9..df20885 100644 --- a/Makefile +++ b/Makefile @@ -261,10 +261,10 @@ trace-graph: force $(CMD_TARGETS) $(Q)$(MAKE) -C $(src)/kernel-shark $@ $(LIBTRACEEVENT_SHARED): force - $(Q)$(MAKE) -C $(src)/lib/traceevent $(obj)/lib/traceevent/libtraceevent.so + $(Q)$(MAKE) -C $(src)/lib/traceevent $@ $(LIBTRACEEVENT_STATIC): force - $(Q)$(MAKE) -C $(src)/lib/traceevent $(obj)/lib/traceevent/libtraceevent.a + $(Q)$(MAKE) -C $(src)/lib/traceevent $@ $(LIBTRACECMD_STATIC): force $(obj)/plugins/trace_plugin_dir $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.a @@ -283,10 +283,10 @@ plugins: force $(obj)/plugins/trace_plugin_dir $(obj)/plugins/trace_python_dir $(Q)$(MAKE) -C $(src)/plugins $(obj)/plugins/trace_plugin_dir: force - $(Q)$(MAKE) -C $(src)/plugins trace_plugin_dir + $(Q)$(MAKE) -C $(src)/plugins $@ $(obj)/plugins/trace_python_dir: force - $(Q)$(MAKE) -C $(src)/plugins trace_python_dir + $(Q)$(MAKE) -C $(src)/plugins $@ show_gui_make: @echo "Note: to build the gui, type \"make gui\"" @@ -395,7 +395,7 @@ PHONY += python-plugin python-plugin: $(PYTHON_PLUGINS) plugin_python.so: force $(obj)/plugins/trace_python_dir - $(Q)$(MAKE) -C $(src)/plugins plugin_python.so + $(Q)$(MAKE) -C $(src)/plugins $(obj)/plugins/plugin_python.so dist: git archive --format=tar --prefix=trace-cmd-$(TRACECMD_VERSION)/ HEAD \ diff --git a/plugins/Makefile b/plugins/Makefile index 7a09b82..cff71f1 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -1,5 +1,7 @@ include $(src)/scripts/utils.mk +bdir:=$(obj)/plugins + PLUGIN_OBJS = PLUGIN_OBJS += plugin_jbd2.o PLUGIN_OBJS += plugin_hrtimer.o @@ -14,33 +16,38 @@ PLUGIN_OBJS += plugin_cfg80211.o PLUGIN_OBJS += plugin_blk.o PLUGIN_OBJS += plugin_tlb.o -PLUGINS := $(PLUGIN_OBJS:.o=.so) -DEPS := $(PLUGIN_OBJS:%.o=.%.d) +PLUGIN_OBJS := $(PLUGIN_OBJS:%.o=$(bdir)/%.o) +PLUGINS := $(PLUGIN_OBJS:$(bdir)/%.o=$(bdir)/%.so) +DEPS := $(PLUGIN_OBJS:$(bdir)/%.o=$(bdir)/.%.d) all: $(PLUGINS) -$(PLUGIN_OBJS): %.o : %.c +$(bdir): + @mkdir -p $(bdir) + +$(PLUGIN_OBJS): | $(bdir) +$(DEPS): | $(bdir) + +$(PLUGIN_OBJS): $(bdir)/%.o : %.c $(Q)$(do_compile_plugin_obj) -$(PLUGINS): %.so: %.o +$(PLUGINS): $(bdir)/%.so: $(bdir)/%.o $(Q)$(do_plugin_build) -$(DEPS): .%.d: %.c +$(DEPS): $(bdir)/.%.d: %.c $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ -$(PLUGIN_OBJS): %.o : .%.d +$(PLUGIN_OBJS): $(bdir)/%.o : $(bdir)/.%.d -CFLAGS_plugin_python.o += $(PYTHON_DIR_SQ) - -plugin_python.o: %.o : %.c trace_python_dir +$(bdir)/plugin_python.o: $(bdir)/%.o : %.c $(bdir)/trace_python_dir $(Q)$(do_compile_python_plugin_obj) -plugin_python.so: %.so: %.o +$(bdir)/plugin_python.so: $(bdir)/%.so: $(bdir)/%.o $(Q)$(do_python_plugin_build) -PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS)) $(subst .so,.install,$(PYTHON_PLUGINS)) +PLUGINS_INSTALL = $(subst .so,.install,$(PLUGINS)) -$(PLUGINS_INSTALL): %.install : %.so force +$(PLUGINS_INSTALL): $(bdir)/%.install : $(bdir)/%.so force $(Q)$(call do_install_data,$<,$(plugin_dir_SQ)) install_plugins: $(PLUGINS_INSTALL) @@ -49,10 +56,10 @@ install_plugins: $(PLUGINS_INSTALL) # and $(PYTHON_DIR) change. Without them, a full clean build would necessary # in order to get the binaries updated. -trace_plugin_dir: force +$(bdir)/trace_plugin_dir: $(bdir) force $(Q)$(N)$(call update_dir, 'PLUGIN_DIR=$(PLUGIN_DIR)') -trace_python_dir: force +$(bdir)/trace_python_dir: $(bdir) force $(Q)$(N)$(call update_dir, 'PYTHON_DIR=$(PYTHON_DIR)') @@ -63,7 +70,7 @@ ifneq ($(dep_includes),) endif clean: - $(RM) *.a *.so *.o .*.d trace_plugin_dir trace_python_dir + $(RM) -f $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d $(bdir)/trace_plugin_dir $(bdir)/trace_python_dir force: .PHONY: clean force \ No newline at end of file diff --git a/scripts/utils.mk b/scripts/utils.mk index 043a68a..06e8dc3 100644 --- a/scripts/utils.mk +++ b/scripts/utils.mk @@ -64,7 +64,7 @@ do_plugin_build = \ do_compile_python_plugin_obj = \ ($(print_plugin_obj_compile) \ - $(CC) -c $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$@) $(PYTHON_INCLUDES) -fPIC -o $@ $<) + $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_DIR_SQ) $(PYTHON_INCLUDES) -fPIC -o $@ $<) do_python_plugin_build = \ ($(print_plugin_build) \ From patchwork Tue Feb 6 08:49:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758533 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pf0-f195.google.com ([209.85.192.195]:34484 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752356AbeBFItv (ORCPT ); Tue, 6 Feb 2018 03:49:51 -0500 Received: by mail-pf0-f195.google.com with SMTP id g17so317494pfh.1 for ; Tue, 06 Feb 2018 00:49:50 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 21/24] trace-cmd: Make libtracecmd buildable out-of-tree Date: Tue, 6 Feb 2018 10:49:03 +0200 Message-Id: <20180206084906.9854-22-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 2730 This patch allows the libtracecmd to be buildable out-of-tree when the 'O' variable is set at command line while invoking make. At this stage, when the 'O' variable is set, the out-of-tree build will fail (as it *already* does on the master branch) but with errors unrelated with libtracecmd: with this patch the final goal of a fully working out-of-tree build gets closer. In successive steps, the remaining Makefiles will be made to support out-of-tree builds, until everything works. NOTE: the regular in-tree build of all targets clearly continues to work. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 4 ++-- lib/trace-cmd/Makefile | 27 ++++++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index df20885..a40bf28 100644 --- a/Makefile +++ b/Makefile @@ -267,10 +267,10 @@ $(LIBTRACEEVENT_STATIC): force $(Q)$(MAKE) -C $(src)/lib/traceevent $@ $(LIBTRACECMD_STATIC): force $(obj)/plugins/trace_plugin_dir - $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.a + $(Q)$(MAKE) -C $(src)/lib/trace-cmd $@ $(LIBTRACECMD_SHARED): force $(obj)/plugins/trace_plugin_dir - $(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.so + $(Q)$(MAKE) -C $(src)/lib/trace-cmd $@ libtraceevent.so: $(LIBTRACEEVENT_SHARED) libtraceevent.a: $(LIBTRACEEVENT_STATIC) diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile index e8fb088..ee09099 100644 --- a/lib/trace-cmd/Makefile +++ b/lib/trace-cmd/Makefile @@ -2,7 +2,9 @@ include $(src)/scripts/utils.mk -DEFAULT_TARGET = libtracecmd.a +bdir:=$(obj)/lib/trace-cmd + +DEFAULT_TARGET = $(bdir)/libtracecmd.a OBJS = OBJS += trace-hash.o @@ -15,25 +17,32 @@ OBJS += trace-util.o OBJS += trace-blk-hack.o OBJS += trace-ftrace.o -DEPS := $(OBJS:%.o=.%.d) +OBJS := $(OBJS:%.o=$(bdir)/%.o) +DEPS := $(OBJS:$(bdir)/%.o=$(bdir)/.%.d) all: $(DEFAULT_TARGET) -libtracecmd.a: $(OBJS) +$(bdir): + @mkdir -p $(bdir) + +$(OBJS): | $(bdir) +$(DEPS): | $(bdir) + +$(bdir)/libtracecmd.a: $(OBJS) $(Q)$(call do_build_static_lib) -libtracecmd.so: $(OBJS) +$(bdir)/libtracecmd.so: $(OBJS) $(Q)$(call do_compile_shared_library) -%.o: %.c +$(bdir)/%.o: %.c $(Q)$(call do_fpic_compile) -trace-util.o: $(obj)/plugins/trace_plugin_dir +$(bdir)/trace-util.o: $(obj)/plugins/trace_plugin_dir -$(DEPS): .%.d: %.c +$(DEPS): $(bdir)/.%.d: %.c $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ -$(OBJS): %.o : .%.d +$(OBJS): $(bdir)/%.o : $(bdir)/.%.d dep_includes := $(wildcard $(DEPS)) @@ -42,6 +51,6 @@ ifneq ($(dep_includes),) endif clean: - $(RM) *.a *.so *.o .*.d + $(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d .PHONY: clean From patchwork Tue Feb 6 08:49:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758537 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pg0-f68.google.com ([74.125.83.68]:46674 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752539AbeBFItw (ORCPT ); Tue, 6 Feb 2018 03:49:52 -0500 Received: by mail-pg0-f68.google.com with SMTP id a11so534379pgu.13 for ; Tue, 06 Feb 2018 00:49:52 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 22/24] trace-cmd: Make the trace-cmd target buildable out-of-tree Date: Tue, 6 Feb 2018 10:49:04 +0200 Message-Id: <20180206084906.9854-23-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 3265 This patch allows the trace-cmd app to be buildable out-of-tree when the 'O' variable is set at command line while invoking make. At this stage, when the 'O' variable is set, the out-of-tree build will fail for some targets like 'gui' (as it *already* happens on the master branch): with this patch the final goal of a fully working out-of-tree build gets closer. In successive steps, the remaining Makefiles will be made to support out-of-tree builds, until everything works. NOTE: the regular in-tree build of all targets clearly continues to work. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 3 ++- tracecmd/Makefile | 33 ++++++++++++++++++++++----------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index a40bf28..edb83c3 100644 --- a/Makefile +++ b/Makefile @@ -189,6 +189,7 @@ INCLUDES += -I$(src)/lib/traceevent/include INCLUDES += -I$(src)/lib/trace-cmd/include INCLUDES += -I$(src)/kernel-shark/include INCLUDES += -I$(src)/tracecmd/include +INCLUDES += -I$(obj)/tracecmd/include include $(src)/features.mk @@ -249,7 +250,7 @@ gui: force $(CMD_TARGETS) echo "gui build complete" trace-cmd: force $(LIBTRACEEVENT_STATIC) $(LIBTRACECMD_STATIC) - $(Q)$(MAKE) -C $(src)/tracecmd $@ + $(Q)$(MAKE) -C $(src)/tracecmd $(obj)/tracecmd/$@ kernelshark: force $(CMD_TARGETS) $(Q)$(MAKE) -C $(src)/kernel-shark $@ diff --git a/tracecmd/Makefile b/tracecmd/Makefile index 860dc89..3a11024 100644 --- a/tracecmd/Makefile +++ b/tracecmd/Makefile @@ -3,8 +3,10 @@ VERSION := $(TC_VERSION) PATCHLEVEL := $(TC_PATCHLEVEL) EXTRAVERSION := $(TC_EXTRAVERSION) -TC_VERSION := $(obj)/tracecmd/include/tc_version.h -TARGETS = trace-cmd $(TC_VERSION) +bdir:=$(obj)/tracecmd + +TC_VERSION := $(bdir)/include/tc_version.h +TARGETS = $(bdir)/trace-cmd $(TC_VERSION) BUILDGUI := 0 include $(src)/scripts/utils.mk @@ -31,10 +33,10 @@ TRACE_CMD_OBJS += trace-output.o TRACE_CMD_OBJS += trace-usage.o TRACE_CMD_OBJS += trace-msg.o -ALL_OBJS = $(TRACE_CMD_OBJS) +ALL_OBJS := $(TRACE_CMD_OBJS:%.o=$(bdir)/%.o) all_objs := $(sort $(ALL_OBJS)) -all_deps := $(all_objs:%.o=.%.d) +all_deps := $(all_objs:$(bdir)/%.o=$(bdir)/.%.d) CONFIG_INCLUDES = CONFIG_LIBS = @@ -42,23 +44,32 @@ CONFIG_FLAGS = all: $(TARGETS) -$(TC_VERSION): force +$(bdir): + @mkdir -p $(bdir) + +$(bdir)/include: | $(bidr) + @mkdir -p $(bdir)/include + +$(TC_VERSION): force | $(bdir)/include $(Q)$(call update_version.h) -trace-cmd: $(ALL_OBJS) +$(all_deps): | $(bdir) +$(all_objs): | $(bdir) + +$(bdir)/trace-cmd: $(ALL_OBJS) $(Q)$(do_app_build) -trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) +$(bdir)/trace-cmd: $(LIBTRACECMD_STATIC) $(LIBTRACEEVENT_STATIC) -%.o: %.c +$(bdir)/%.o: %.c $(Q)$(call do_compile) -$(all_deps): .%.d: %.c +$(all_deps): $(bdir)/.%.d: %.c $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ $(all_deps): $(TC_VERSION) -$(all_objs): %.o : .%.d +$(all_objs): $(bdir)/%.o : $(bdir)/.%.d dep_includes := $(wildcard $(DEPS)) @@ -67,7 +78,7 @@ ifneq ($(dep_includes),) endif clean: - $(RM) *.a *.so *.o .*.d $(TARGETS) + $(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d $(TARGETS) force: .PHONY: clean From patchwork Tue Feb 6 08:49:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758535 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pg0-f66.google.com ([74.125.83.66]:45341 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752572AbeBFIty (ORCPT ); Tue, 6 Feb 2018 03:49:54 -0500 Received: by mail-pg0-f66.google.com with SMTP id m136so817170pga.12 for ; Tue, 06 Feb 2018 00:49:54 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 23/24] trace-cmd: Make the python targets buildable out-of-tree Date: Tue, 6 Feb 2018 10:49:05 +0200 Message-Id: <20180206084906.9854-24-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 4050 This patch allows the python targets to be buildable out-of-tree when the 'O' variable is set at command line while invoking make. At this stage, when the 'O' variable is set, the out-of-tree build will fail for some targets like 'gui' (as it *already* happens on the master branch): with this patch the final goal of a fully working out-of-tree build gets closer. In successive steps, the remaining Makefiles will be made to support out-of-tree builds, until everything works. NOTE: the regular in-tree build of all targets clearly continues to work. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 4 ++-- python/Makefile | 30 +++++++++++++++++------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index edb83c3..2f05cbb 100644 --- a/Makefile +++ b/Makefile @@ -381,10 +381,10 @@ export PYTHON_LDFLAGS export PYGTK_CFLAGS ctracecmd.so: force $(LIBTRACECMD_STATIC) - $(Q)$(MAKE) -C $(src)/python $@ + $(Q)$(MAKE) -C $(src)/python $(obj)/python/ctracecmd.so ctracecmdgui.so: force $(LIBTRACECMD_STATIC) trace-view - $(Q)$(MAKE) -C $(src)/python $@ + $(Q)$(MAKE) -C $(src)/python $(obj)/python/ctracecmdgui.so PHONY += python python: $(PYTHON) diff --git a/python/Makefile b/python/Makefile index b07c0d8..f8e7328 100644 --- a/python/Makefile +++ b/python/Makefile @@ -1,40 +1,44 @@ include $(src)/scripts/utils.mk +bdir:=$(obj)/python + TRACE_VIEW_OBJS = TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view.o TRACE_VIEW_OBJS += $(obj)/kernel-shark/trace-view-store.o ifdef BUILD_PYTHON_WORKS -PYTHON_SO_INSTALL := ctracecmd.install -PYTHON_PY_PROGS := event-viewer.install -PYTHON_PY_LIBS := tracecmd.install tracecmdgui.install +PYTHON_SO_INSTALL := $(bdir)/ctracecmd.install +PYTHON_PY_PROGS := $(bdir)/event-viewer.install +PYTHON_PY_LIBS := $(bdir)/tracecmd.install $(bdir)/tracecmdgui.install endif -ctracecmd.so: ctracecmd.i $(LIBTRACECMD_STATIC) +$(bdir)/ctracecmd.so: ctracecmd.i $(LIBTRACECMD_STATIC) | $(bdir) swig -Wall -python -noproxy -I$(src)/include/traceevent -I$(src)/include/trace-cmd ctracecmd.i - $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) ctracecmd_wrap.c - $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) ctracecmd_wrap.o -o ctracecmd.so + $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(PYTHON_INCLUDES) -o $(bdir)/ctracecmd_wrap.o ctracecmd_wrap.c + $(CC) --shared $(LIBTRACECMD_STATIC) $(LDFLAGS) $(bdir)/ctracecmd_wrap.o -o $(bdir)/ctracecmd.so -ctracecmdgui.so: ctracecmdgui.i $(LIBTRACECMD_STATIC) $(TRACE_VIEW_OBJS) +$(bdir)/ctracecmdgui.so: ctracecmdgui.i $(LIBTRACECMD_STATIC) $(TRACE_VIEW_OBJS) | $(bdir) swig -Wall -python -noproxy -I$(src)/kernel-shark/include ctracecmdgui.i - $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) ctracecmdgui_wrap.c - $(CC) --shared $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) ctracecmdgui_wrap.o -o ctracecmdgui.so + $(CC) -fpic -c $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) -o $(bdir)/ctracecmdgui_wrap.o ctracecmdgui_wrap.c + $(CC) --shared $(TRACE_VIEW_OBJS) $(LIBTRACECMD_STATIC) $(LDFLAGS) $(LIBS) $(CONFIG_LIBS) $(bdir)/ctracecmdgui_wrap.o -o $(bdir)/ctracecmdgui.so +$(bdir): + @mkdir -p $(bdir) -$(PYTHON_SO_INSTALL): %.install : %.so force +$(PYTHON_SO_INSTALL): $(bdir)/%.install : $(bdir)/%.so force $(Q)$(call do_install_data,$<,$(python_dir_SQ)) -$(PYTHON_PY_PROGS): %.install : %.py force +$(PYTHON_PY_PROGS): $(bdir)/%.install : %.py force $(Q)$(call do_install,$<,$(python_dir_SQ)) -$(PYTHON_PY_LIBS): %.install : %.py force +$(PYTHON_PY_LIBS): $(bdir)/%.install : %.py force $(Q)$(call do_install_data,$<,$(python_dir_SQ)) install_python: $(PYTHON_SO_INSTALL) $(PYTHON_PY_PROGS) $(PYTHON_PY_LIBS) clean: - $(RM) *.a *.so *.o .*.d ctracecmd_wrap.* ctracecmdgui_wrap.* + $(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d $(bdir)/ctracecmd_wrap.* $(bdir)/ctracecmdgui_wrap.* force: .PHONY: clean force From patchwork Tue Feb 6 08:49:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladislav Valtchev (VMware)" X-Patchwork-Id: 10758539 Return-Path: linux-trace-devel-owner@vger.kernel.org Received: from mail-pl0-f68.google.com ([209.85.160.68]:44514 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752639AbeBFIt4 (ORCPT ); Tue, 6 Feb 2018 03:49:56 -0500 Received: by mail-pl0-f68.google.com with SMTP id f8so843036plk.11 for ; Tue, 06 Feb 2018 00:49:56 -0800 (PST) From: "Vladislav Valtchev (VMware)" To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org, y.karadz@gmail.com, "Vladislav Valtchev (VMware)" Subject: [PATCH v2 24/24] trace-cmd: Make the GUI targets buildable out-of-tree Date: Tue, 6 Feb 2018 10:49:06 +0200 Message-Id: <20180206084906.9854-25-vladislav.valtchev@gmail.com> In-Reply-To: <20180206084906.9854-1-vladislav.valtchev@gmail.com> References: <20180206084906.9854-1-vladislav.valtchev@gmail.com> Sender: linux-trace-devel-owner@vger.kernel.org List-ID: Content-Length: 4606 This patch allows the GUI targets to be buildable out-of-tree when the 'O' variable is set at command line while invoking make. With this final patch, the out-of-tree build of all targets works. Signed-off-by: Vladislav Valtchev (VMware) --- Makefile | 9 +++++---- kernel-shark/Makefile | 40 ++++++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 2f05cbb..dc512a1 100644 --- a/Makefile +++ b/Makefile @@ -190,6 +190,7 @@ INCLUDES += -I$(src)/lib/trace-cmd/include INCLUDES += -I$(src)/kernel-shark/include INCLUDES += -I$(src)/tracecmd/include INCLUDES += -I$(obj)/tracecmd/include +INCLUDES += -I$(obj)/kernel-shark/include include $(src)/features.mk @@ -229,7 +230,7 @@ LIBS += -laudit endif # Append required CFLAGS -override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR) +override CFLAGS += $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR) override CFLAGS += $(udis86-flags) $(blk-flags) @@ -253,13 +254,13 @@ trace-cmd: force $(LIBTRACEEVENT_STATIC) $(LIBTRACECMD_STATIC) $(Q)$(MAKE) -C $(src)/tracecmd $(obj)/tracecmd/$@ kernelshark: force $(CMD_TARGETS) - $(Q)$(MAKE) -C $(src)/kernel-shark $@ + $(Q)$(MAKE) -C $(src)/kernel-shark $(obj)/kernel-shark/$@ trace-view: force $(CMD_TARGETS) - $(Q)$(MAKE) -C $(src)/kernel-shark $@ + $(Q)$(MAKE) -C $(src)/kernel-shark $(obj)/kernel-shark/$@ trace-graph: force $(CMD_TARGETS) - $(Q)$(MAKE) -C $(src)/kernel-shark $@ + $(Q)$(MAKE) -C $(src)/kernel-shark $(obj)/kernel-shark/$@ $(LIBTRACEEVENT_SHARED): force $(Q)$(MAKE) -C $(src)/lib/traceevent $@ diff --git a/kernel-shark/Makefile b/kernel-shark/Makefile index 8e3ba8b..8576f3d 100644 --- a/kernel-shark/Makefile +++ b/kernel-shark/Makefile @@ -5,6 +5,8 @@ PATCHLEVEL = 2 EXTRAVERSION = KERNELSHARK_VERSION = $(VERSION).$(PATCHLEVEL).$(EXTRAVERSION) +bdir:=$(obj)/kernel-shark + BUILDGUI := 1 include $(src)/scripts/utils.mk @@ -21,9 +23,9 @@ CONFIG_LIBS = $(shell pkg-config --libs $(PACKAGES)) CONFIG_FLAGS += $(HELP_DIR_SQ) -KS_VERSION := $(obj)/kernel-shark/include/ks_version.h +KS_VERSION := $(bdir)/include/ks_version.h -GUI_TARGETS = $(KS_VERSION) trace-graph trace-view kernelshark +GUI_TARGETS = $(KS_VERSION) $(bdir)/trace-graph $(bdir)/trace-view $(bdir)/kernelshark TRACE_GUI_OBJS = trace-filter.o trace-compat.o trace-filter-hash.o \ trace-dialog.o trace-xml.o @@ -34,16 +36,17 @@ TRACE_GRAPH_MAIN_OBJS = trace-graph-main.o $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) KERNEL_SHARK_OBJS = $(TRACE_VIEW_OBJS) $(TRACE_GRAPH_OBJS) $(TRACE_GUI_OBJS) \ trace-capture.o kernel-shark.o +KERNEL_SHARK_OBJS := $(KERNEL_SHARK_OBJS:%.o=$(bdir)/%.o) +TRACE_VIEW_MAIN_OBJS := $(TRACE_VIEW_MAIN_OBJS:%.o=$(bdir)/%.o) +TRACE_GRAPH_MAIN_OBJS := $(TRACE_GRAPH_MAIN_OBJS:%.o=$(bdir)/%.o) + ALL_OBJS = $(KERNEL_SHARK_OBJS) $(TRACE_VIEW_MAIN_OBJS) $(TRACE_GRAPH_MAIN_OBJS) PIC_OBJS = $(TRACE_VIEW_OBJS) all_objs := $(sort $(ALL_OBJS)) pic_objs = $(sort $(PIC_OBJS)) -all_deps := $(all_objs:%.o=.%.d) +all_deps := $(all_objs:$(bdir)/%.o=$(bdir)/.%.d) -# Temporary HACK! -# This hack is OK only until the non-gui builds do not have any config_includes -# nor config flags. In case they do, keeping this hack might be a problem. override CFLAGS += $(CONFIG_INCLUDES) $(CONFIG_FLAGS) LIBS += -L$(LIBTRACEEVENT_DIR) -L$(LIBTRACECMD_DIR) @@ -51,29 +54,38 @@ LIBS += -ltracecmd -ltraceevent -ldl all: $(GUI_TARGETS) -$(KS_VERSION): force +$(bdir): + @mkdir -p $(bdir) + +$(bdir)/include: | $(bdir) + @mkdir -p $(bdir)/include + +$(all_objs): | $(bdir) +$(all_deps): | $(bdir) + +$(KS_VERSION): force | $(bdir)/include $(Q)$(call update_version.h) -kernelshark: $(KERNEL_SHARK_OBJS) +$(bdir)/kernelshark: $(KERNEL_SHARK_OBJS) $(Q)$(do_app_build) -trace-view: $(TRACE_VIEW_MAIN_OBJS) +$(bdir)/trace-view: $(TRACE_VIEW_MAIN_OBJS) $(Q)$(do_app_build) -trace-graph: $(TRACE_GRAPH_MAIN_OBJS) +$(bdir)/trace-graph: $(TRACE_GRAPH_MAIN_OBJS) $(Q)$(do_app_build) $(pic_objs): GENERATE_PIC := 1 -%.o: %.c +$(bdir)/%.o: %.c $(Q)$(call do_compile) -$(all_deps): .%.d: %.c +$(all_deps): $(bdir)/.%.d: %.c $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ $(all_deps): $(KS_VERSION) -$(all_objs): %.o : .%.d +$(all_objs): $(bdir)/%.o : $(bdir)/.%.d dep_includes := $(wildcard $(DEPS)) @@ -82,7 +94,7 @@ ifneq ($(dep_includes),) endif clean: - $(RM) *.a *.so *.o .*.d $(GUI_TARGETS) + $(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d $(GUI_TARGETS) force: .PHONY: clean