Use tools/build/ makefiles to build latency-collector, inheriting
the benefits of it. For example: Before this patch, a missing
tracefs/traceevents headers will result in fail like this:
~/linux/tools/tracing/latency $ make
cc -Wall -Wextra -g -O2 -o latency-collector latency-collector.c -lpthread
latency-collector.c:26:10: fatal error: tracefs.h: No such file or directory
26 | #include <tracefs.h>
| ^~~~~~~~~~~
compilation terminated.
make: *** [Makefile:14: latency-collector] Error 1
Which is not that helpful. After this change it reports:
~/linux/tools/tracing/latency# make
Auto-detecting system features:
... libtraceevent: [ OFF ]
... libtracefs: [ OFF ]
libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel
libtracefs is missing. Please install libtracefs-dev/libtracefs-devel
Makefile.config:29: *** Please, check the errors above.. Stop.
This type of output is common across other tools in tools/ like perf
and objtool.
Link: https://lkml.kernel.org/r/872420b0880b11304e4ba144a0086c6478c5b469.1710519524.git.bristot@kernel.org
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: John Kacur <jkacur@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
31 lines
755 B
Makefile
31 lines
755 B
Makefile
# SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
STOP_ERROR :=
|
|
|
|
define lib_setup
|
|
$(eval EXTLIBS += -l$(1))
|
|
$(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)"))
|
|
endef
|
|
|
|
$(call feature_check,libtraceevent)
|
|
ifeq ($(feature-libtraceevent), 1)
|
|
$(call detected,CONFIG_LIBTRACEEVENT)
|
|
$(call lib_setup,traceevent)
|
|
else
|
|
STOP_ERROR := 1
|
|
$(info libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel)
|
|
endif
|
|
|
|
$(call feature_check,libtracefs)
|
|
ifeq ($(feature-libtracefs), 1)
|
|
$(call detected,CONFIG_LIBTRACEFS)
|
|
$(call lib_setup,tracefs)
|
|
else
|
|
STOP_ERROR := 1
|
|
$(info libtracefs is missing. Please install libtracefs-dev/libtracefs-devel)
|
|
endif
|
|
|
|
ifeq ($(STOP_ERROR),1)
|
|
$(error Please, check the errors above.)
|
|
endif
|