Skip to contentSkip to conversation

trace-cmd: Have /etc paths honor $(prefix) if not the default

PATCH New Steven Rostedt 1 participant 1 message Jan 29, 2020 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: Have /etc paths honor $(prefix) if not the default

From: "Steven Rostedt (VMware)" <[email protected]>

As some files need to be placed in the root directory to take effect (like the bash_completion) and not the normal /usr/local directory, they ignore the $(prefix) and install directly. Unfortunately, this means that if someone does a build like "make O=/tmp/mydir install" those files will still try to be installed in the root "/etc" directory, and that will not work if the user installing does not have permission.

Have the "/etc" directory change if prefix is something other than "/usr/local".

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206277

Fixes 77bdcb9b2 ("trace-cmd: Install trace-cmd.bash when installing")
---
 Makefile | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Makefile +9 -2
index 477625f7..d75f1437 100644
@@ -51,6 +51,13 @@ libdir_SQ = '$(subst ','\'',$(libdir))'
 includedir = $(prefix)/include
 includedir_SQ = '$(subst ','\'',$(includedir))'
 
+ifeq ($(prefix),/usr/local)
+etcdir ?= /etc
+else
+etcdir ?= $(prefix)/etc
+endif
+etcdir_SQ = '$(subst ','\'',$(etcdir))'
+
 export man_dir man_dir_SQ html_install html_install_SQ INSTALL
 export img_install img_install_SQ
 export DESTDIR DESTDIR_SQ
@@ -87,8 +94,8 @@ HELP_DIR = -DHELP_DIR=$(html_install)
 HELP_DIR_SQ = '$(subst ','\'',$(HELP_DIR))'
 #' emacs highlighting gets confused by the above escaped quote.
 
-BASH_COMPLETE_DIR ?= /etc/bash_completion.d
-LD_SO_CONF_DIR ?= /etc/ld.so.conf.d
+BASH_COMPLETE_DIR ?= $(etcdir)/bash_completion.d
+LD_SO_CONF_DIR ?= $(etcdir)/ld.so.conf.d
 TRACE_LD_FILE ?= trace.conf
 
 export PLUGIN_DIR_TRACEEVENT
Signature · 1 line
2.20.1