mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-19 03:31:26 +00:00
qla2x00t: Make out-of-tree build possible (backport r3910 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4440 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
ifeq ($(BUILD_2X_MODULE),)
|
||||
|
||||
qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
|
||||
qla_dbg.o qla_sup.o qla_attr.o qla_mid.o qla_dfs.o
|
||||
|
||||
@@ -12,3 +14,56 @@ extraclean: clean
|
||||
rm -f *.orig *.rej
|
||||
|
||||
.PHONY: clean extraclean
|
||||
|
||||
else
|
||||
|
||||
SHELL=/bin/bash
|
||||
|
||||
KMOD := $(shell pwd)/kernel
|
||||
|
||||
enable-Wextra = $(shell uname_r="$$(uname -r)"; if [ "$${uname_r%.el5}" = "$${uname_r}" ]; then echo "$(1)"; fi)
|
||||
|
||||
EXTRA_CFLAGS += $(call enable-Wextra,-Wextra -Wno-unused-parameter \
|
||||
-Wno-missing-field-initializers)
|
||||
|
||||
ifneq ($(CONFIG_SCSI_QLA2XXX_TARGET),)
|
||||
EXTRA_CFLAGS += -DCONFIG_SCSI_QLA2XXX_TARGET=$(CONFIG_SCSI_QLA2XXX_TARGET)
|
||||
endif
|
||||
|
||||
ifeq ($(KVER),)
|
||||
ifeq ($(KDIR),)
|
||||
KDIR := /lib/modules/$(shell uname -r)/build
|
||||
endif
|
||||
else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
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 \
|
||||
qla_dbg.o qla_sup.o qla_attr.o qla_mid.o qla_dfs.o
|
||||
else
|
||||
|
||||
all:
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m
|
||||
|
||||
install: all
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m \
|
||||
modules_install
|
||||
-/sbin/depmod -aq $(KVER)
|
||||
|
||||
uninstall:
|
||||
rm -f $(INSTALL_DIR)/qla2xxxt.ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
endif
|
||||
|
||||
clean:
|
||||
@$(MAKE) -C $(KDIR) M=$(PWD) clean
|
||||
@$(RM) tags Modules.symvers module.symvers Module.markers modules.order
|
||||
|
||||
extraclean: clean
|
||||
rm -f *.orig *.rej
|
||||
|
||||
.PHONY: all tgt install uninstall clean extraclean
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#
|
||||
# Qlogic 2x00 SCSI target driver makefile
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2004 - 2011 Vladislav Bolkhovitin <vst@vlnb.net>
|
||||
# Copyright (C) 2004 - 2005 Leonid Stoljar
|
||||
# Copyright (C) 2006 - 2010 ID7 Ltd.
|
||||
# Copyright (C) 2010 - 2011 SCST Ltd.
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation, version 2
|
||||
@@ -56,30 +56,58 @@ else
|
||||
KDIR := /lib/modules/$(KVER)/build
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_2X_MODULE),)
|
||||
QLA2XXX_INC_DIR := $(KDIR)/drivers/scsi/qla2xxx
|
||||
else
|
||||
QLA2XXX_INC_DIR := $(SUBDIRS)/..
|
||||
QLA2XXX_DIR := $(shell pwd)/..
|
||||
QLA2XXX_SCST := qla2xxx_scst
|
||||
EXTRA_CFLAGS += -DCONFIG_SCSI_QLA2XXX_TARGET=y
|
||||
endif
|
||||
|
||||
EXTRA_CFLAGS += -I$(QLA2XXX_INC_DIR)
|
||||
|
||||
ifneq ($(PATCHLEVEL),)
|
||||
obj-m := qla2x00tgt.o
|
||||
qla2x00tgt-objs := qla2x00t.o
|
||||
|
||||
else
|
||||
|
||||
all: Modules.symvers Module.symvers
|
||||
ifneq ($(BUILD_2X_MODULE),)
|
||||
# We need to make qla2xxx_scst before Module.symvers
|
||||
.NOTPARALLEL:
|
||||
endif
|
||||
|
||||
all: $(QLA2XXX_SCST) Modules.symvers Module.symvers
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m
|
||||
|
||||
tgt: Modules.symvers Module.symvers
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=n
|
||||
|
||||
install: all
|
||||
ifneq ($(BUILD_2X_MODULE),)
|
||||
$(MAKE) SUBDIRS=$(QLA2XXX_DIR) -C $(QLA2XXX_DIR) $@
|
||||
endif
|
||||
$(MAKE) -C $(KDIR) SUBDIRS=$(shell pwd) BUILD_INI=m \
|
||||
modules_install
|
||||
-/sbin/depmod -a $(KVER)
|
||||
|
||||
uninstall:
|
||||
ifneq ($(BUILD_2X_MODULE),)
|
||||
$(MAKE) SUBDIRS=$(QLA2XXX_DIR) -C $(QLA2XXX_DIR) $@
|
||||
endif
|
||||
rm -f $(INSTALL_DIR)/qla2[23x]00tgt.ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
|
||||
ifneq ($(BUILD_2X_MODULE),)
|
||||
qla2xxx_scst:
|
||||
$(MAKE) BUILD_2X_MODULE=$(BUILD_2X_MODULE) CONFIG_SCSI_QLA2XXX_TARGET=y \
|
||||
SUBDIRS=$(QLA2XXX_DIR) -C $(QLA2XXX_DIR) all
|
||||
endif
|
||||
|
||||
SCST_MOD_VERS := $(shell ls $(SCST_DIR)/Modules.symvers 2>/dev/null)
|
||||
ifneq ($(SCST_MOD_VERS),)
|
||||
Modules.symvers: $(SCST_DIR)/Modules.symvers
|
||||
cp $(SCST_DIR)/Modules.symvers .
|
||||
ifneq ($(BUILD_2X_MODULE),)
|
||||
cat $(QLA2XXX_DIR)/Modules.symvers >>Modules.symvers
|
||||
endif
|
||||
else
|
||||
.PHONY: Modules.symvers
|
||||
endif
|
||||
@@ -89,13 +117,13 @@ 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 .
|
||||
ifneq ($(BUILD_2X_MODULE),)
|
||||
cat $(QLA2XXX_DIR)/Module.symvers >>Module.symvers
|
||||
endif
|
||||
else
|
||||
.PHONY: Module.symvers
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
rm -f $(INSTALL_DIR)/qla2[23x]00tgt.ko
|
||||
-/sbin/depmod -a $(KVER)
|
||||
endif
|
||||
|
||||
clean:
|
||||
@@ -148,4 +176,4 @@ enable_proc:
|
||||
@cmp ../qla_attr.c ../qla_attr.c.aa >/dev/null; if [[ $$? = 0 ]]; then rm ../qla_attr.c.aa; echo "sed failed: wrong original state?"; false; fi
|
||||
rm ../qla_attr.c.aa
|
||||
|
||||
.PHONY: all tgt install uninstall clean extraclean debug2perf debug2release perf2debug release2debug disable_proc enable_proc
|
||||
.PHONY: all tgt install uninstall clean extraclean debug2perf debug2release perf2debug release2debug disable_proc enable_proc qla2xxx_scst
|
||||
|
||||
Reference in New Issue
Block a user