#
# Makefile for user space only part of iSCSI-SCST
#
# Note! Dependencies are done automatically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (not a .c file).

SBINDIR := $(PREFIX)/sbin
INITDIR := /etc/init.d
RCDIR := /etc/rc.d

all: include/iscsi_scst_itf_ver.h progs

progs:
	$(MAKE) -C usr

include/iscsi_scst_itf_ver.h: include/iscsi_scst.h
	echo "/* Autogenerated, don't edit */" >include/iscsi_scst_itf_ver.h
	echo "" >>include/iscsi_scst_itf_ver.h
	echo -n "#define ISCSI_SCST_INTERFACE_VERSION " >>include/iscsi_scst_itf_ver.h
	echo -n "ISCSI_VERSION_STRING \"_" >>include/iscsi_scst_itf_ver.h
	echo "`sha1sum include/iscsi_scst.h|awk '{printf $$1}'`\"" >>include/iscsi_scst_itf_ver.h

install: all
	@install -vD -m 755 usr/iscsi-scstd $(DESTDIR)$(SBINDIR)/iscsi-scstd
	@install -vD -m 755 usr/iscsi-scst-adm $(DESTDIR)$(SBINDIR)/iscsi-scst-adm
	@install -vD -m 644 doc/manpages/iscsi-scstd.conf.5 $(DESTDIR)$(MANDIR)/man5/iscsi-scstd.conf.5
	@install -vD -m 644 doc/manpages/iscsi-scstd.8 $(DESTDIR)$(MANDIR)/man8/iscsi-scstd.8
	@install -vD -m 644 doc/manpages/iscsi-scst-adm.8 $(DESTDIR)$(MANDIR)/man8/iscsi-scst-adm.8

clean:
	$(MAKE) -C usr clean
	rm -f include/iscsi_scst_itf_ver.h

extraclean: clean

.PHONY: all progs install clean extraclean
