[stgt] [PATCH] Make PREFIX, sbindir, sysconfdir, mandir and docdir configurable.

Florian Haas florian.haas at linbit.com
Mon Oct 5 13:35:33 CEST 2009


Suggested by Chris Webb. May be helpful for users installing in
non-default locations.

PREFIX defaults to /usr. sbindir, mandir and docdir are relative to
$(PREFIX), whereas sysconfdir is not.
---
 Makefile         |    7 +++++--
 conf/Makefile    |    6 ++++--
 doc/Makefile     |    4 ++--
 scripts/Makefile |    6 ++++--
 usr/Makefile     |    6 ++++--
 5 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 56d4b10..dbdda22 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,13 @@
 VERSION ?= 0.9.9
 
+# Define a common prefix where binaries and docs install
+PREFIX ?= /usr
+
 # This tarball is generated by "make tarball", see below
 TARBALL = tgt-$(VERSION).tar.bz2
 
-# Export VERSION so sub-make knows about it
-export VERSION
+# Export VERSION and PREFIX so sub-make knows about them
+export VERSION PREFIX
 
 # Export the feature switches so sub-make knows about them
 export ISCSI ISCSI_RDMA IBMVIO FCOE FCP
diff --git a/conf/Makefile b/conf/Makefile
index dcfbcb3..4f5ae77 100644
--- a/conf/Makefile
+++ b/conf/Makefile
@@ -1,10 +1,12 @@
+sysconfdir ?= /etc
+
 .PHONY: all
 all:
 
 .PHONY: install
 install:
-	install -d -m 755 $(DESTDIR)/etc/tgt
-	install -m 644 targets.conf $(DESTDIR)/etc/tgt
+	install -d -m 755 $(DESTDIR)$(sysconfdir)/tgt
+	install -m 644 targets.conf $(DESTDIR)$(sysconfdir)/tgt
 
 .PHONY: clean
 clean:
diff --git a/doc/Makefile b/doc/Makefile
index 6a08015..11652d9 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,5 +1,5 @@
-mandir = /usr/share/man
-docdir = /usr/share/doc/tgt-$(VERSION)
+mandir ?= $(PREFIX)/share/man
+docdir ?= $(PREFIX)/share/doc/tgt-$(VERSION)
 
 MANPAGES = manpages/tgtadm.8 manpages/tgt-admin.8 \
 		manpages/tgt-setup-lun.8
diff --git a/scripts/Makefile b/scripts/Makefile
index f955129..db88911 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -1,3 +1,5 @@
+sbindir ?= $(PREFIX)/sbin
+
 SCRIPTS += tgt-setup-lun tgt-admin
 
 .PHONY: all
@@ -5,8 +7,8 @@ all:
 
 .PHONY: install
 install: $(SCRIPTS)
-	install -d -m 755 $(DESTDIR)/usr/sbin
-	install -m 755 $(SCRIPTS) $(DESTDIR)/usr/sbin
+	install -d -m 755 $(DESTDIR)$(sbindir)
+	install -m 755 $(SCRIPTS) $(DESTDIR)$(sbindir)
 
 .PHONY: clean
 clean:
diff --git a/usr/Makefile b/usr/Makefile
index 231a088..29f091d 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -1,3 +1,5 @@
+sbindir ?= $(PREFIX)/sbin
+
 ifneq ($(shell test -e /usr/include/linux/signalfd.h && echo 1),)
 CFLAGS += -DUSE_SIGNALFD
 endif
@@ -89,8 +91,8 @@ tgtimg: tgtimg.o libssc.o libcrc32c.o
 
 .PHONY: install
 install: $(PROGRAMS)
-	install -d -m 755 $(DESTDIR)/usr/sbin
-	install -m 755 $(PROGRAMS) $(DESTDIR)/usr/sbin
+	install -d -m 755 $(DESTDIR)$(sbindir)
+	install -m 755 $(PROGRAMS) $(DESTDIR)$(sbindir)
 
 .PHONY: clean
 clean:
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list