Split Makefiles: move kernel build rules into Kbuild files

This patch makes the Makefiles easier to read.



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9039 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-07-05 02:13:40 +00:00
parent 47403656ee
commit d6fd03107f
17 changed files with 119 additions and 175 deletions
+10
View File
@@ -0,0 +1,10 @@
KBUILD_EXTRA_SYMBOLS=$(src)/../scst/src/Module.symvers
ccflags-y += -I$(src)/../scst/include
obj-$(CONFIG_FCST) += fcst.o
fcst-objs := \
ft_cmd.o \
ft_io.o \
ft_scst.o \
ft_sess.o
-8
View File
@@ -32,11 +32,6 @@ export CONFIG_FCST := m
MODULE_NAME = fcst
ifneq ($(KERNELRELEASE),)
include $(src)/Makefile_in-tree
else
######### BEGIN OUT-OF-TREE RULES #########
ifndef PREFIX
PREFIX=/usr/local
endif
@@ -79,9 +74,6 @@ uninstall:
rm -f $(INSTALL_DIR)/$(MODULE_NAME).ko
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
########## END OUT-OF-TREE RULES ##########
endif
clean:
$(MAKE) -C $(KDIR) M=$(shell pwd) $@
+14
View File
@@ -0,0 +1,14 @@
ccflags-y += $(call cc-option,-Wextra) -Wno-unused-parameter \
-Wno-missing-field-initializers \
-I$(src)/../scst/include -I$(src)/include \
-DDEFAULT_SYMBOL_NAMESPACE=QLA32GB
ifneq ($(CONFIG_SCSI_QLA2XXX_TARGET),)
ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=$(CONFIG_SCSI_QLA2XXX_TARGET)
endif
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 qla_bsg.o \
qla_nx.o qla_mr.o qla_nx2.o qla_target.o qla_tmpl.o qla_nvme.o
-18
View File
@@ -44,23 +44,6 @@ endif
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
ifneq ($(PATCHLEVEL),)
ccflags-y += $(call cc-option,-Wextra) -Wno-unused-parameter \
-Wno-missing-field-initializers \
-I$(src)/../scst/include -I$(src)/include \
-DDEFAULT_SYMBOL_NAMESPACE=QLA32GB
ifneq ($(CONFIG_SCSI_QLA2XXX_TARGET),)
ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=$(CONFIG_SCSI_QLA2XXX_TARGET)
endif
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 qla_bsg.o \
qla_nx.o qla_mr.o qla_nx2.o qla_target.o qla_tmpl.o qla_nvme.o
else
all:
$(MAKE) -C $(KDIR) M=$(shell pwd) \
$(CONFIG_SCSI_QLA2XXX_TARGET)=CONFIG_SCSI_QLA2XXX_TARGET
@@ -76,7 +59,6 @@ uninstall:
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
########## END OUT-OF-TREE RULES ##########
endif
clean:
$(MAKE) -C $(KDIR) M=$(shell pwd) $@
+13
View File
@@ -0,0 +1,13 @@
KBUILD_EXTRA_SYMBOLS = $(src)/../../scst/src/Module.symvers \
$(src)/../Module.symvers
ccflags-y += -I$(src)/../../scst/include -I$(src)/..
ccflags-y += -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
#ccflags-y += -DCONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
#ccflags-y += -DCONFIG_QLA_TGT_DEBUG_SRR
ifneq ($(BUILD_2X_MODULE),)
ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=y
endif
obj-m := qla2x00tgt.o
qla2x00tgt-objs := qla_tgt.o scst_qla2xxx.o
+1 -27
View File
@@ -51,34 +51,11 @@ ifeq ($(INSTALL_MOD_PATH),)
export INSTALL_MOD_PATH := $(DESTDIR)
endif
ifeq ($(BUILD_2X_MODULE),)
QLA2XXX_INC_DIR := $(KDIR)/drivers/scsi/qla2xxx
else
QLA2XXX_INC_DIR := $(src)/..
ifneq ($(BUILD_2X_MODULE),)
QLA2XXX_DIR := $(shell pwd)/..
QLA2XXX_SCST := qla2xxx_scst
endif
ifneq ($(PATCHLEVEL),)
KBUILD_EXTRA_SYMBOLS = $(src)/../../scst/src/Module.symvers \
$(src)/../Module.symvers
ccflags-y += -I$(src)/../../scst/include
ccflags-y += -W -Wno-unused-parameter -Wno-missing-field-initializers
#ccflags-y += -DCONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
#ccflags-y += -DCONFIG_QLA_TGT_DEBUG_SRR
ifneq ($(BUILD_2X_MODULE),)
ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=y
endif
ccflags-y += -I$(QLA2XXX_INC_DIR)
obj-m := qla2x00tgt.o
qla2x00tgt-objs := qla_tgt.o scst_qla2xxx.o
else
######### BEGIN OUT-OF-TREE RULES #########
ifndef PREFIX
PREFIX=/usr/local
endif
@@ -112,9 +89,6 @@ qla2xxx_scst:
M=$(QLA2XXX_DIR) -C $(QLA2XXX_DIR) all
endif
########## END OUT-OF-TREE RULES ##########
endif
clean:
ifneq ($(BUILD_2X_MODULE),)
$(MAKE) -C $(QLA2XXX_DIR) $@
+11
View File
@@ -0,0 +1,11 @@
ccflags-y += $(call cc-option,-Wextra) -Wno-unused-parameter \
-Wno-missing-field-initializers -I$(src)/../scst/include\
-DDEFAULT_SYMBOL_NAMESPACE=QLA16GB
ifneq ($(CONFIG_SCSI_QLA2XXX_TARGET),)
ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=$(CONFIG_SCSI_QLA2XXX_TARGET)
endif
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 qla_bsg.o qla_nx.o
-15
View File
@@ -43,20 +43,6 @@ endif
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
ifneq ($(PATCHLEVEL),)
ccflags-y += $(call cc-option,-Wextra) -Wno-unused-parameter \
-Wno-missing-field-initializers -I$(src)/../scst/include\
-DDEFAULT_SYMBOL_NAMESPACE=QLA16GB
ifneq ($(CONFIG_SCSI_QLA2XXX_TARGET),)
ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=$(CONFIG_SCSI_QLA2XXX_TARGET)
endif
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 qla_bsg.o qla_nx.o
else
all:
$(MAKE) -C $(KDIR) M=$(shell pwd) \
$(CONFIG_SCSI_QLA2XXX_TARGET)=CONFIG_SCSI_QLA2XXX_TARGET
@@ -72,7 +58,6 @@ uninstall:
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
########## END OUT-OF-TREE RULES ##########
endif
clean:
$(MAKE) -C $(KDIR) M=$(shell pwd) $@
+13
View File
@@ -0,0 +1,13 @@
KBUILD_EXTRA_SYMBOLS = $(src)/../../scst/src/Module.symvers \
$(src)/../Module.symvers
ccflags-y += -I$(src)/../../scst/include -I$(src)/..
ccflags-y += -Wextra -Wno-unused-parameter -Wno-missing-field-initializers
#ccflags-y += -DCONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
#ccflags-y += -DCONFIG_QLA_TGT_DEBUG_SRR
ifneq ($(BUILD_2X_MODULE),)
ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=y
endif
obj-m := qla2x00tgt.o
qla2x00tgt-objs := qla2x00t.o
+1 -27
View File
@@ -50,34 +50,11 @@ ifeq ($(INSTALL_MOD_PATH),)
export INSTALL_MOD_PATH := $(DESTDIR)
endif
ifeq ($(BUILD_2X_MODULE),)
QLA2XXX_INC_DIR := $(KDIR)/drivers/scsi/qla2xxx
else
QLA2XXX_INC_DIR := $(src)/..
ifneq ($(BUILD_2X_MODULE),)
QLA2XXX_DIR := $(shell pwd)/..
QLA2XXX_SCST := qla2xxx_scst
endif
ifneq ($(PATCHLEVEL),)
KBUILD_EXTRA_SYMBOLS = $(src)/../../scst/src/Module.symvers \
$(src)/../Module.symvers
ccflags-y += -I$(src)/../../scst/include
ccflags-y += -W -Wno-unused-parameter -Wno-missing-field-initializers
#ccflags-y += -DCONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD
#ccflags-y += -DCONFIG_QLA_TGT_DEBUG_SRR
ifneq ($(BUILD_2X_MODULE),)
ccflags-y += -DCONFIG_SCSI_QLA2XXX_TARGET=y
endif
ccflags-y += -I$(QLA2XXX_INC_DIR)
obj-m := qla2x00tgt.o
qla2x00tgt-objs := qla2x00t.o
else
######### BEGIN OUT-OF-TREE RULES #########
ifndef PREFIX
PREFIX=/usr/local
endif
@@ -111,9 +88,6 @@ qla2xxx_scst:
M=$(QLA2XXX_DIR) -C $(QLA2XXX_DIR) all
endif
########## END OUT-OF-TREE RULES ##########
endif
clean:
ifneq ($(BUILD_2X_MODULE),)
$(MAKE) -C $(QLA2XXX_DIR) $@
+1 -1
View File
@@ -459,7 +459,7 @@ if [ "${include_fcst}" = true ]; then
done
fi
add_file "fcst/Makefile_in-tree" \
add_file "fcst/Kbuild" \
"drivers/scst/fcst/Makefile"
add_file "fcst/Kconfig" "drivers/scst/fcst/Kconfig"
+38
View File
@@ -0,0 +1,38 @@
# See also Documentation/core-api/symbol-namespaces.rst for more information
# about DEFAULT_SYMBOL_NAMESPACE.
ccflags-y += -I$(src)/../include $(call cc-option,-Wextra) \
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare\
-DDEFAULT_SYMBOL_NAMESPACE=SCST\
$(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM)
#ccflags-y += -DCONFIG_SCST_STRICT_SERIALIZING
#ccflags-y += -DCONFIG_SCST_USE_EXPECTED_VALUES
#ccflags-y += -DCONFIG_SCST_TEST_IO_IN_SIRQ
#ccflags-y += -DCONFIG_SCST_ABORT_CONSIDER_FINISHED_TASKS_AS_NOT_EXISTING
#ccflags-y += -DCONFIG_SCST_DEBUG_RETRY
#ccflags-y += -DCONFIG_SCST_DEBUG_OOM
#ccflags-y += -DCONFIG_SCST_DEBUG_SN
#ccflags-y += -DCONFIG_SCST_DEBUG_SYSFS_EAGAIN
# If defined, makes SCST zero allocated data buffers.
# Undefining it considerably improves performance and eases CPU load,
# but could create a security hole (information leakage), so
# enable it if you have strict security requirements.
#ccflags-y += -DSCST_STRICT_SECURITY
obj-m := scst.o
scst-y += scst_copy_mgr.o
scst-y += scst_debug.o
scst-y += scst_dlm.o
scst-y += scst_event.o
scst-y += scst_lib.o
scst-y += scst_local_cmd.o
scst-y += scst_main.o
scst-y += scst_mem.o
scst-y += scst_no_dlm.o
scst-y += scst_pres.o
scst-y += scst_sysfs.o
scst-y += scst_targ.o
scst-y += scst_tg.o
obj-$(CONFIG_SCST) += scst.o dev_handlers/
+3 -50
View File
@@ -35,51 +35,6 @@ SHELL=/bin/bash
DEV_HANDLERS_DIR = dev_handlers
ifneq ($(PATCHLEVEL),)
# See also Documentation/core-api/symbol-namespaces.rst for more information
# about DEFAULT_SYMBOL_NAMESPACE.
ccflags-y += -I$(src)/../include $(call cc-option,-Wextra) \
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare\
-DDEFAULT_SYMBOL_NAMESPACE=SCST\
$(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM)
#ccflags-y += -DCONFIG_SCST_STRICT_SERIALIZING
#ccflags-y += -DCONFIG_SCST_USE_EXPECTED_VALUES
#ccflags-y += -DCONFIG_SCST_TEST_IO_IN_SIRQ
#ccflags-y += -DCONFIG_SCST_ABORT_CONSIDER_FINISHED_TASKS_AS_NOT_EXISTING
#ccflags-y += -DCONFIG_SCST_DEBUG_RETRY
#ccflags-y += -DCONFIG_SCST_DEBUG_OOM
#ccflags-y += -DCONFIG_SCST_DEBUG_SN
#ccflags-y += -DCONFIG_SCST_DEBUG_SYSFS_EAGAIN
# If defined, makes SCST zero allocated data buffers.
# Undefining it considerably improves performance and eases CPU load,
# but could create a security hole (information leakage), so
# enable it if you have strict security requirements.
#ccflags-y += -DSCST_STRICT_SECURITY
obj-m := scst.o
scst-y += scst_copy_mgr.o
scst-y += scst_debug.o
scst-y += scst_dlm.o
scst-y += scst_event.o
scst-y += scst_lib.o
scst-y += scst_local_cmd.o
scst-y += scst_main.o
scst-y += scst_mem.o
scst-y += scst_no_dlm.o
scst-y += scst_pres.o
scst-y += scst_sysfs.o
scst-y += scst_targ.o
scst-y += scst_tg.o
obj-$(CONFIG_SCST) += scst.o dev_handlers/
obj-$(BUILD_DEV) += $(DEV_HANDLERS_DIR)/
else
######### BEGIN OUT-OF-TREE RULES #########
ifeq ($(KVER),)
ifeq ($(KDIR),)
KVER := $(shell uname -r)
@@ -115,10 +70,11 @@ $(SCST_INTF_VER_FILE): $(SCST_INC_DIR)/scst.h $(SCST_INC_DIR)/scst_const.h $(SCS
all: $(SCST_INTF_VER_FILE)
$(MAKE) -C certs KDIR=$(KDIR)
$(MAKE) -C $(KDIR) M=$(shell pwd) BUILD_DEV=m
$(MAKE) -C $(KDIR) M=$(shell pwd)
$(MAKE) -C $(KDIR) M=$(shell pwd)/dev_handlers
scst:
$(MAKE) -C $(KDIR) M=$(shell pwd) BUILD_DEV=n
$(MAKE) -C $(KDIR) M=$(shell pwd)
install: all
@if [ -z "$(DESTDIR)" ] && \
@@ -172,9 +128,6 @@ uninstall:
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
rm -rf $(INSTALL_DIR_H)
########## END OUT-OF-TREE RULES ##########
endif
INSTALL_DIR := $(INSTALL_MOD_PATH)/lib/modules/$(KVER)/extra
INSTALL_DIR_H := $(DESTDIR)$(PREFIX)/include/scst
+8
View File
@@ -0,0 +1,8 @@
KBUILD_EXTRA_SYMBOLS=$(src)/../Module.symvers
ccflags-y += -I$(src)/../../include \
$(call cc-option,-Wextra) \
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare
#ccflags-y += -DCONFIG_DEBUG_EXT_COPY_REMAP
obj-m := scst_cdrom.o scst_changer.o scst_disk.o scst_modisk.o scst_tape.o \
scst_vdisk.o scst_raid.o scst_processor.o scst_user.o
-16
View File
@@ -29,19 +29,6 @@
SHELL=/bin/bash
ifneq ($(PATCHLEVEL),)
KBUILD_EXTRA_SYMBOLS=$(src)/../../Module.symvers
ccflags-y += -I$(src)/../../include \
$(call cc-option,-Wextra) \
-Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare
#ccflags-y += -DCONFIG_DEBUG_EXT_COPY_REMAP
obj-m := scst_cdrom.o scst_changer.o scst_disk.o scst_modisk.o scst_tape.o \
scst_vdisk.o scst_raid.o scst_processor.o scst_user.o
else
######### BEGIN OUT-OF-TREE RULES #########
ifeq ($(KVER),)
ifeq ($(KDIR),)
KVER := $(shell uname -r)
@@ -77,9 +64,6 @@ install: all
uninstall:
rm -f $(INSTALL_DIR)/dev_handlers/scst_*.ko
########## END OUT-OF-TREE RULES ##########
endif
clean:
$(MAKE) -C $(KDIR) M=$(shell pwd) $@
+6
View File
@@ -0,0 +1,6 @@
KBUILD_EXTRA_SYMBOLS=$(src)/../scst/src/Module.symvers
ccflags-y += -I$(src)/../scst/include
ccflags-y += $(call cc-option,-Wextra) -Wno-unused-parameter\
-Wno-missing-field-initializers
obj-m := scst_local.o
-13
View File
@@ -6,16 +6,6 @@ SHELL=/bin/bash
KMOD := $(shell pwd)/kernel
ifneq ($(PATCHLEVEL),)
KBUILD_EXTRA_SYMBOLS=$(src)/../scst/src/Module.symvers
ccflags-y += -I$(src)/../scst/include
ccflags-y += $(call cc-option,-Wextra) -Wno-unused-parameter\
-Wno-missing-field-initializers
obj-m := scst_local.o
else
######### BEGIN OUT-OF-TREE RULES #########
ifndef PREFIX
PREFIX=/usr/local
endif
@@ -54,9 +44,6 @@ uninstall:
rm -f $(INSTALL_DIR)/scst_local.ko
-/sbin/depmod -b $(INSTALL_MOD_PATH)/ -a $(KVER)
########## END OUT-OF-TREE RULES ##########
endif
clean:
$(MAKE) -C $(KDIR) M=$(shell pwd) $@