CFLAGS+=${KERNEL_INCLUDES} -g -O2 -Wall -fomit-frame-pointer -fno-strength-reduce -D_GNU_SOURCE
#CFLAGS=-g -Wall -fno-strength-reduce
CPPFLAGS+=
LDFLAGS+=-s

#do not modify this without changing the tcl/tk scripts

BINDIR=$(DESTDIR)/usr/lib/scsi
MANDIR=$(DESTDIR)/usr/share/man
WISHEXECS=tk/cache tk/control tk/disconnect tk/error tk/format\
	tk/inquiry tk/notch tk/peripheral tk/rigid tk/save-changes tk/verify\
	tk/save-file tk/overview
TARGETS=scsiinfo scsiformat tworands

.PHONY: all install dist clean

all: $(TARGETS)

install: $(TARGETS) $(WISHEXECS) scsi-config tk_scsiformat
	test -d $(DESTDIR)/sbin || mkdir -p $(DESTDIR)/sbin
	test -d $(DESTDIR)/usr/sbin || mkdir -p $(DESTDIR)/usr/sbin
	test -d $(BINDIR) || mkdir -p $(BINDIR)
	cp scsiinfo $(DESTDIR)/sbin
	cp scsiformat $(DESTDIR)/usr/sbin
	cp tworands $(BINDIR)
	./install-wish $(BINDIR) $(WISHEXECS)
	#./install-wish $(DESTDIR)/usr/sbin scsi-config tk_scsiformat
	cp scsi-config tk_scsiformat $(DESTDIR)/usr/sbin
	cp tk/generic $(BINDIR)
	# manuals are installed by dh_installmanpages in debian/rules
	#cp man8/* $(MANDIR)/man8

clean:
	rm -f core *~ *.o $(TARGETS)

dist: clean
	(mydir=`basename \`pwd\``;\
	cd .. && tar cvvf - $$mydir | gzip -9 > $${mydir}.tar.gz)
