Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (58 sloc) 2.1 KB
prefix = $(DESTDIR)
ifeq ($(prefix),)
prefix = @prefix@
endif
exec_prefix = @exec_prefix@
libdir = $(LIBDIR)
ifeq ($(libdir),)
libdir = @libdir@
endif
bindir = @bindir@
LIBS=-lpopt @LIBS@
CC=gcc
CFLAGS=-g -O2 -fPIC -Wall -W -I. -I./include "-D_U_=__attribute__((unused))"
LIBISCSI_OBJ = lib/connect.o lib/crc32c.o lib/discovery.o lib/init.o lib/login.o lib/md5.o lib/nop.o lib/pdu.o lib/scsi-command.o lib/scsi-lowlevel.o lib/socket.o lib/sync.o lib/task_mgmt.o
INSTALLCMD = @install@ -c
LIBISCSI_SO_NAME=libiscsi.so.1
VERSION=1.0.0
LIBISCSI_SO=libiscsi.so.$(VERSION)
all: bin/iscsi-inq bin/iscsi-ls lib/$(LIBISCSI_SO) bin/ld_iscsi.so
bin/ld_iscsi.so: src/ld_iscsi.o lib/libiscsi.a
mkdir -p bin
ld -shared -o $@ src/ld_iscsi.o lib/libiscsi.a -ldl
bin/iscsi-ls: src/iscsi-ls.c lib/libiscsi.a
mkdir -p bin
$(CC) $(CFLAGS) -o $@ src/iscsi-ls.c lib/libiscsi.a $(LIBS)
bin/iscsi-inq: src/iscsi-inq.c lib/libiscsi.a
mkdir -p bin
$(CC) $(CFLAGS) -o $@ src/iscsi-inq.c lib/libiscsi.a $(LIBS)
lib/$(LIBISCSI_SO): $(LIBISCSI_OBJ)
@echo Creating shared library $@
$(CC) -shared -Wl,-soname=$(LIBISCSI_SO_NAME) -o $@ $(LIBISCSI_OBJ)
lib/libiscsi.a: $(LIBISCSI_OBJ)
@echo Creating library $@
ar r lib/libiscsi.a $(LIBISCSI_OBJ)
ranlib lib/libiscsi.a
examples: bin/iscsiclient
bin/iscsiclient: examples/iscsiclient.c lib/libiscsi.a
mkdir -p bin
$(CC) $(CFLAGS) -o $@ examples/iscsiclient.c lib/libiscsi.a $(LIBS)
install: lib/libiscsi.a lib/$(LIBISCSI_SO) bin/iscsi-ls bin/iscsi-inq
$(INSTALLCMD) -m 755 lib/$(LIBISCSI_SO) $(libdir)
$(INSTALLCMD) -m 755 lib/libiscsi.a $(libdir)
$(INSTALLCMD) -m 755 bin/iscsi-ls $(bindir)
$(INSTALLCMD) -m 755 bin/iscsi-inq $(bindir)
mkdir -p $(exec_prefix)/include/iscsi
$(INSTALLCMD) -m 644 include/iscsi.h $(exec_prefix)/include/iscsi
$(INSTALLCMD) -m 644 include/scsi-lowlevel.h $(exec_prefix)/include/iscsi
iscsi-test: lib/libiscsi.a
make -C test-tool
distclean: clean
rm -f config.h config.log config.status configure Makefile
clean:
rm -f lib/*.o src/*.o examples/*.o
rm -f bin/*
rm -f lib/libiscsi.so*
rm -f lib/libiscsi.a
rm -f iscsi-inq iscsi-ls
make -C test-tool clean