Thread (34 messages) flat view 34 messages, 4 authors, 2021-10-19

Re: [PATCH V3 06/19] rtla: Real-Time Linux Analysis tool

From: Daniel Bristot de Oliveira <bristot@kernel.org>
Date: 2021-10-19 08:53:43
Also in: lkml
Subsystem: real-time linux analysis (rtla) tools, the rest · Maintainers: Steven Rostedt, Tomas Glozar, Linus Torvalds

On 10/18/21 21:30, Ahmed S. Darwish wrote:
On Mon, Oct 18, 2021, Daniel Bristot de Oliveira wrote:
quoted
--- /dev/null
+++ b/tools/tracing/rtla/Makefile
@@ -0,0 +1,59 @@
+CC	:=	gcc
Some $(CROSS_COMPILE) for the poor souls who will integrate this into
embedded distributions?
quoted
+
+TRACEFS_HEADERS		:= $$(pkg-config --cflags libtracefs)
+
ditto. This uses the host's pkg-config unconditionally.
mind trying this (on top of the current one)?

Thanks!
diff --git a/tools/tracing/rtla/Makefile b/tools/tracing/rtla/Makefile
index 9a914391e507..8c2b7f8c7f20 100644
--- a/tools/tracing/rtla/Makefile
+++ b/tools/tracing/rtla/Makefile
@@ -1,14 +1,30 @@
 NAME	:=	rtla
 VERSION	:=	0.1
 
+# Makefiles suck: This macro sets a default value of $(2) for the
+# variable named by $(1), unless the variable has been set by
+# environment or command line. This is necessary for CC and AR
+# because make sets default values, so the simpler ?= approach
+# won't work as expected.
+define allow-override
+  $(if $(or $(findstring environment,$(origin $(1))),\
+            $(findstring command line,$(origin $(1)))),,\
+    $(eval $(1) = $(2)))
+endef
+
+# Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
+$(call allow-override,CC,$(CROSS_COMPILE)gcc)
+$(call allow-override,AR,$(CROSS_COMPILE)ar)
+$(call allow-override,PKG_CONFIG,pkg-config)
+$(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/)
+$(call allow-override,LDCONFIG,ldconfig)
+
 INSTALL	=	install
-CC	:=	gcc
 FOPTS	:=	-flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \
-		-fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
-MOPTS	:=	-m64 -mtune=generic
+		-fasynchronous-unwind-tables -fstack-clash-protection
 WOPTS	:= 	-Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized
 
-TRACEFS_HEADERS		:= $$(pkg-config --cflags libtracefs)
+TRACEFS_HEADERS	:= $$($(PKG_CONFIG) --cflags libtracefs)
 
 CFLAGS	:=	-O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS)
 LDFLAGS	:=	-ggdb
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help