TXDIR	=	/usr/local/t3x/r5	# where the T3X compiler lives
BINDIR	=	/usr/local/bin		# where to place the binaries
DOCDIR	=	/usr/local/share/doc/s86kit	# where the documents go
CATDIR	=	/usr/local/man/cat1	# where the preformatted man pages go

.SUFFIXES:	.t .exe

PROGS	=	cvexe cvimg hd rmsym s86 s86b s86q sld snm sz xo

all:	$(PROGS) libtx86.o libvio.o

libtx86.o:	libtx86.s
	./s86 <libtx86.s >libtx86.o

libvio.o:	libvio.s
	./s86 <libvio.s >libvio.o

# Notice: the other parts of T3X compiler must be completely installed,
# before the dosexe target works!

dosexe:	s86b.exe cvexe.exe hd.exe sld.exe snm.exe s86.exe rmsym.exe\
	sz.exe xo.exe cvimg.exe s86q.exe

.t:
	../native/txboot.sh $<

.t.exe:
	tx -O -m 86a $<

install:
	install -o bin -g bin -d -m 0755 $(DOCDIR)
	install -o bin -g bin -C -m 0755 cvexe $(BINDIR)
	install -o bin -g bin -C -m 0755 cvimg $(BINDIR)
	install -o bin -g bin -C -m 0755 rmsym $(BINDIR)
	install -o bin -g bin -C -m 0755 sld $(BINDIR)
	install -o bin -g bin -C -m 0755 snm $(BINDIR)
	install -o bin -g bin -C -m 0755 s86 $(BINDIR)
	install -o bin -g bin -C -m 0755 s86b $(BINDIR)
	install -o bin -g bin -C -m 0755 s86q $(BINDIR)
	install -o bin -g bin -C -m 0755 sz $(BINDIR)
	install -o bin -g bin -C -m 0755 xo $(BINDIR)
	install -o bin -g bin -C -m 0644 libtx86.o $(TXDIR)/lib
	install -o bin -g bin -C -m 0644 libvio.o $(TXDIR)/lib
	install -o bin -g bin -C -m 0444 S86KIT.sd $(DOCDIR)
	install -o bin -g bin -C -m 0444 sdv-config $(DOCDIR)
	sed -e 's/#NOVIOLIB //' <$(BINDIR)/tx >/tmp/tx
	install -o bin -g bin -m 0755 /tmp/tx $(TXDIR)/bin/tx

clean:
	rm -f *.o *.core core _PASS2 _DATA _TEXT _RELOC \
	_LDTEXT _LDDATA x.out x.exe

clobber:	clean
	rm -f $(PROGS) *.exe
