diff mbox series

[13/13] trace-cmd: Add warning if libtracefs or libtraceevent are not found

Message ID 20201211171015.035720645@goodmis.org (mailing list archive)
State Accepted
Commit 1e606b2402260d51de5504efdf7c1dc08f76d08c
Headers show
Series trace-cmd: Clean ups to the Makefile for using external libraries | expand

Commit Message

Steven Rostedt Dec. 11, 2020, 5:08 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Add a warning notice if either or both libtraceevent or libtracefs is not
found on the system for linking. If the local version is being built,
display a notice and show where they can get the corresponding library.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile                |  4 ++--
 lib/traceevent/Makefile | 14 ++++++++++++++
 lib/tracefs/Makefile    | 13 +++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 1f7cab57cd7d..ab91ae777b83 100644
--- a/Makefile
+++ b/Makefile
@@ -369,7 +369,7 @@  trace-cmd: force $(LIBTRACEEVENT_STATIC_BUILD) $(LIBTRACECMD_STATIC) $(LIBTRACEF
 
 $(LIBTRACEEVENT_STATIC): force $(obj)/lib/traceevent/plugins/trace_python_dir \
 			 $(obj)/lib/traceevent/plugins/traceevent_plugin_dir
-	$(Q)$(MAKE) -C $(src)/lib/traceevent $@
+	$(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent
 
 $(LIBTRACECMD_STATIC): force
 	$(Q)$(MAKE) -C $(src)/lib/trace-cmd $@
@@ -378,7 +378,7 @@  $(LIBTRACECMD_SHARED): force $(LIBTRACEEVENT_SHARED_BUILD)
 	$(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.so
 
 $(LIBTRACEFS_STATIC): force
-	$(Q)$(MAKE) -C $(src)/lib/tracefs $@
+	$(Q)$(MAKE) -C $(src)/lib/tracefs libtracefs
 
 libtraceevent.a: $(LIBTRACEEVENT_STATIC)
 libtracecmd.a: $(LIBTRACECMD_STATIC)
diff --git a/lib/traceevent/Makefile b/lib/traceevent/Makefile
index edb2fccfff07..0dcd90c13328 100644
--- a/lib/traceevent/Makefile
+++ b/lib/traceevent/Makefile
@@ -29,9 +29,23 @@  $(bdir):
 $(OBJS): | $(bdir)
 $(DEPS): | $(bdir)
 
+.PHONY: warning
+warning:
+	@echo "********************************************"
+	@echo "** NOTICE: libtraceevent not found on system"
+	@echo "**"
+	@echo "** Building obsolete local version of libtraceevent"
+	@echo "** Consider installing the latest libtraceevent"
+	@echo "**"
+	@echo "**  https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ "
+	@echo "**"
+	@echo "********************************************"
+
 $(bdir)/libtraceevent.a: $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
+libtraceevent: $(bdir)/libtraceevent.a warning
+
 $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
 
diff --git a/lib/tracefs/Makefile b/lib/tracefs/Makefile
index 33112690914d..021ae2b040de 100644
--- a/lib/tracefs/Makefile
+++ b/lib/tracefs/Makefile
@@ -26,9 +26,22 @@  $(DEPS): | $(bdir)
 
 LIBS = -L$(obj)/lib/traceevent -ltraceevent
 
+.PHONY: warning
+warning:
+	@echo "********************************************"
+	@echo "** NOTICE: libtracefs not found on system"
+	@echo "**"
+	@echo "** Building obsolete local version of libtracefs"
+	@echo "** Consider installing the latest libtracefs"
+	@echo "**"
+	@echo "**  https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ "
+	@echo "**"
+	@echo "********************************************"
+
 $(bdir)/libtracefs.a: $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
+libtracefs: $(bdir)/libtracefs.a warning
 $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)