CFLAGS=-O2 -fomit-frame-pointer -Wall -fno-strength-reduce
#CFLAGS=-g -Wall -fno-strength-reduce
LDFLAGS=-s

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

BINDIR=/usr/lib/scsi
MANDIR=/usr/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
	cp scsiinfo scsiformat /usr/bin
	if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR); fi
	cp tworands $(BINDIR)
	install-wish $(BINDIR) $(WISHEXECS)
	install-wish /usr/bin scsi-config tk_scsiformat
	cp tk/generic $(BINDIR)
	cp man8/* $(MANDIR)/man8

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

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