| 1 |
######################################################################### |
| 2 |
# Makefile for istgt |
| 3 |
######################################################################### |
| 4 |
|
| 5 |
top_srcdir = @top_srcdir@ |
| 6 |
srcdir = @srcdir@ |
| 7 |
|
| 8 |
prefix = @prefix@ |
| 9 |
exec_prefix = @exec_prefix@ |
| 10 |
bindir = @bindir@ |
| 11 |
sbindir = @sbindir@ |
| 12 |
sysconfdir = @sysconfdir@ |
| 13 |
datadir = @datarootdir@ |
| 14 |
libexecdir = @libexecdir@ |
| 15 |
|
| 16 |
CC = @CC@ |
| 17 |
CFLAGS = @CFLAGS@ |
| 18 |
CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir) -I$(srcdir) |
| 19 |
LDFLAGS = @LDFLAGS@ |
| 20 |
DEFS = @DEFS@ |
| 21 |
LIBS = @LIBS@ |
| 22 |
INSTALL = @INSTALL@ |
| 23 |
RANLIB = @RANLIB@ |
| 24 |
MKDEP = @MKDEP@ |
| 25 |
|
| 26 |
CFLAGS += -DDEBUG |
| 27 |
CFLAGS += -fno-strict-aliasing -Wstrict-aliasing |
| 28 |
CFLAGS += -Wbad-function-cast -Wcast-align |
| 29 |
CFLAGS += -Wcast-qual -Wchar-subscripts -Winline |
| 30 |
CFLAGS += -Wmissing-prototypes -Wnested-externs -Wpointer-arith |
| 31 |
CFLAGS += -Wredundant-decls -Wshadow -Wstrict-prototypes -Wwrite-strings |
| 32 |
|
| 33 |
source = istgt.c istgt_iscsi.c istgt_iscsi_param.c \ |
| 34 |
istgt_lu.c istgt_lu_disk.c istgt_lu_dvd.c istgt_lu_tape.c \ |
| 35 |
istgt_lu_pass.c istgt_lu_ctl.c \ |
| 36 |
istgt_log.c istgt_conf.c istgt_sock.c istgt_misc.c \ |
| 37 |
istgt_queue.c istgt_crc32c.c istgt_md5.c |
| 38 |
header = istgt_ver.h istgt.h istgt_iscsi.h istgt_iscsi_param.h \ |
| 39 |
istgt_scsi.h istgt_proto.h istgt_lu.h \ |
| 40 |
istgt_log.h istgt_conf.h istgt_sock.h \ |
| 41 |
istgt_misc.h istgt_queue.h istgt_crc32c.h istgt_md5.h |
| 42 |
document = |
| 43 |
sample = |
| 44 |
|
| 45 |
ctl_source = istgtcontrol.c istgt_conf.c istgt_sock.c istgt_misc.c \ |
| 46 |
istgt_md5.c |
| 47 |
ctl_header = istgt_ver.h istgt_conf.h istgt_sock.h istgt_misc.h \ |
| 48 |
istgt_md5.h |
| 49 |
|
| 50 |
ISTGT = $(source:.c=.o) |
| 51 |
ISTGTCONTROL = $(ctl_source:.c=.o) |
| 52 |
|
| 53 |
PACKAGE_NAME = @PACKAGE_NAME@ |
| 54 |
PACKAGE_STRING = @PACKAGE_STRING@ |
| 55 |
PACKAGE_TARNAME = @PACKAGE_TARNAME@ |
| 56 |
PACKAGE_VERSION = @PACKAGE_VERSION@ |
| 57 |
|
| 58 |
VER_H = istgt_ver.h |
| 59 |
DISTBASE = istgt |
| 60 |
DISTVER = `sed -e '/ISTGT_VERSION/!d' -e 's/[^0-9.]*\([0-9.a-z]*\).*/\1/' $(VER_H)` |
| 61 |
DISTEXTVER = `sed -e '/ISTGT_EXTRA_VERSION/!d' -e 's/[^0-9.]*\([0-9.a-z]*\).*/\1/' $(VER_H)` |
| 62 |
#DISTDIR = $(PACKAGE_NAME)-$(PACKAGE_VERSION) |
| 63 |
#DISTDIR = $(DISTBASE)-$(DISTVER)-$(DISTEXTVER) |
| 64 |
#DISTDIR = $(DISTBASE)-$(DISTEXTVER) |
| 65 |
DISTDIR = $(top_srcdir)/`cat $(top_srcdir)/distdir` |
| 66 |
DISTNAME = $(DISTDIR).tar.gz |
| 67 |
DISTFILES = Makefile.in config.h.in build.h.in \ |
| 68 |
$(header) $(source) $(ctl_header) $(ctl_source) \ |
| 69 |
$(document) $(sample) |
| 70 |
|
| 71 |
######################################################################### |
| 72 |
|
| 73 |
.SUFFIXES: .c .o |
| 74 |
.c.o: |
| 75 |
$(CC) $(DEFS) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< |
| 76 |
|
| 77 |
all: stamp-depend config.h istgt istgtcontrol |
| 78 |
|
| 79 |
istgt: $(ISTGT) |
| 80 |
$(CC) $(LDFLAGS) $(LIBS) -o $@ $(ISTGT) |
| 81 |
|
| 82 |
istgtcontrol: $(ISTGTCONTROL) |
| 83 |
$(CC) $(LDFLAGS) $(LIBS) -o $@ $(ISTGTCONTROL) |
| 84 |
|
| 85 |
install: install-dirs |
| 86 |
install -c -m 0755 istgt $(DESTDIR)$(bindir) |
| 87 |
install -c -m 0755 istgtcontrol $(DESTDIR)$(bindir) |
| 88 |
|
| 89 |
install-dirs: |
| 90 |
mkdir -p $(DESTDIR)$(bindir) |
| 91 |
|
| 92 |
dist: $(DISTFILES) |
| 93 |
mkdir $(DISTDIR)/$(subdir) |
| 94 |
cd $(srcdir); thisdir=`pwd`; \ |
| 95 |
for file in `echo $(DISTFILES) | sort`; do \ |
| 96 |
cp -p $$thisdir/$$file $(DISTDIR)/$(subdir); \ |
| 97 |
done |
| 98 |
|
| 99 |
depend: |
| 100 |
if [ "x$(MKDEP)" != "x" ]; then \ |
| 101 |
$(MKDEP) -MM $(DEFS) $(CFLAGS) $(CPPFLAGS) $(source); \ |
| 102 |
fi |
| 103 |
touch stamp-depend |
| 104 |
|
| 105 |
clean: |
| 106 |
-rm -f a.out *.o *.core |
| 107 |
-rm -f *~ |
| 108 |
-rm -f istgt istgtcontrol |
| 109 |
|
| 110 |
distclean: clean |
| 111 |
-rm -f stamp-depend .depend |
| 112 |
-rm -f stamp-h.in |
| 113 |
-rm -f Makefile config.status config.cache config.log config.h |
| 114 |
-rm -f build.h |
| 115 |
|
| 116 |
######################################################################### |
| 117 |
|
| 118 |
stamp-depend: Makefile |
| 119 |
$(MAKE) depend |
| 120 |
|
| 121 |
######################################################################### |