All trace-cmd APIs (functions, declared in trace-cmd.h) are exposed automatically at build time as python bindings, using trace-cmd python plugin. Implementation of those functions is supposed to be in libtracecmd library. Not all functions, declared in trace-cmd.h are APIs, some of them are internal and should not be exposed: tracecmd_enable_events() is removed from trace-cmd.h, as it heavily depends on trace-cmd internals. It is no more exposed as python binding. Others are implemented in trace-cmd application and cannot be used outside it: trace-output.c file is moved from trace-cmd to libtracecmd. All functions implemented there are now part of the library. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx> --- include/trace-cmd/trace-cmd.h | 1 - lib/trace-cmd/Makefile | 11 ++++++++++- {tracecmd => lib/trace-cmd}/trace-output.c | 0 tracecmd/Makefile | 1 - 4 files changed, 10 insertions(+), 3 deletions(-) rename {tracecmd => lib/trace-cmd}/trace-output.c (100%) diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h index 6f62ab9..1f2f5bf 100644 --- a/include/trace-cmd/trace-cmd.h +++ b/include/trace-cmd/trace-cmd.h @@ -292,7 +292,6 @@ void tracecmd_stat_cpu(struct trace_seq *s, int cpu); long tracecmd_flush_recording(struct tracecmd_recorder *recorder); void tracecmd_filter_pid(int pid, int exclude); int tracecmd_add_event(const char *event_str, int stack); -void tracecmd_enable_events(void); void tracecmd_disable_all_tracing(int disable_tracer); void tracecmd_disable_tracing(void); void tracecmd_enable_tracing(void); diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile index 44c1332..9086eb6 100644 --- a/lib/trace-cmd/Makefile +++ b/lib/trace-cmd/Makefile @@ -4,12 +4,15 @@ include $(src)/scripts/utils.mk bdir:=$(obj)/lib/trace-cmd -DEFAULT_TARGET = $(bdir)/libtracecmd.a +TC_VERSION := $(bdir)/include/tc_version.h + +DEFAULT_TARGET = $(bdir)/libtracecmd.a $(TC_VERSION) OBJS = OBJS += trace-hash.o OBJS += trace-hooks.o OBJS += trace-input.o +OBJS += trace-output.o OBJS += trace-recorder.o OBJS += trace-util.o OBJS += trace-filter-hash.o @@ -29,6 +32,9 @@ $(bdir): $(OBJS): | $(bdir) $(DEPS): | $(bdir) +$(TC_VERSION): force | $(bdir)/include + $(Q)$(call update_version.h) + $(bdir)/libtracecmd.a: $(OBJS) $(Q)$(call do_build_static_lib) @@ -43,6 +49,8 @@ $(bdir)/trace-util.o: $(obj)/plugins/trace_plugin_dir $(DEPS): $(bdir)/.%.d: %.c $(Q)$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@ +$(DEPS): $(TC_VERSION) + $(OBJS): $(bdir)/%.o : $(bdir)/.%.d dep_includes := $(wildcard $(DEPS)) @@ -54,4 +62,5 @@ endif clean: $(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d +force: .PHONY: clean diff --git a/tracecmd/trace-output.c b/lib/trace-cmd/trace-output.c similarity index 100% rename from tracecmd/trace-output.c rename to lib/trace-cmd/trace-output.c diff --git a/tracecmd/Makefile b/tracecmd/Makefile index bcd437a..6968f83 100644 --- a/tracecmd/Makefile +++ b/tracecmd/Makefile @@ -29,7 +29,6 @@ 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 -- 2.21.0