Files
scst/iscsi-scst/Makefile
Vladislav Bolkhovitin 7bde8810f5 Currently there are three different init scripts inside the SCST project:
scst, iscsi-scst and qla2x00t. This makes it unnecessary hard for users to
run several target drivers simultaneously. Additionally, several variants of
these init scripts exist for different distributions. This patch unifies all
these init scripts into a single init script. Additionally, some new features
have been added:
- Kernel module parameters can now be specified per kernel module in
  /etc/default/scst. An example:
 ib_srpt_parameters="thread=1 srp_max_req_size=4200"
- When using the sysfs interface, compute the kernel module list from scst.conf.
  Or, editing the SCST_MODULES variable is no longer necessary.
- When using the procfs interface, the SCST handler kernel module list is
  computed from /etc/scst.conf. The list of target driver kernel modules must
  now be configured in /etc/default/scst.

Other changes:
- scstadmin output is shown if scstadmin fails.
- Running make -C scstadmin install does no longer cause the scst script to
  be started at the next reboot - it is better to leave this as an explicit step.
- Made the error message generated if the lsb-core package has not yet been
  installed more clear.
- Use proper init script path on Slackware.
- make uninstall: run remove_initd under chroot if $(DESTDIR) is not empty.
- Fixed a bug in "make -C scstadmin uninstall": the path specified for removing
  /etc/init.d/scst was wrong.
- The command /etc/init.d/scst restart will only try to start SCST if stopping
  succeeded.
- Replaced "mkdir -m 755 -p $(DESTDIR)$(INITDIR)" by
  "install -d $(DESTDIR)$(INITDIR)" because of uniformity.

These changes have been tested on Ubuntu 11.04, Fedora 15, CentOS 5.6,
Scientific Linux 6.0, openSUSE 11.4, SLES11 SP1 and Slackware 13.37.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3564 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2011-06-10 02:38:04 +00:00

132 lines
6.5 KiB
Makefile

#
# Makefile for iSCSI-SCST
#
# Note! Dependencies are done automatically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (not a .c file).
SHELL=/bin/bash
SUBDIRS := $(shell pwd)
#SCST_INC_DIR := /usr/local/include/scst
SCST_INC_DIR := $(SUBDIRS)/../scst/include
#SCST_DIR := $(SCST_INC_DIR)
SCST_DIR := $(shell pwd)/../scst/src
SBINDIR := /usr/local/sbin
INITDIR := /etc/init.d
RCDIR := /etc/rc.d
KMOD := $(shell pwd)/kernel
INCDIR := $(shell pwd)/include
ifeq ($(KVER),)
ifeq ($(KDIR),)
KVER = $(shell uname -r)
KDIR ?= /lib/modules/$(KVER)/build
else
KVER = $$KERNELRELEASE
endif
else
KDIR ?= /lib/modules/$(KVER)/build
endif
all: include/iscsi_scst_itf_ver.h progs mods
mods: Modules.symvers Module.symvers
$(MAKE) -C $(KDIR) SCST_INC_DIR=$(SCST_INC_DIR) SUBDIRS=$(KMOD) modules
progs:
$(MAKE) -C usr
include/iscsi_scst_itf_ver.h: include/iscsi_scst.h
echo "/* Autogenerated, don't edit */" >include/iscsi_scst_itf_ver.h
echo "" >>include/iscsi_scst_itf_ver.h
echo -n "#define ISCSI_SCST_INTERFACE_VERSION " >>include/iscsi_scst_itf_ver.h
echo -n "ISCSI_VERSION_STRING \"_\" " >>include/iscsi_scst_itf_ver.h
echo "\"`sha1sum include/iscsi_scst.h|awk '{printf $$1}'`\"" >>include/iscsi_scst_itf_ver.h
install: all
@install -vD -m 755 usr/iscsi-scstd $(DESTDIR)$(SBINDIR)/iscsi-scstd
@install -vD -m 755 usr/iscsi-scst-adm $(DESTDIR)$(SBINDIR)/iscsi-scst-adm
@eval `sed -n 's/#define UTS_RELEASE /KERNELRELEASE=/p' $(KDIR)/include/linux/version.h $(KDIR)/include/linux/utsrelease.h 2>/dev/null`; \
install -vD -m 644 kernel/iscsi-scst.ko \
$(DESTDIR)$(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra/iscsi-scst.ko
-/sbin/depmod -aq $(KVER)
SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Modules.symvers 2>/dev/null)
ifneq ($(SCST_MOD_VERS),)
Modules.symvers: $(SCST_DIR)/Modules.symvers
echo $(SCST_MOD_VERS)
cp $(SCST_DIR)/Modules.symvers kernel/
else
.PHONY: Modules.symvers
endif
# It's renamed in 2.6.18
SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Module.symvers 2>/dev/null)
ifneq ($(SCST_MOD_VERS),)
Module.symvers: $(SCST_DIR)/Module.symvers
cp $(SCST_DIR)/Module.symvers kernel/
else
.PHONY: Module.symvers
endif
clean:
$(MAKE) -C usr $@
$(MAKE) -C $(KDIR) SUBDIRS=$(KMOD) $@
rm -f kernel/Modules.symvers kernel/Module.symvers \
kernel/Module.markers kernel/modules.order \
include/iscsi_scst_itf_ver.h
extraclean:
$(MAKE) -C usr $@
$(MAKE) -C $(KDIR) SUBDIRS=$(KMOD) clean
rm -f kernel/Modules.symvers kernel/Module.symvers \
kernel/Module.markers kernel/modules.order \
include/iscsi_scst_itf_ver.h \
kernel/*.orig kernel/*.rej
debug2release:
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
rm $(KMOD)/Makefile.aa
release2debug:
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_TRACING"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
rm $(KMOD)/Makefile.aa
debug2perf:
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
sed -i.aa s/"^EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
rm $(KMOD)/Makefile.aa
perf2debug:
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/"EXTRA_CFLAGS += \-DCONFIG_SCST_EXTRACHECKS"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
sed -i.aa s/"#EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/"EXTRA_CFLAGS += \-DCONFIG_SCST_DEBUG -g -fno-inline -fno-inline-functions"/ $(KMOD)/Makefile
@cmp $(KMOD)/Makefile $(KMOD)/Makefile.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(KMOD)/Makefile.aa; echo "sed failed: wrong original state?"; false; fi
rm $(KMOD)/Makefile.aa
disable_proc:
sed -i.aa s/"^#define CONFIG_SCST_PROC"/"\/* #define CONFIG_SCST_PROC *\/"/ $(INCDIR)/iscsi_scst_ver.h
@cmp $(INCDIR)/iscsi_scst_ver.h $(INCDIR)/iscsi_scst_ver.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(INCDIR)/iscsi_scst_ver.h.aa; echo "sed failed: wrong original state?"; false; fi
rm $(INCDIR)/iscsi_scst_ver.h.aa
enable_proc:
sed -i.aa s/"\/\* #define CONFIG_SCST_PROC \*\/"/"#define CONFIG_SCST_PROC"/ $(INCDIR)/iscsi_scst_ver.h
@cmp $(INCDIR)/iscsi_scst_ver.h $(INCDIR)/iscsi_scst_ver.h.aa >/dev/null; if [[ $$? = 0 ]]; then rm $(INCDIR)/iscsi_scst_ver.h.aa; echo "sed failed: wrong original state?"; false; fi
rm $(INCDIR)/iscsi_scst_ver.h.aa
.PHONY: all mods progs install clean extraclean debug2release release2debug debug2perf perf2debug disable_proc enable_proc