open-iscsi: add transport cxgb4i
[open-iscsi.git] / usr / Makefile
blobb02a706cc9eb8da68b6576dcb834fb8db5d93bbb
1 # This Makefile will work only with GNU make.
3 OSNAME=$(shell uname -s)
5 # allow users to override these
6 # eg to compile for a kernel that you aren't currently running
7 KERNELRELEASE ?= $(shell uname -r)
8 KSRC ?= /lib/modules/$(KERNELRELEASE)/build
10 KSUBLEVEL=$(shell cat $(KSRC)/Makefile | awk -F= '/^SUBLEVEL =/ {print $$2}' | \
11 sed 's/^[ \t]*//;s/[ \t]*$$//')
13 ifeq ($(OSNAME),Linux)
14 ifeq ($(KSUBLEVEL),11)
15 IPC_CFLAGS=-DNETLINK_ISCSI=12 -D_GNU_SOURCE
16 else
17 ifeq ($(KSUBLEVEL),12)
18 IPC_CFLAGS=-DNETLINK_ISCSI=12 -D_GNU_SOURCE
19 else
20 IPC_CFLAGS=-DNETLINK_ISCSI=8 -D_GNU_SOURCE
21 endif
22 endif
23 IPC_OBJ=netlink.o
24 else
25 ifeq ($(OSNAME),FreeBSD)
26 IPC_CFLAGS=
27 IPC_OBJ=ioctl.o
28 endif
29 endif
31 OPTFLAGS ?= -O2 -g
32 WARNFLAGS ?= -Wall -Wstrict-prototypes
33 CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -I../include -I. -I../utils/open-isns \
34 -D$(OSNAME) $(IPC_CFLAGS)
35 PROGRAMS = iscsid iscsiadm iscsistart
37 # libc compat files
38 SYSDEPS_SRCS = $(wildcard ../utils/sysdeps/*.o)
39 # sources shared between iscsid, iscsiadm and iscsistart
40 ISCSI_LIB_SRCS = iscsi_util.o io.o auth.o login.o log.o md5.o sha1.o iface.o \
41 idbm.o sysfs.o host.o session_info.o iscsi_sysfs.o iscsi_net_util.o \
42 iscsid_req.o $(SYSDEPS_SRCS)
43 # core initiator files
44 INITIATOR_SRCS = initiator.o scsi.o actor.o event_poll.o mgmt_ipc.o \
45 transport.o cxgbi.o be2iscsi.o
46 # fw boot files
47 FW_BOOT_SRCS = $(wildcard ../utils/fwparam_ibft/*.o)
49 # core discovery files
50 DISCOVERY_SRCS = $(FW_BOOT_SRCS) strings.o discovery.o
52 all: $(PROGRAMS)
54 iscsid: $(ISCSI_LIB_SRCS) $(IPC_OBJ) $(INITIATOR_SRCS) $(DISCOVERY_SRCS) \
55 iscsid.o session_mgmt.o discoveryd.o
56 $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto
58 iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o
59 $(CC) $(CFLAGS) $^ -o $@ -L../utils/open-isns -lisns -lcrypto
61 iscsistart: $(IPC_OBJ) $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
62 iscsistart.o statics.o
63 $(CC) $(CFLAGS) -static $^ -o $@
64 clean:
65 rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
67 depend:
68 gcc $(CFLAGS) -M `ls *.c` > .depend
70 -include .depend