📄 makefile
字号:
COMMON_DIR:=commonDRIVER_DIR:=KDIR:=/lib/modules/$(shell uname -r)/buildpwd:=$(PWD)ifneq ($(KERNELRELEASE),)obj-m := iscsi_sfnet.oiscsi_sfnet-objs := $(DRIVER_DIR)/iscsi-initiator.o iscsi_sfnet-objs += $(DRIVER_DIR)/iscsi-attr.o \ $(DRIVER_DIR)/iscsi-session.o \ $(DRIVER_DIR)/iscsi-task.o \ $(DRIVER_DIR)/iscsi-portal.o \ $(DRIVER_DIR)/iscsi-ioctl.o \ $(DRIVER_DIR)/iscsi-network.o \ $(DRIVER_DIR)/iscsi-recv-pdu.o \ $(DRIVER_DIR)/iscsi-xmit-pdu.o \ $(DRIVER_DIR)/iscsi-auth.o \ $(COMMON_DIR)/login/iscsi-login.o \ $(COMMON_DIR)/auth/iscsi-auth-client.oobj-m += scsi_transport_iscsi.oISCSI_MODFLAGS :=ISCSI_MODFLAGS += -Werror -I$(pwd)/driver/include -I$(pwd)/common/include -I$(pwd)/common/auth -I$(pwd)/common/login -I$(pwd)/includeifeq ($(CONFIG_SCSI_DEBUG),y)ISCSI_MODFLAGS += -DDEBUG=1endifEXTRA_CFLAGS += $(ISCSI_MODFLAGS)endif ## THE KERNEL MAKEFILE ENDS HERE!!!# record the version of the running kernelKERNEL_VPSE:=$(shell uname -r)# Try to find the top of the Linux kernel source tree for the running kernelifeq ($(TOPDIR),) ifeq ($(wildcard /lib/modules/$(KERNEL_VPSE)/build/.),/lib/modules/$(KERNEL_VPSE)/build/.) TOPDIR:=/lib/modules/$(KERNEL_VPSE)/build endif ifeq ($(TOPDIR),) $(warning Linux kernel source must be installed to compile this code.) $(error Could not find the top of the linux kernel source tree.) endifendif# record the kernel source versionKERNEL_VERSION:=$(shell awk -F"[ \t]*=[ \t]*" '$$1 == "VERSION" { print $$2 }' $(TOPDIR)/Makefile | sed -e 's/[ \t\n]*//g')KERNEL_PATCHLEVEL:=$(shell awk -F"[ \t]*=[ \t]*" '$$1 == "PATCHLEVEL" {print $$2}' $(TOPDIR)/Makefile | sed -e 's/[ \t\n]*//g')KERNEL_SUBLEVEL:=$(shell awk -F"[ \t]*=[ \t]*" '$$1 == "SUBLEVEL" {print $$2 }' $(TOPDIR)/Makefile | sed -e 's/[ \t\n]*//g')KERNEL_EXTRAVERSION:=$(shell awk -F"[ \t]*=[ \t]*" '$$1 == "EXTRAVERSION" {print $$2 }' $(TOPDIR)/Makefile | sed -e 's/[ \t\n]*//g')KERNEL_SRC_VPSE:=$(KERNEL_VERSION).$(KERNEL_PATCHLEVEL).$(KERNEL_SUBLEVEL)$(KERNEL_EXTRAVERSION)ifeq ($(wildcard $(TOPDIR)/.config),$(TOPDIR)/.config) KERNEL_CONFIG:=$(TOPDIR)/.configendifcheckkernel: @printf "\nNote: using kernel source from $(TOPDIR)\ncontaining kernel version $(KERNEL_SRC_VPSE)\n\n" | fmt - @if [ "$(KERNEL_CONFIG)" ] ; then \ printf "Note: using kernel config from $(KERNEL_CONFIG)\n\n" | fmt - ; \ else \ ( printf "Warning: failed to find a kernel config file for $(KERNEL_SRC_VPSE).\n" ; \ printf "The iSCSI kernel module may fail to load or run properly.\n\n"; ) | fmt - ; \ fi @if [ "$(KERNEL_VERSION).$(KERNEL_PATCHLEVEL)" = "2.4" ] ; then \ ( printf "\nError: this iSCSI driver does not support 2.4 kernels.\n" ; \ printf "You must upgrade your kernel to 2.6 or later\n" ; \ printf "in order to use this driver.\n\n" ; ) | fmt - ; \ exit 1; \ fi @if [ "$(KERNEL_SRC_VPSE)" != "$(KERNEL_VPSE)" ] ; then\ ( echo "Warning: $(TOPDIR) contains kernel version $(KERNEL_SRC_VPSE)," ; \ echo "but kernel version $(KERNEL_VPSE) is currently running.";\ echo "This mismatch may prevent the iSCSI module from loading onthe"; \ echo "running kernel due to unresolved symbols, or may cause problems" ; \ echo "during the operation of the iSCSI driver. The iSCSI driver will" ; \ echo "be built for kernel version $(KERNEL_SRC_VPSE)." ; \ echo "If you wish to build the iSCSI driver for the kernel that is" ; \ echo "currently running, you must install the appropriate kernelsource"; \ echo "and rebuild the iSCSI driver."; \ echo ; ) | fmt - ; \all:: module module: checkkernel $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -