rtla: Consolidate and show all necessary libraries that failed for building

When building rtla tools, if the necessary libraries are not installed
(libtraceevent and libtracefs), show the ones that are missing in one
consolidated output, and also show how to install them (at least for
Fedora).

Link: https://lore.kernel.org/all/CAHk-=wh+e1qcCnEYJ3JRDVLNCYbJ=0u+Ts5bOYZnY3mX_k-hFA@mail.gmail.com/
Link: https://lkml.kernel.org/r/20220810113918.5d19ce59@gandalf.local.homeSuggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent 1a7b22ab
...@@ -61,40 +61,50 @@ endif ...@@ -61,40 +61,50 @@ endif
LIBTRACEEVENT_MIN_VERSION = 1.5 LIBTRACEEVENT_MIN_VERSION = 1.5
LIBTRACEFS_MIN_VERSION = 1.3 LIBTRACEFS_MIN_VERSION = 1.3
.PHONY: all warnings show_warnings
all: warnings rtla
TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 || echo n") TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 || echo n")
ifeq ("$(TEST_LIBTRACEEVENT)", "n") ifeq ("$(TEST_LIBTRACEEVENT)", "n")
.PHONY: warning_traceevent WARNINGS = show_warnings
warning_traceevent: MISSING_LIBS += echo "** libtraceevent version $(LIBTRACEEVENT_MIN_VERSION) or higher";
@echo "********************************************" MISSING_PACKAGES += "libtraceevent-devel"
@echo "** NOTICE: libtraceevent version $(LIBTRACEEVENT_MIN_VERSION) or higher not found" MISSING_SOURCE += echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ ";
@echo "**"
@echo "** Consider installing the latest libtraceevent from your"
@echo "** distribution, e.g., 'dnf install libtraceevent' on Fedora,"
@echo "** or from source:"
@echo "**"
@echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ "
@echo "**"
@echo "********************************************"
endif endif
TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) libtracefs > /dev/null 2>&1 || echo n") TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) libtracefs > /dev/null 2>&1 || echo n")
ifeq ("$(TEST_LIBTRACEFS)", "n") ifeq ("$(TEST_LIBTRACEFS)", "n")
.PHONY: warning_tracefs WARNINGS = show_warnings
warning_tracefs: MISSING_LIBS += echo "** libtracefs version $(LIBTRACEFS_MIN_VERSION) or higher";
@echo "********************************************" MISSING_PACKAGES += "libtracefs-devel"
@echo "** NOTICE: libtracefs version $(LIBTRACEFS_MIN_VERSION) or higher not found" MISSING_SOURCE += echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ ";
@echo "**"
@echo "** Consider installing the latest libtracefs from your"
@echo "** distribution, e.g., 'dnf install libtracefs' on Fedora,"
@echo "** or from source:"
@echo "**"
@echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ "
@echo "**"
@echo "********************************************"
endif endif
.PHONY: all define show_dependencies
all: rtla @echo "********************************************"; \
echo "** NOTICE: Failed build dependencies"; \
echo "**"; \
echo "** Required Libraries:"; \
$(MISSING_LIBS) \
echo "**"; \
echo "** Consider installing the latest libtracefs from your"; \
echo "** distribution, e.g., 'dnf install $(MISSING_PACKAGES)' on Fedora,"; \
echo "** or from source:"; \
echo "**"; \
$(MISSING_SOURCE) \
echo "**"; \
echo "********************************************"
endef
show_warnings:
$(call show_dependencies);
ifneq ("$(WARNINGS)", "")
ERROR_OUT = $(error Please add the necessary dependencies)
warnings: $(WARNINGS)
$(ERROR_OUT)
endif
rtla: $(OBJ) rtla: $(OBJ)
$(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS) $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment