summaryrefslogtreecommitdiff
path: root/kernel/Makefile
blob: baa04b16607755e8173346df7b10246208fa681d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#
# Makefile for the Linux Kernel iSCSI Initiator
#

EXTRA_CFLAGS += -I$(obj) -I$(obj)/../include 

obj-m				+= scsi_transport_iscsi.o
obj-m				+= iscsi_tcp.o 

KSRC ?= /lib/modules/`uname -r`/build

KVER = $(shell cat $(KSRC)/Makefile | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
		sed 's/^[ \t]*//;s/[ \t]*$$//')

ifeq ($(KVER), 11)
EXTRA_CFLAGS += -DNETLINK_ISCSI=12
else
ifeq ($(KVER), 12)
EXTRA_CFLAGS += -DNETLINK_ISCSI=12
endif
endif

#TODO: learn how to program Makefiles!
all:
ifeq ($(KVER),11)
	@if ! cat scsi_transport_iscsi.c | \
	    grep iscsi_compat > /dev/null; then  \
	    echo "kernel check... FAILED"; \
	    echo "Apply the 2.6.11-compat.patch first!"; exit 1; fi
	@echo "kernel check... OK"
else
ifeq ($(KVER),12)
	@if ! cat scsi_transport_iscsi.c | \
	    grep iscsi_compat > /dev/null; then  \
	    echo "kernel check... FAILED"; \
	    echo "Apply the 2.6.12-compat.patch first!"; exit 1; fi
	@echo "kernel check... OK"
else
ifeq ($(KVER),13)
	@if ! cat scsi_transport_iscsi.c | \
	    grep iscsi_compat > /dev/null; then  \
	    echo "kernel check... FAILED"; \
	    echo "Apply the 2.6.13-compat.patch first!"; exit 1; fi
	@echo "kernel check... OK"
else
ifeq ($(KVER),14)
	@if ! cat scsi_transport_iscsi.c | \
	    grep iscsi_compat > /dev/null; then  \
	    echo "kernel check... FAILED"; \
	    echo "Apply the 2.6.14-and-2.6.15-compat.patch first!"; exit 1; fi
	@echo "kernel check... OK"
else
ifeq ($(KVER),15)
	@if ! cat scsi_transport_iscsi.c | \
	    grep iscsi_compat > /dev/null; then  \
	    echo "kernel check... FAILED"; \
	    echo "Apply the 2.6.14-and-2.6.15-compat.patch first!"; exit 1; fi
	@echo "kernel check... OK"
else
	@echo "kernel check... OK"
endif
endif
endif
endif
endif
	make -C $(KSRC) SUBDIRS=`pwd` $(KARCH)

clean:
	rm -f -r *.mod.c .*cmd *.o *.ko .tmp_versions