?? makefile
字號:
## Makefile for the Linux kernel device drivers.## Note! Dependencies are done automagically 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).## Note 2! The CFLAGS definitions are now in the main makefile.#export KSRC := /usr/src/linuxSUBDIRS := $(shell pwd)ifeq ($(KSRC),) KSRC ?= /lib/modules/$(shell uname -r)/buildendififneq ($(wildcard $(KSRC)/include/linux/utsrelease.h),) VERSION_FILE := $(KSRC)/include/linux/utsrelease.helse VERSION_FILE := $(KSRC)/include/linux/version.hendifKVER := $(shell $(CC) $(CFLAGS) -E -dM $(VERSION_FILE) | \ grep UTS_RELEASE | awk '{ print $$3 }' | sed 's/\"//g')KMOD := /lib/modules/$(KVER)/kernelKMAJ := $(shell echo $(KVER) | \ sed -e 's/^\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*.*/\1/')KMIN := $(shell echo $(KVER) | \ sed -e 's/^[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*.*/\1/')KREV := $(shell echo $(KVER) | \ sed -e 's/^[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*/\1/')kver_eq = $(shell [ $(KMAJ)$(KMIN)$(KREV) -eq $(1)$(2)$(3) ] && \ echo 1 || echo 0)kver_lt = $(shell [ $(KMAJ)$(KMIN)$(KREV) -lt $(1)$(2)$(3) ] && \ echo 1 || echo 0)kver_le = $(shell [ $(KMAJ)$(KMIN)$(KREV) -le $(1)$(2)$(3) ] && \ echo 1 || echo 0)kver_gt = $(shell [ $(KMAJ)$(KMIN)$(KREV) -gt $(1)$(2)$(3) ] && \ echo 1 || echo 0)kver_ge = $(shell [ $(KMAJ)$(KMIN)$(KREV) -ge $(1)$(2)$(3) ] && \ echo 1 || echo 0)kver_lk = $(shell [ `echo $(KVER) | egrep $(1)` ] && echo 1 || echo 0)## Please when adding patch sets start with the latest to the earliest# the idea behind this is that by properly patching the latest code# base first the earlier patch sets will not need to be modified.## Compatibility patch for kernels >= 2.6.22 and <= 2.6.23ifeq ($(call kver_le,2,6,23),1) PATCHES := $(PATCHES) compat-2.6.22-2.6.23.patchendif# Compatibility patch for kernels >= 2.6.19 and <= 2.6.21ifeq ($(call kver_le,2,6,21),1) PATCHES := $(PATCHES) compat-2.6.19-2.6.21.patchendif# Compatibility patch for kernels >= 2.6.14 and <= 2.6.18ifeq ($(call kver_le,2,6,18),1) PATCHES := $(PATCHES) compat-2.6.14-2.6.18.patchendif# We don't support kernels < 2.6.14 except for explicit distrosifeq ($(call kver_lt,2,6,14),1) UNSUPPORTED := trueendif# Compatibility patch for RHEL4/CentOS4ifeq ($(call kver_lk,"2\.6\.9-.*\.(EL|plus\.c4)"),1) PATCHES += compat-rhel4.patch UNSUPPORTED :=endifMANPAGES:= ietadm.8 ietd.8 ietd.conf.5ifeq ($(MANDIR),) MANPATH := $(shell (manpath 2>/dev/null || \ echo $MANPATH) | sed 's/:/ /g') ifneq ($(MANPATH),) test_dir = $(findstring $(dir), $(MANPATH)) else test_dir = $(shell [ -e $(dir) ] && echo $(dir)) endif MANDIR := /usr/share/man /usr/man MANDIR := $(foreach dir, $(MANDIR), $(test_dir)) MANDIR := $(firstword $(MANDIR))endififeq ($(MANDIR),) MANDIR := /usr/share/manendifDOCS:= ChangeLog COPYING README README.vmwareifeq ($(DOCDIR),) DOCDIR := /usr/share/doc/iscsitargetendifall: usr kernelusr: patch $(MAKE) -C usrkernel: patch $(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd)/kernel modulespatch: $(UNSUPPORTED) integ_check $(PATCHES)$(UNSUPPORTED): @echo "Sorry, your kernel version and/or distribution is currently" @echo "not supported." @echo "" @echo "Please read the README file for information on how you can" @echo "contribute compatibility/bug fixes to the IET project." @exit 1integ_check: @if [ -e .patched.* -a ! -e .patched.$(KVER) ]; then \ $(MAKE) unpatch; \ fi$(PATCHES): .patched.$(KVER).patched.$(KVER): @set -e; \ if [ ! -e .patched.* ]; then \ for p in $(PATCHES); do \ echo "Applying Patch $$p"; \ patch -p0 < patches/$$p; \ echo $$p >>.patched.$(KVER); \ done; \ fiunpatch: @set -e; \ if [ -e .patched.* ]; then \ for p in `cat .patched.*`; do \ reverse="$$p $$reverse"; \ done; \ for r in $$reverse; do \ echo "Reversing patch $$r"; \ patch -p0 -R < patches/$$r; \ done; \ rm -f .patched.*; \ fidepmod: @echo "Running depmod" @if [ x$(DISTDIR) != x -o x$(INSTALL_MOD_PATH) != x ]; then \ depmod -aq -b $(DISTDIR)$(INSTALL_MOD_PATH) $(KVER); \ else \ depmod -aq $(KVER); \ fiinstall: install-usr install-etc install-doc install-kernel depmodinstall-kernel: kernel/iscsi_trgt.ko @install -vD kernel/iscsi_trgt.ko \ $(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.koinstall-usr: usr/ietd usr/ietadm @install -vD usr/ietd $(DISTDIR)/usr/sbin/ietd @install -vD usr/ietadm $(DISTDIR)/usr/sbin/ietadminstall-etc: install-initd @if [ ! -e $(DISTDIR)/etc/ietd.conf ]; then \ install -vD -m 644 etc/ietd.conf \ $(DISTDIR)/etc/ietd.conf; \ fi @if [ ! -e $(DISTDIR)/etc/initiators.allow ]; then \ install -vD -m 644 etc/initiators.allow \ $(DISTDIR)/etc/initiators.allow; \ fi @if [ ! -e $(DISTDIR)/etc/initiators.deny ]; then \ install -vD -m 644 etc/initiators.deny \ $(DISTDIR)/etc/initiators.deny; \ fiinstall-initd: @if [ -f /etc/debian_version ]; then \ install -vD -m 755 etc/initd/initd.debian \ $(DISTDIR)/etc/init.d/iscsi-target; \ elif [ -f /etc/redhat-release ]; then \ install -vD -m 755 etc/initd/initd.redhat \ $(DISTDIR)/etc/init.d/iscsi-target; \ elif [ -f /etc/gentoo-release ]; then \ install -vD -m 755 etc/initd/initd.gentoo \ $(DISTDIR)/etc/init.d/iscsi-target; \ elif [ -f /etc/slackware-version ]; then \ install -vD -m 755 etc/initd/initd \ $(DISTDIR)/etc/rc.d/iscsi-target; \ else \ install -vD -m 755 etc/initd/initd \ $(DISTDIR)/etc/init.d/iscsi-target; \ fiinstall-doc: install-man @ok=true; for f in $(DOCS) ; \ do [ -e $$f ] || \ { echo $$f missing ; ok=false; } ; \ done ; $$ok @set -e; for f in $(DOCS) ; do \ install -v -D -m 644 $$f \ $(DISTDIR)$(DOCDIR)/$$f ; \ doneinstall-man: @ok=true; for f in $(MANPAGES) ; \ do [ -e doc/manpages/$$f ] || \ { echo doc/manpages/$$f missing ; ok=false; } ; \ done ; $$ok @set -e; for f in $(MANPAGES) ; do \ s=$${f##*.}; \ install -v -D -m 644 doc/manpages/$$f \ $(DISTDIR)$(MANDIR)/man$$s/$$f ; \ doneuninstall: uninstall-kernel depmod uninstall-usr uninstall-etc uninstall-docuninstall-kernel: rm -f $(DISTDIR)$(INSTALL_MOD_PATH)$(KMOD)/iscsi/iscsi_trgt.kouninstall-usr: @rm -f $(DISTDIR)/usr/sbin/ietd @rm -f $(DISTDIR)/usr/sbin/ietadmuninstall-etc: uninstall-initduninstall-initd: if [ -f /etc/debian_version ]; then \ rm -f $(DISTDIR)/etc/init.d/iscsi-target; \ elif [ -f /etc/redhat-release ]; then \ rm -f $(DISTDIR)/etc/init.d/iscsi-target; \ elif [ -f /etc/gentoo-release ]; then \ rm -f $(DISTDIR)/etc/init.d/iscsi-target; \ elif [ -f /etc/slackware-version ]; then \ rm -f $(DISTDIR)/etc/rc.d/iscsi-target; \ else \ rm -f $(DISTDIR)/etc/init.d/iscsi-target; \ fiuninstall-doc: uninstall-man rm -rf $(DISTDIR)$(DOCDIR)uninstall-man: set -e; for f in $(MANPAGES) ; do \ s=$${f##*.}; \ rm -f $(DISTDIR)$(MANDIR)/man$$s/$$f ; \ doneclean: $(MAKE) -C usr clean $(MAKE) -C $(KSRC) SUBDIRS=$(shell pwd)/kernel cleandistclean: unpatch clean find . -name \*.orig -exec rm -f \{\} \; find . -name \*.rej -exec rm -f \{\} \; find . -name \*~ -exec rm -f \{\} \; find . -name Module.symvers -exec rm -f \{\} \;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -