From 369863f015ebab6e7fa216f4b166a641cbb498fa Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Fri, 8 Mar 2013 21:25:45 +0000 Subject: [PATCH] Allow install SCST in any location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the install location of SCST is pretty much hard coded into the Makefiles to be /usr/local. I am custom building a system for ZFS & SCST and I want to install in /usr instead of /usr/local. Currently I am doing a “find . -name Makefile -exec sed -i 's:/usr/local:/usr:g' {} \;” to accommodate this. This patch fixes it. From Sietse van Zanen git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4791 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- fcst/Makefile | 8 ++++++-- iscsi-scst/Makefile | 12 ++++++++---- iscsi-scst/usr/Makefile | 6 +++++- mpt/Makefile | 6 +++++- mvsas_tgt/Makefile | 5 ++++- qla2x00t/qla2x00-target/Makefile | 8 ++++++-- scst/src/Makefile | 6 +++++- scst_local/Makefile | 8 ++++++-- scstadmin/Makefile | 6 +++++- scstadmin/scstadmin.procfs/Makefile | 6 +++++- scstadmin/scstadmin.sysfs/Makefile | 6 +++++- srpt/Makefile | 7 +++++-- usr/fileio/Makefile | 8 ++++++-- 13 files changed, 71 insertions(+), 21 deletions(-) diff --git a/fcst/Makefile b/fcst/Makefile index d65b11a47..c82997771 100644 --- a/fcst/Makefile +++ b/fcst/Makefile @@ -26,6 +26,10 @@ # - install and uninstall must be made as root # +ifndef PREFIX + PREFIX=/usr/local +endif + ifeq ($(KVER),) ifeq ($(KDIR),) KVER = $(shell uname -r) @@ -58,9 +62,9 @@ include $(SUBDIRS)/Makefile_in-tree else SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \ then echo "$$PWD/../scst/include"; \ - else echo "/usr/local/include/scst"; fi) + else echo "$(PREFIX)/include/scst"; fi) SCST_DIR := $(shell if [ -e "$$PWD/../scst" ]; then echo "$$PWD/../scst/src"; \ - else echo "/usr/local/include/scst"; fi) + else echo "$(PREFIX)/include/scst"; fi) all: Modules.symvers Module.symvers $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m \ diff --git a/iscsi-scst/Makefile b/iscsi-scst/Makefile index 00d18b092..4290334e2 100644 --- a/iscsi-scst/Makefile +++ b/iscsi-scst/Makefile @@ -5,19 +5,23 @@ # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (not a .c file). +ifndef PREFIX + PREFIX=/usr/local +endif + SHELL=/bin/bash SUBDIRS := $(shell pwd) SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \ then echo "$$PWD/../scst/include"; \ - else echo "/usr/local/include/scst"; fi) + else echo "$(PREFIX)/include/scst"; fi) SCST_DIR := $(shell if [ -e "$$PWD/../scst" ]; then echo "$$PWD/../scst/src"; \ - else echo "/usr/local/include/scst"; fi) -SBINDIR := /usr/local/sbin + else echo "$(PREFIX)/include/scst"; fi) +SBINDIR := $(PREFIX)/sbin INITDIR := /etc/init.d RCDIR := /etc/rc.d -MANDIR := /usr/local/man +MANDIR := $(PREFIX)/man KMOD := $(shell pwd)/kernel INCDIR := $(shell pwd)/include diff --git a/iscsi-scst/usr/Makefile b/iscsi-scst/usr/Makefile index c9a5ad2d3..6fb62c507 100644 --- a/iscsi-scst/usr/Makefile +++ b/iscsi-scst/usr/Makefile @@ -15,6 +15,10 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +ifndef PREFIX + PREFIX=/usr/local +endif + SRCS_D = iscsid.c iscsi_scstd.c conn.c session.c target.c message.c ctldev.c \ log.c chap.c event.c param.c config.c isns.c md5.c sha1.c \ misc.c @@ -24,7 +28,7 @@ SRCS_ADM = iscsi_adm.c param.c OBJS_ADM = $(SRCS_ADM:.c=.o) SCST_INC_DIR := ../../scst/include -#SCST_INC_DIR := /usr/local/include/scst +#SCST_INC_DIR := $(PREFIX)/include/scst CFLAGS += -O2 -fno-inline -Wall -Wextra -Wstrict-prototypes -Wno-sign-compare \ -Wimplicit-function-declaration -Wno-unused-parameter \ diff --git a/mpt/Makefile b/mpt/Makefile index d99ef8540..56b19500d 100644 --- a/mpt/Makefile +++ b/mpt/Makefile @@ -20,7 +20,11 @@ # - install and uninstall must be made as root # -#SCST_INC_DIR := /usr/local/include/scst +ifndef PREFIX + PREFIX=/usr/local +endif + +#SCST_INC_DIR := $(PREFIX)/include/scst #SCST_DIR := $(SCST_INC_DIR) SCST_INC_DIR := $(SUBDIRS)/../scst/include SCST_DIR := $(shell pwd)/../scst/src diff --git a/mvsas_tgt/Makefile b/mvsas_tgt/Makefile index 153f65cdc..35b8a878a 100644 --- a/mvsas_tgt/Makefile +++ b/mvsas_tgt/Makefile @@ -25,6 +25,9 @@ # - install and uninstall must be made as root # +ifndef PREFIX + PREFIX=/usr/local +endif ifeq ($(KVER),) ifeq ($(KDIR),) @@ -38,7 +41,7 @@ endif export PWD := $(shell pwd) export LIBSAS := m -#SCST_INC_DIR := /usr/local/include/scst +#SCST_INC_DIR := $(PREFIX)/include/scst #SCST_DIR := $(SCST_INC_DIR) SCST_INC_DIR := $(SUBDIRS)/../scst/include SCST_DIR := $(shell pwd)/../scst/src diff --git a/qla2x00t/qla2x00-target/Makefile b/qla2x00t/qla2x00-target/Makefile index 5d2e37bf6..18d9f4590 100644 --- a/qla2x00t/qla2x00-target/Makefile +++ b/qla2x00t/qla2x00-target/Makefile @@ -28,6 +28,10 @@ # - install and uninstall must be made as root # +ifndef PREFIX + PREFIX=/usr/local +endif + SHELL=/bin/bash EXTRA_CFLAGS += -I$(SCST_INC_DIR) @@ -69,10 +73,10 @@ else SCST_INC_DIR := $(shell if [ -e "$$PWD/../../scst" ]; \ then echo "$$PWD/../../scst/include"; \ - else echo "/usr/local/include/scst"; fi) + else echo "$(PREFIX)/include/scst"; fi) SCST_DIR := $(shell if [ -e "$$PWD/../../scst" ]; \ then echo "$$PWD/../../scst/src"; \ - else echo "/usr/local/include/scst"; fi) + else echo "$(PREFIX)/include/scst"; fi) ifneq ($(BUILD_2X_MODULE),) # We need to make qla2xxx_scst before Module.symvers diff --git a/scst/src/Makefile b/scst/src/Makefile index 6e81e007b..cc06e60b2 100644 --- a/scst/src/Makefile +++ b/scst/src/Makefile @@ -28,6 +28,10 @@ # - install and uninstall must be made as root # +ifndef PREFIX + PREFIX=/usr/local +endif + SHELL=/bin/bash DEV_HANDLERS_DIR = dev_handlers @@ -118,7 +122,7 @@ INSTALL_DIR := $(DESTDIR)/lib/modules/$(shell uname -r)/extra else INSTALL_DIR := $(DESTDIR)/lib/modules/$(KVER)/extra endif -INSTALL_DIR_H := $(DESTDIR)/usr/local/include/scst +INSTALL_DIR_H := $(DESTDIR)$(PREFIX)/include/scst enable-Wextra = $(shell uname_r="$$(uname -r)"; if [ "$${uname_r%.el5}" = "$${uname_r}" ]; then echo "$(1)"; fi) diff --git a/scst_local/Makefile b/scst_local/Makefile index e2b0605ba..b3bac7a97 100644 --- a/scst_local/Makefile +++ b/scst_local/Makefile @@ -2,6 +2,10 @@ # A Makefile for the scst-local ... # +ifndef PREFIX + PREFIX=/usr/local +endif + SHELL=/bin/bash KMOD := $(shell pwd)/kernel @@ -34,10 +38,10 @@ else SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \ then echo "$$PWD/../scst/include"; \ - else echo "/usr/local/include/scst"; fi) + else echo "$(PREFIX)/include/scst"; fi) SCST_DIR := $(shell if [ -e "$$PWD/../scst" ]; \ then echo "$$PWD/../scst/src"; \ - else echo "/usr/local/include/scst"; fi) + else echo "$(PREFIX)/include/scst"; fi) all: Modules.symvers Module.symvers $(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m \ diff --git a/scstadmin/Makefile b/scstadmin/Makefile index f874bae06..57b90a5b5 100644 --- a/scstadmin/Makefile +++ b/scstadmin/Makefile @@ -1,10 +1,14 @@ +ifndef PREFIX + PREFIX=/usr/local +endif + SCSTADMIN_DIR = $(shell if [ ! -h scstadmin ]; then \ rm -f scstadmin; \ ln -s scstadmin.sysfs scstadmin; \ fi; \ echo scstadmin) -MANDIR := $(DESTDIR)/usr/local/man +MANDIR := $(DESTDIR)$(PREFIX)/man INITDIR := $(shell if [ -f /etc/slackware-version ]; then \ echo /etc/rc.d; \ else \ diff --git a/scstadmin/scstadmin.procfs/Makefile b/scstadmin/scstadmin.procfs/Makefile index 715fed166..a81c18f26 100644 --- a/scstadmin/scstadmin.procfs/Makefile +++ b/scstadmin/scstadmin.procfs/Makefile @@ -1,7 +1,11 @@ +ifndef PREFIX + PREFIX=/usr/local +endif + MODULE_VERSION = 0.8.22 TOOL = scstadmin -SBINDIR := $(PREFIX)/usr/local/sbin +SBINDIR := $(PREFIX)$(PREFIX)/sbin all: perl-module diff --git a/scstadmin/scstadmin.sysfs/Makefile b/scstadmin/scstadmin.sysfs/Makefile index a2ce58a60..42b509479 100644 --- a/scstadmin/scstadmin.sysfs/Makefile +++ b/scstadmin/scstadmin.sysfs/Makefile @@ -1,7 +1,11 @@ +ifndef PREFIX + PREFIX=/usr/local +endif + MODULE_VERSION = 0.9.10 TOOL = scstadmin -SBINDIR := /usr/local/sbin +SBINDIR := $(PREFIX)/sbin all: perl-module diff --git a/srpt/Makefile b/srpt/Makefile index 57586110b..046026325 100644 --- a/srpt/Makefile +++ b/srpt/Makefile @@ -1,13 +1,16 @@ # # Makefile for ib_srpt.ko. # +ifndef PREFIX + PREFIX=/usr/local +endif SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \ then echo "$$PWD/../scst/include"; \ - else echo "/usr/local/include/scst"; fi) + else echo "$(PREFIX)/include/scst"; fi) SCST_SYMVERS_DIR := $(shell if [ -e $$PWD/../scst ]; then \ echo $$PWD/../scst/src; \ - else echo /usr/local/include/scst; fi) + else echo $(PREFIX)/include/scst; fi) SUBDIRS := $(shell pwd) ifeq ($(KVER),) diff --git a/usr/fileio/Makefile b/usr/fileio/Makefile index 308e39a87..3be1b4d48 100644 --- a/usr/fileio/Makefile +++ b/usr/fileio/Makefile @@ -15,6 +15,10 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +ifndef PREFIX + PREFIX=/usr/local +endif + SHELL=/bin/bash SRCS_F = fileio.c common.c debug.c crc32.c @@ -24,8 +28,8 @@ OBJS_F = $(SRCS_F:.c=.o) #OBJS_C = $(SRCS_C:.c=.o) SCST_INC_DIR := ../../scst/include -#SCST_INC_DIR := /usr/local/include/scst -INSTALL_DIR := /usr/local/bin/scst +#SCST_INC_DIR := $(PREFIX)/include/scst +INSTALL_DIR := $(PREFIX)/bin/scst CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes \ -I$(SCST_INC_DIR) -D_GNU_SOURCE -D__USE_FILE_OFFSET64 \