TOPLEVEL=../..
DRVDIR=../../drv/
DPADIR=../../dpa/
RASDIR=../../includes/
INCLUDES+= -I$(DRVDIR)
INCLUDES+= -I$(DPADIR)
INCLUDES+= -I$(RASDIR)

CFLAGS= $(INCLUDES) -c -DDRVDIR='"$(DRVDIR)"' -DDPADIR='"$(DPADIR)"' -DRASDIR='"$(RASDIR)"'
include $(TOPLEVEL)/Makefile.inc

CC=$(shell ../../scripts/kwhich kgcc 2>/dev/null || echo cc)

#DOTHIS:	utest getnum tmodem disp svfifo blast
DOTHIS:	utest tmodem getnum

utest.o:	utest.c $(DRVDIR)cpciP.h $(DRVDIR)pciclassic.h utest.h

utest: utest.o
	$(CC) -o utest utest.o
#	$(CC) -static -o utest utest.o


getnum.o:	getnum.c
	$(CC) -c getnum.c

getnum: getnum.o
	$(CC) -o getnum getnum.o

disp.o:	disp.c
	$(CC) -c disp.c

disp: disp.o
	$(CC) -o disp disp.o -lncurses

svfifo.o:	svfifo.c
	$(CC) -c svfifo.c

svfifo: svfifo.o
	$(CC) -o svfifo svfifo.o

blast.o:	blast.c $(DRVDIR)cpciP.h

blast: blast.o
	$(CC) -o blast blast.o

tmodem:	tmodem.c

tmodem: tmodem.o
	$(CC) -o tmodem tmodem.o

clean:
	rm -f utest utest.o tmodem tmodem.o blast blast.o \
		svfifo svfifo.o disp disp.o getnum getnum.o
install:
	install -d $(CPCIDIR)
	install -d $(MANDIR)/man1
	install -m 755 utest $(CPCIDIR)
	install -m 644 utest.1 $(MANDIR)/man1/utest.1

uninstall:
	rm -f $(CPCIDIR)/utest
	rm -f $(MANDIR)/man1/utest.1

x.o:	x.c

x: x.o
	$(CC) -o x x.o
