mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-23 21:51:27 +00:00
Makefiles: respect DESTDIR when specified
Not all SCST components handle DESTDIR properly, or at all. In particular: * INSTALL_MOD_PATH should account for DESTDIR when 'make modules_install' is invoked, so the kernel make infrastructure deploys the modules and runs depmod against the proper directory tree. * depmods must include a '-b' option to reference the proper directory tree. * Drop special ISCSI_DESTDIR. Signed-off-by: Steven J. Magnani <steve@digidescorp.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5289 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
5
Makefile
5
Makefile
@@ -51,7 +51,6 @@ MVSAS_DIR=mvsas_tgt
|
||||
FCST_DIR=fcst
|
||||
|
||||
ISCSI_DIR=iscsi-scst
|
||||
#ISCSI_DESTDIR=../../../iscsi_scst_inst
|
||||
|
||||
VERSION = $(shell echo -n "$$(sed -n 's/^\#define[[:blank:]]SCST_VERSION_NAME[[:blank:]]*\"\([^-]*\).*\"/\1/p' scst/include/scst_const.h)."; \
|
||||
if svn info >/dev/null 2>&1; \
|
||||
@@ -155,7 +154,7 @@ install:
|
||||
# @if [ -d $(QLA_ISP_DIR) ]; then cd $(QLA_ISP_DIR) && $(MAKE) $@; fi
|
||||
# @if [ -d $(LSI_DIR) ]; then cd $(LSI_DIR) && $(MAKE) $@; fi
|
||||
# @if [ -d $(SRP_DIR) ]; then cd $(SRP_DIR) && $(MAKE) $@; fi
|
||||
@if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) DESTDIR=$(ISCSI_DESTDIR) $@; fi
|
||||
@if [ -d $(ISCSI_DIR) ]; then cd $(ISCSI_DIR) && $(MAKE) $@; fi
|
||||
@if [ -d $(USR_DIR) ]; then cd $(USR_DIR) && $(MAKE) $@; fi
|
||||
@if [ -d $(SCST_LOCAL_DIR) ]; then cd $(SCST_LOCAL_DIR) && $(MAKE) $@; fi
|
||||
|
||||
@@ -273,7 +272,7 @@ iscsi:
|
||||
cd $(ISCSI_DIR) && $(MAKE) all
|
||||
|
||||
iscsi_install:
|
||||
cd $(ISCSI_DIR) && $(MAKE) DESTDIR=$(ISCSI_DESTDIR) install
|
||||
cd $(ISCSI_DIR) && $(MAKE) install
|
||||
|
||||
iscsi_uninstall:
|
||||
cd $(ISCSI_DIR) && $(MAKE) uninstall
|
||||
|
||||
@@ -64,13 +64,17 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
INSTALL_DIR := /lib/modules/$(KVER)/extra
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
|
||||
SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \
|
||||
then echo "$$PWD/../scst/include"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
else echo "$(DESTDIR)$(PREFIX)/include/scst"; fi)
|
||||
SCST_DIR := $(shell if [ -e "$$PWD/../scst" ]; then echo "$$PWD/../scst/src"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
else echo "$(DESTDIR)$(PREFIX)/include/scst"; fi)
|
||||
|
||||
all: Modules.symvers Module.symvers
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m \
|
||||
@@ -107,7 +111,7 @@ endif
|
||||
|
||||
uninstall:
|
||||
rm -f $(INSTALL_DIR)/$(MODULE_NAME).ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
|
||||
|
||||
########## END OUT-OF-TREE RULES ##########
|
||||
endif
|
||||
|
||||
@@ -22,6 +22,12 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
|
||||
# The file Modules.symvers has been renamed in the 2.6.18 kernel to
|
||||
# Module.symvers. Find out which name to use by looking in $(KDIR).
|
||||
MODULE_SYMVERS:=$(shell if [ -e $(KDIR)/Module.symvers ]; then \
|
||||
|
||||
@@ -15,9 +15,9 @@ SUBDIRS := $(shell pwd)
|
||||
|
||||
SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \
|
||||
then echo "$$PWD/../scst/include"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
else echo "$(DESTDIR)$(PREFIX)/include/scst"; fi)
|
||||
SCST_DIR := $(shell if [ -e "$$PWD/../scst" ]; then echo "$$PWD/../scst/src"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
else echo "$(DESTDIR)$(PREFIX)/include/scst"; fi)
|
||||
SBINDIR := $(PREFIX)/sbin
|
||||
INITDIR := /etc/init.d
|
||||
RCDIR := /etc/rc.d
|
||||
@@ -42,6 +42,12 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
|
||||
all: include/iscsi_scst_itf_ver.h progs mods
|
||||
|
||||
mods: Modules.symvers Module.symvers
|
||||
|
||||
@@ -53,6 +53,11 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
LSI_INC_DIR := $(KDIR)/drivers/message/fusion
|
||||
EXTRA_CFLAGS += -I$(LSI_INC_DIR)
|
||||
|
||||
@@ -90,7 +95,7 @@ endif
|
||||
|
||||
uninstall:
|
||||
rm -f $(INSTALL_DIR)/mpt_scst.ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
|
||||
|
||||
########## END OUT-OF-TREE RULES ##########
|
||||
endif
|
||||
|
||||
@@ -115,7 +115,7 @@ endif
|
||||
|
||||
uninstall:
|
||||
rm -f $(INSTALL_DIR)/$(MODULE_NAME).ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
|
||||
|
||||
########## END OUT-OF-TREE RULES ##########
|
||||
endif
|
||||
|
||||
@@ -44,6 +44,12 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
|
||||
ifneq ($(PATCHLEVEL),)
|
||||
obj-m := qla2xxx_scst.o
|
||||
qla2xxx_scst-objs := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
|
||||
@@ -59,7 +65,7 @@ install: all
|
||||
|
||||
uninstall:
|
||||
rm -f $(INSTALL_DIR)/qla2xxxt.ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
|
||||
|
||||
########## END OUT-OF-TREE RULES ##########
|
||||
endif
|
||||
|
||||
@@ -56,6 +56,10 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_2X_MODULE),)
|
||||
QLA2XXX_INC_DIR := $(KDIR)/drivers/scsi/qla2xxx
|
||||
else
|
||||
@@ -77,14 +81,14 @@ ifndef PREFIX
|
||||
PREFIX=/usr/local
|
||||
endif
|
||||
|
||||
INSTALL_DIR := /lib/modules/$(KVER)/extra
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
|
||||
SCST_INC_DIR := $(shell if [ -e "$$PWD/../../scst" ]; \
|
||||
then echo "$$PWD/../../scst/include"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
else echo "$(DESTDIR)$(PREFIX)/include/scst"; fi)
|
||||
SCST_DIR := $(shell if [ -e "$$PWD/../../scst" ]; \
|
||||
then echo "$$PWD/../../scst/src"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
else echo "$(DESTDIR)$(PREFIX)/include/scst"; fi)
|
||||
|
||||
ifneq ($(BUILD_2X_MODULE),)
|
||||
# We need to make qla2xxx_scst before Module.symvers
|
||||
@@ -108,7 +112,7 @@ ifneq ($(BUILD_2X_MODULE),)
|
||||
$(MAKE) SUBDIRS=$(QLA2XXX_DIR) -C $(QLA2XXX_DIR) $@
|
||||
endif
|
||||
rm -f $(INSTALL_DIR)/qla2[23x]00tgt.ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
|
||||
|
||||
ifneq ($(BUILD_2X_MODULE),)
|
||||
qla2xxx_scst:
|
||||
|
||||
@@ -69,6 +69,10 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
all:
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_DEV=m
|
||||
|
||||
@@ -103,7 +107,7 @@ ifneq ($(MOD_VERS),)
|
||||
rm -f $(INSTALL_DIR_H)/Modules.symvers
|
||||
install -m 644 Module.symvers $(INSTALL_DIR_H)
|
||||
endif
|
||||
-/sbin/depmod -a $(KVER)
|
||||
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
|
||||
mkdir -p $(DESTDIR)/var/lib/scst/pr
|
||||
@echo "****************************************************************"
|
||||
@echo "*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*"
|
||||
@@ -122,13 +126,13 @@ uninstall:
|
||||
cd $(DEV_HANDLERS_DIR) && $(MAKE) $@
|
||||
rm -f $(INSTALL_DIR)/scst.ko
|
||||
-rmdir $(INSTALL_DIR) 2>/dev/null
|
||||
-/sbin/depmod -a $(KVER)
|
||||
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
|
||||
rm -rf $(INSTALL_DIR_H)
|
||||
|
||||
########## END OUT-OF-TREE RULES ##########
|
||||
endif
|
||||
|
||||
INSTALL_DIR := $(DESTDIR)/lib/modules/$(KVER)/extra
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
INSTALL_DIR_H := $(DESTDIR)$(PREFIX)/include/scst
|
||||
|
||||
enable-Wextra = $(shell uname_r="$$(uname -r)"; if [ "$${uname_r%.el5}" = "$${uname_r}" ]; then echo "$(1)"; fi)
|
||||
|
||||
@@ -61,7 +61,11 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
INSTALL_DIR := /lib/modules/$(KVER)/extra
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
|
||||
all:
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd)
|
||||
|
||||
@@ -42,13 +42,18 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
|
||||
SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \
|
||||
then echo "$$PWD/../scst/include"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
else echo "$(DESTDIR)$(PREFIX)/include/scst"; fi)
|
||||
SCST_DIR := $(shell if [ -e "$$PWD/../scst" ]; \
|
||||
then echo "$$PWD/../scst/src"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
else echo "$(DESTDIR)$(PREFIX)/include/scst"; fi)
|
||||
|
||||
all: Modules.symvers Module.symvers
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m \
|
||||
@@ -77,7 +82,7 @@ endif
|
||||
|
||||
uninstall:
|
||||
rm -f $(INSTALL_DIR)/scst_local.ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
|
||||
|
||||
########## END OUT-OF-TREE RULES ##########
|
||||
endif
|
||||
|
||||
@@ -7,10 +7,10 @@ endif
|
||||
|
||||
SCST_INC_DIR := $(shell if [ -e "$$PWD/../scst" ]; \
|
||||
then echo "$$PWD/../scst/include"; \
|
||||
else echo "$(PREFIX)/include/scst"; fi)
|
||||
else echo "$(DESTDIR)$(PREFIX)/include/scst"; fi)
|
||||
SCST_SYMVERS_DIR := $(shell if [ -e $$PWD/../scst ]; then \
|
||||
echo $$PWD/../scst/src; \
|
||||
else echo $(PREFIX)/include/scst; fi)
|
||||
else echo $(DESTDIR)$(PREFIX)/include/scst; fi)
|
||||
SUBDIRS := $(shell pwd)
|
||||
|
||||
ifeq ($(KVER),)
|
||||
@@ -30,6 +30,12 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
ifeq ($(INSTALL_MOD_PATH),)
|
||||
export INSTALL_MOD_PATH := $(DESTDIR)
|
||||
endif
|
||||
|
||||
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
|
||||
|
||||
# Set variable $(2) to value $(3) in file $(1).
|
||||
set_var = $(shell { if [ -e "$(1)" ]; then grep -v '^$(2)=' "$(1)"; fi; echo "$(2)=$(3)"; } >/tmp/$(1)-$$$$.tmp && mv /tmp/$(1)-$$$$.tmp $(1))
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ OBJS_F = $(SRCS_F:.c=.o)
|
||||
|
||||
SCST_INC_DIR := ../../scst/include
|
||||
#SCST_INC_DIR := $(PREFIX)/include/scst
|
||||
INSTALL_DIR := $(PREFIX)/bin/scst
|
||||
INSTALL_DIR := $(DESTDIR)$(PREFIX)/bin/scst
|
||||
|
||||
CFLAGS += -O2 -Wall -Wextra -Wno-unused-parameter -Wstrict-prototypes \
|
||||
-I$(SCST_INC_DIR) -D_GNU_SOURCE -D__USE_FILE_OFFSET64 \
|
||||
|
||||
Reference in New Issue
Block a user