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
17 ifeq ($(KSUBLEVEL
),12)
18 IPC_CFLAGS
=-DNETLINK_ISCSI
=12 -D_GNU_SOURCE
20 IPC_CFLAGS
=-DNETLINK_ISCSI
=8 -D_GNU_SOURCE
25 ifeq ($(OSNAME
),FreeBSD
)
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
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
47 FW_BOOT_SRCS
= $(wildcard ..
/utils
/fwparam_ibft
/*.o
)
49 # core discovery files
50 DISCOVERY_SRCS
= $(FW_BOOT_SRCS
) strings.o discovery.o
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
$@
65 rm -f
*.o
$(PROGRAMS
) .depend
$(LIBSYS
)
68 gcc
$(CFLAGS
) -M
`ls *.c` > .depend