Skip to contentSkip to conversation

trace-cmd: make Makefile rpm-friendly

PATCH Randy Dunlap 3 participants 7 messages Apr 19, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

From: Randy Dunlap <[email protected]>

Update Makefile to support rpmbuild DESTDIR usage.

---
 Makefile |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +4 -3
@@ -18,10 +18,11 @@ AR = $(CROSS_COMPILE)ar
 EXT = -std=gnu99
 INSTALL = install
 
+DESTDIR =
 prefix ?= /usr/local
 bindir_relative = bin
-bindir = $(prefix)/$(bindir_relative)
-man_dir = $(prefix)/share/man
+bindir = $(DESTDIR)/$(prefix)/$(bindir_relative)
+man_dir = $(DESTDIR)/$(prefix)/share/man
 man_dir_SQ = '$(subst ','\'',$(man_dir))'
 
 export man_dir man_dir_SQ INSTALL
@@ -29,7 +30,7 @@ export man_dir man_dir_SQ INSTALL
 ifeq ($(prefix),$(HOME))
 plugin_dir = $(HOME)/.trace-cmd/plugins
 else
-plugin_dir = $(prefix)/share/trace-cmd/plugins
+plugin_dir = $(DESTDIR)/$(prefix)/share/trace-cmd/plugins
 PLUGIN_DIR = -DPLUGIN_DIR=$(plugin_dir)
 PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
 endif
#1 lore raw
Quoted 3 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

Update Makefile to support rpmbuild DESTDIR usage.

So, what would happen if you did
make DESTDIR=/usr/local install ?

I think you would get /usr/local/usr/local
So, I think I would NAK this patch.

I also don't believe there is anything magical about DESTDIR in a spec file. Essentially, prefix in this makefile is equivalent to DESTDIR, so you can replace DESTDIR with prefix in a spec template.

Quoted 36 lines
---
 Makefile |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Makefile +4 -4
@@ -18,10 +18,11 @@ AR = $(CROSS_COMPILE)ar
 EXT = -std=gnu99
 INSTALL = install
 
+DESTDIR =
 prefix ?= /usr/local
 bindir_relative = bin
-bindir = $(prefix)/$(bindir_relative)
-man_dir = $(prefix)/share/man
+bindir = $(DESTDIR)/$(prefix)/$(bindir_relative)
+man_dir = $(DESTDIR)/$(prefix)/share/man
 man_dir_SQ = '$(subst ','\'',$(man_dir))'
 
 export man_dir man_dir_SQ INSTALL
@@ -29,7 +30,7 @@ export man_dir man_dir_SQ INSTALL
 ifeq ($(prefix),$(HOME))
 plugin_dir = $(HOME)/.trace-cmd/plugins
 else
-plugin_dir = $(prefix)/share/trace-cmd/plugins
+plugin_dir = $(DESTDIR)/$(prefix)/share/trace-cmd/plugins
 PLUGIN_DIR = -DPLUGIN_DIR=$(plugin_dir)
 PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
 endif
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
Quoted 11 lines · John Kacur
Quoted 3 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

Update Makefile to support rpmbuild DESTDIR usage.

So, what would happen if you did
make DESTDIR=/usr/local install ?

Quoted 6 lines

I think you would get /usr/local/usr/local
So, I think I would NAK this patch.

I also don't believe there is anything magical about DESTDIR in a spec file. Essentially, prefix in this makefile is equivalent to DESTDIR, so you can replace DESTDIR with prefix in a spec template.

I see. Thanks for your comments.

Signature · 1 line
~Randy
#3 lore raw
In reply to John Kacur
Quoted 10 lines · John Kacur
Quoted 3 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

Update Makefile to support rpmbuild DESTDIR usage.

So, what would happen if you did
make DESTDIR=/usr/local install ?

Quoted 7 lines

I think you would get /usr/local/usr/local
So, I think I would NAK this patch.

I also don't believe there is anything magical about DESTDIR in a spec file. Essentially, prefix in this makefile is equivalent to DESTDIR, so you can replace DESTDIR with prefix in a spec template.

NAK is too strong. I was looking at what perf does, and it basically makes prefix and DESTDIR the same.

ifndef DESTDIR
prefix = $(HOME)
endif

We could do..

ifndef DESDIR
prefix = /usr/local/bin
endif

and then, if DESTDIR is not set, it would do the right thing.

-- Steve

#4 lore raw
Quoted 26 lines · Steven Rostedt
Quoted 10 lines · John Kacur
Quoted 3 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

Update Makefile to support rpmbuild DESTDIR usage.

So, what would happen if you did
make DESTDIR=/usr/local install ?

Quoted 7 lines

I think you would get /usr/local/usr/local
So, I think I would NAK this patch.

I also don't believe there is anything magical about DESTDIR in a spec file. Essentially, prefix in this makefile is equivalent to DESTDIR, so you can replace DESTDIR with prefix in a spec template.

NAK is too strong. I was looking at what perf does, and it basically makes prefix and DESTDIR the same.

ifndef DESTDIR
prefix = $(HOME)
endif

Quoted 7 lines

We could do..

ifndef DESDIR
prefix = /usr/local/bin
endif

and then, if DESTDIR is not set, it would do the right thing.

Yes, thanks, but I have it "fixed" now (for some daffynition of fixed).

Signature · 1 line
~Randy
#5 lore raw
In reply to Steven Rostedt
Quoted 26 lines · Steven Rostedt
Quoted 10 lines · John Kacur
Quoted 3 lines · Randy Dunlap

From: Randy Dunlap <[email protected]>

Update Makefile to support rpmbuild DESTDIR usage.

So, what would happen if you did
make DESTDIR=/usr/local install ?

Quoted 7 lines

I think you would get /usr/local/usr/local
So, I think I would NAK this patch.

I also don't believe there is anything magical about DESTDIR in a spec file. Essentially, prefix in this makefile is equivalent to DESTDIR, so you can replace DESTDIR with prefix in a spec template.

NAK is too strong. I was looking at what perf does, and it basically makes prefix and DESTDIR the same.

ifndef DESTDIR
prefix = $(HOME)
endif

Quoted 8 lines

We could do..

ifndef DESDIR
prefix = /usr/local/bin
endif

and then, if DESTDIR is not set, it would do the right thing.

Yeah, the above is actually an unsatisfactory workaround. see 7ae5f21361fea11f58c398701da635f778635d13

Another solution is to not copy obfuscated Makefiles when starting new projects!
/me runs away

#6 lore raw
Quoted 6 lines · John Kacur

Yeah, the above is actually an unsatisfactory workaround. see 7ae5f21361fea11f58c398701da635f778635d13

Another solution is to not copy obfuscated Makefiles when starting new projects!

Very much agreed.

Quoted 1 line

/me runs away

Signature · 1 line
~Randy