⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefile

📁 ISCSI user client software.Client would be used to access the IPSAN server.
💻
字号:
# Makefile for the Linux iSCSI driver# Copyright (C) 2001 Cisco Systems, Inc.# maintained by linux-iscsi-devel@lists.sourceforge.net## 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; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful, but# WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU# General Public License for more details.## See the file COPYING included with this distribution for more details.# for compiling the daemon and utilsOS:=$(shell uname)ARCH:=$(shell uname -m)DRIVER_DIR:=driverDAEMON_DIR:=daemonCOMMON_DIR:=commonMISC_DIR:=miscMAN_DIR:=manUTILS_DIR:=utilsINCLUDE_DIR:=includeDISCOVERY_DIR:=$(DAEMON_DIR)/discoveryLOGIN_DIR:=$(COMMON_DIR)/loginAUTH_DIR:=$(COMMON_DIR)/authSCRIPT_DIR:=$(MISC_DIR)/scriptsISCSI_BOOT_DIR:=$(UTILS_DIR)/iscsi-boot# Where to install files that must be relative to the root dir.# This is a prefix prepended before the pathname, and is# normally unset.  It would be set for such things as diskless# clients, where the driver is being installed on the server# for a client.ROOT:=export ROOT# Where to install the relocatable files (daemon, utilities, and man pages)BASEDIR:=/export BASEDIR# We need to have the kernel headers installed in order to compile.# You can specify a TOPDIR for your Linux kernel here, or if you don't# we'll look for it in a few likely places later.TOPDIR:=# We also need the pathname of the kernel .config file to use.# You can specify a .config for your Linux kernel here, or if you don't# we'll look for it in a few likely places later.KERNEL_CONFIG:=# The rest of this Makefile shouldn't need to be modified# 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)# Try to find the kernel's config if the user didn't tell us where to find it.# People who compile their own kernels will have a .config, as will some# distributions that only ship one kernel binary, or that use separate# kernel source for each kernel binary.  Redhat uses the same kernel source# for multiple kernel binaries.# the standard config file location is $(TOPDIR)/.configifeq ($(wildcard $(TOPDIR)/.config),$(TOPDIR)/.config)  KERNEL_CONFIG:=$(TOPDIR)/.configendif# for compiling the daemon and utils CC:=gccINCLUDE:= -I$(PWD)/include  -I$(PWD)/$(LOGIN_DIR) -I$(PWD)/$(AUTH_DIR) -I$(PWD)/$(DISCOVERY_DIR) -I$(PWD)/$(DAEMON_DIR)/include -I$(PWD)/$(MISC_DIR)/includeOPTFLAGS = -O2CFLAGS:= -Wall -Wstrict-prototypes $(OPTFLAGS) $(INCLUDE)LDFLAGS:= -Wl,--rpath -Wl,/usr/local/lib# assume object dirs should go under the current directory, unless told# otherwiseOBJ:=$(CURDIR)ifdef DEBUGOBJDIR:=$(OBJ)/$(OS)-$(ARCH)/dbg-objCFLAGS += -g -DDEBUGLDFLAGS += -gelseOBJDIR:=$(OBJ)/$(OS)-$(ARCH)/objCFLAGS += -fomit-frame-pointerendif.PHONY: all daemon utils user permissions clean \         install remove uninstall dirs# default targetall:: dirs daemon utils permissions checkkernel checkscsi checkcryptodaemon:  dirs $(OBJDIR)/iscsidutils: dirs $(OBJDIR)/$(UTILS_DIR)/iscsi-device $(OBJDIR)/$(UTILS_DIR)/iscsi-iname $(OBJDIR)/$(UTILS_DIR)/iscsi-boot/init# distributors usually want these targets when building packagesuser: dirs daemon utils permissionsexport OBJDIR.SUFFIXES:DRIVER_FILES:=	$(DRIVER_DIR)/iscsi-initiator.cDRIVER_FILES+=	$(DRIVER_DIR)/iscsi-attr.c \	      	$(DRIVER_DIR)/iscsi-ioctl.c \	      	$(DRIVER_DIR)/iscsi-network.c \	      	$(DRIVER_DIR)/iscsi-portal.c \	      	$(DRIVER_DIR)/iscsi-recv-pdu.c \	      	$(DRIVER_DIR)/iscsi-xmit-pdu.c \	      	$(DRIVER_DIR)/iscsi-session.c \	      	$(DRIVER_DIR)/iscsi-task.c \	      	$(DRIVER_DIR)/iscsi-auth.c \	      	$(DRIVER_DIR)/Makefile \	      	$(DRIVER_DIR)/include/iscsi-sfnet.h \	      	$(DRIVER_DIR)/include/iscsi-session.h \	      	$(DRIVER_DIR)/include/iscsi-task.h \TRANSPORT_FILES:= $(DRIVER_DIR)/scsi_transport_iscsi.c TRANSPORT_HEADER:=  $(DRIVER_DIR)/include/scsi_transport_iscsi.h \DAEMON_FILES:=	$(DAEMON_DIR)/iscsi-config.cDAEMON_FILES+=	$(DAEMON_DIR)/iscsid.c \	      	$(DISCOVERY_DIR)/iscsi-discovery.c \	      	$(DAEMON_DIR)/iscsi-io.c \	      	$(DAEMON_DIR)/iscsi-linux.c \	      	$(DAEMON_DIR)/iscsi-auth.c \MAN_FILES:=	$(MAN_DIR)/iscsi.conf.5MAN_FILES+=	$(MAN_DIR)/iscsid.8 \		$(MAN_DIR)/iscsi-ls.1SCRIPT_FILES:=	$(SCRIPT_DIR)/install.shSCRIPT_FILES+=	$(SCRIPT_DIR)/iscsi-mountall \		$(SCRIPT_DIR)/iscsi-umountall \		$(SCRIPT_DIR)/iscsi-rename \		$(SCRIPT_DIR)/remove.sh \		$(UTILS_DIR)/iscsi-boot/mkinitrd.iscsi \		$(SCRIPT_DIR)/rc.iscsi \		$(SCRIPT_DIR)/iscsi-lsUTILS_FILES:=	$(ISCSI_BOOT_DIR)/init.cUTILS_FILES+=	$(UTILS_DIR)/iscsi-device.c \		$(UTILS_DIR)/iscsi-iname.c \		$(ISCSI_BOOT_DIR)/iscsi-network-boot.c \		$(ISCSI_BOOT_DIR)/iscsi-network-boot.hDAEMON_SRCS:=	$(LOGIN_DIR)/iscsi-login.c $(DAEMON_FILES) \		$(MISC_DIR)/string-buffer.c \		$(MISC_DIR)/md5.c \		$(AUTH_DIR)/iscsi-auth-client.cDAEMON_FILES+= $(DISCOVERY_DIR)/iscsi-slp-discovery.c#Install openslp release 1.1.4 and onwards on the system and uncomment the follo#wing line to enable SLP discovery for iSCSI.#ENABLE_SLP:= 1ifeq ($(ENABLE_SLP),1)CFLAGS+=-DSLP_ENABLE=1LDFLAGS+=-lslpDAEMON_SRCS += $(DISCOVERY_DIR)/iscsi-slp-discovery.cendifUTIL_SRCS:=$(MISC_DIR)/md5.c $(UTILS_FILES)UTIL_OBJS:=$(UTIL_SRCS:%.c=$(OBJDIR)/$(UTILS_DIR)/%.o)DAEMON_OBJS:=$(DAEMON_SRCS:%.c=$(OBJDIR)/%.o) # Make all objects depend on the Makefile$(DAEMON_OBJS): Makefile $(UTIL_OBJS): Makefileinstall: daemon utils	@./$(SCRIPT_DIR)/install.shremove uninstall:	@./$(SCRIPT_DIR)/remove.sh# warn the user if the running kernel version# doesn't match the $TOPDIR/Makefile versioncheckkernel:	@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 " ; \                echo "$(KERNEL_SRC_VPSE), but kernel version $(KERNEL_VPSE) ";\                echo "is currently running. This mismatch may prevent the " ; \                echo "iSCSI module from loading on the running kernel due " ; \                echo "to unresolved symbols, or may cause problems during " ; \		echo "the operation of the iSCSI driver. The iSCSI driver " ; \                echo "will be built for kernel version $(KERNEL_SRC_VPSE). "; \                echo "If you wish to build the iSCSI driver for the kernel "; \                echo "that is currently running, you must install the "; \                echo "appropriate kernel source and rebuild the iSCSI " ; \                echo "driver."; ) | fmt - ; \        fi;# Error out if there is no scsi support in the kernelcheckscsi:	@if [ -n "$(KERNEL_CONFIG)" ] ; then \	SCSI=`grep 'CONFIG_SCSI=' $(KERNEL_CONFIG)|awk -F'=' '{print $$2}'`; \	if [ "$$SCSI" != "y" -a "$$SCSI" != "m" -a "$$SCSI" != "unknown" ] ; then \		echo ; \		echo "Error: your kernel does not appear to support SCSI." ; \		echo "For iSCSI to function, you must rebuild your kernel " ; \		echo "with either SCSI support compiled into the kernel, " ; \		echo "or with SCSI support as a module." ; \		echo ; \		exit 1;\	fi \	ficheckcrypto:	@if [ -n "$(KERNEL_CONFIG)" ] ; then \	CRYPTO=`grep 'CONFIG_CRYPTO=' $(KERNEL_CONFIG)|awk -F'=' '{print $$2}'`; \	MD5=`grep 'CONFIG_CRYPTO_MD5=' $(KERNEL_CONFIG)|awk -F'=' '{print $$2}'` ; \	CRC32C=`grep 'CONFIG_CRYPTO_CRC32C=' $(KERNEL_CONFIG)|awk -F'=' '{print $$2}'` ; \	if [ "$$CRYPTO" != "y" -a "$$CRYPTO" != "unknown" ]; then \		echo ; \		echo "Error: your kernel does not appear to support CRYPTO" ; \		echo "API. For iSCSI to function, you must rebuild your " ; \		echo "kernel with CRYPTO API support compiled into the " ; \		echo "kernel." ; \		exit 1;\	elif [ "$$MD5" != "y" -a "$$MD5" != "m" -a "$$MD5" != "unknown" ]; then \		echo; \		echo "Error: your kernel does not appear to support MD5." ; \		echo "For iSCSI to function, you must rebuild your kernel " ; \		echo "with MD5 support compiled into the kernel." ; \		echo ; \		exit 1;\	elif [ "$$CRC32C" != "y" -a "$$CRC32C" != "m" -a "$$CRC32C" != "unknown" ];then \		echo; \		echo "Warning:your kernel does not appear to support CRC." ;\		echo "You will not be able to enable Header and Data Digest" ;\		echo "features of iSCSI driver";\		echo ;\	fi \	fi# compile daemon/utility code and auto-generate dependencies (and make missing prereqs cause a rebuild,# not an error)$(OBJDIR)/%.o : %.c	$(CC) $(CFLAGS) -MMD -c -o $(OBJDIR)/$*.o $*.c	@if [ ! -f $(OBJDIR)/$*.d -a -f $*.d ] ; then \		printf "$(OBJDIR)/" > $(OBJDIR)/$*.d ; \		cat $*.d >> $(OBJDIR)/$*.d && rm -f $*.d ; \	fi	@cp -f $(OBJDIR)/$*.d $(OBJDIR)/$*.dep	@sed -e 's/#.*//' -e 's/^.*: *//' -e 's/ *\\$$//' -e 's/^ *//' -e '/^$$/ d' -e 's/$$/:/' < $(OBJDIR)/$*.d >> $(OBJDIR)/$*.dep$(OBJDIR)/iscsid: $(DAEMON_OBJS)	$(CC) $(LDFLAGS)  $(DAEMONFLAGS) -o $@ $^ -lsysfs#statically linked version$(OBJDIR)/iscsid-static: $(DAEMON_OBJS)	$(CC) -static $(LDFLAGS)  $(DAEMONFLAGS) -o $@ $^ -lsysfs# includes TOPDIR/include/scsi/scsi_ioctl.h$(OBJDIR)/$(UTILS_DIR)/iscsi-device: $(UTILS_DIR)/iscsi-device.c Makefile	$(CC) $(CFLAGS) -I$(TOPDIR)/include -o $@ $<# Link the iscsi-iname utility$(OBJDIR)/$(UTILS_DIR)/iscsi-iname: $(OBJDIR)/$(UTILS_DIR)/iscsi-iname.o $(OBJDIR)/$(MISC_DIR)/md5.o	$(CC) $(CFLAGS) -o $@ $^# Make the init utility. This needs to be statically compiled for initrd.$(OBJDIR)/$(UTILS_DIR)/iscsi-boot/init: $(OBJDIR)/$(UTILS_DIR)/iscsi-boot/init.o $(OBJDIR)/$(UTILS_DIR)/iscsi-boot/iscsi-network-boot.o	$(CC) $(CFLAGS) -static -o $@ $^dirs:	@mkdir -p $(OBJDIR)	@mkdir -p $(OBJDIR)/$(DAEMON_DIR)	@mkdir -p $(OBJDIR)/$(DISCOVERY_DIR)	@mkdir -p $(OBJDIR)/$(UTILS_DIR)	@mkdir -p $(OBJDIR)/$(UTILS_DIR)/iscsi-boot	@mkdir -p $(OBJDIR)/$(COMMON_DIR)	@mkdir -p $(OBJDIR)/$(AUTH_DIR)	@mkdir -p $(OBJDIR)/$(LOGIN_DIR)	@mkdir -p $(OBJDIR)/$(MISC_DIR)permissions:	@chmod 744 $(SCRIPT_DIR)/rc.iscsi	@chmod 744 $(UTILS_DIR)/iscsi-boot/mkinitrd.iscsi	@chmod 744 $(SCRIPT_DIR)/install.sh	@chmod 744 $(SCRIPT_DIR)/remove.sh	@chmod 744 $(SCRIPT_DIR)/iscsi-mountall	@chmod 744 $(SCRIPT_DIR)/iscsi-umountall	@chmod 744 $(SCRIPT_DIR)/iscsi-lsclean:	rm -rf $(OBJDIR) *.o $(DRIVER_DIR)/*.ko $(DRIVER_DIR)/.*.cmd $(DRIVER_DIR)/*.mod.c $(DRIVER_DIR)/*.o $(DRIVER_DIR)/.tmp_versions $(COMMON_DIR)/*.o $(AUTH_DIR)/*.o $(AUTH_DIR)/.*.cmd $(LOGIN_DIR)/*.o $(LOGIN_DIR)/.*.cmd $(AUTH_DIR)/*.mod.c $(COMMON_DIR)/*.mod.c

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -