#
#       Copyright (C) 1993 Bas Laarhoven.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# $Source: /usr/src/distr/driver/RCS/Makefile,v $
# $Author: bas $
#
# $Revision: 1.5 $
# $Date: 1993/09/07 21:06:38 $
# $State: Alpha $
#
#      Makefile for the QIC-40/80 floppy-tape driver for Linux.
#

ifndef BUFFERS
BUFFERS = 3
endif

CFLAGS = -Wall -Wstrict-prototypes \
        -DLINUX -DKERNEL -D__KERNEL__ -DDYN_MODULE -DNR_BUFFERS=$(BUFFERS) \
        -O6 -fomit-frame-pointer

all: module userft

module: driver.o Makefile
	- rmmod driver
	insmod driver.o

driver.o: ftape-rw.o kernel-interface.o fdc-io.o ecc.o ftape-io.o calibr.o Makefile
	ld -r -o driver.o kernel-interface.o ftape-rw.o fdc-io.o ftape-io.o ecc.o calibr.o

fdc-io.o : fdc-io.c fdc-io.h Makefile \
        ftape-io.h ftape-rw.h kernel-interface.h 
	$(CC) $(CFLAGS) -c -o fdc-io.o fdc-io.c

ftape-io.o : ftape-io.c ftape-io.h Makefile \
        qic117.h fdc-io.h ftape-rw.h kernel-interface.h ftape-ioctl.h vendors.h
	$(CC) $(CFLAGS) -c -o ftape-io.o ftape-io.c

ecc.o : ecc.c ecc.h Makefile \
        fdc-io.h
	$(CC) $(CFLAGS) -c -o ecc.o ecc.c

ftape-rw.o : ftape-rw.c ftape-rw.h Makefile \
        kernel-interface.h qic117.h fdc-io.h ftape-io.h ecc.h
	$(CC) $(CFLAGS) -c -o ftape-rw.o ftape-rw.c

kernel-interface.o : kernel-interface.c kernel-interface.h Makefile \
        ftape-io.h ftape-rw.h fdc-io.h ftape-ioctl.h
	$(CC) $(CFLAGS) -c -o kernel-interface.o kernel-interface.c

calibr.o : calibr.c Makefile
	$(CC) $(CFLAGS) -c -o calibr.o calibr.c

userft : userft.c Makefile \
        ftape-ioctl.h ftape-io.h qic117.h 
	$(CC) -g $(CFLAGS) -o userft userft.c

clean:
	- rm -f userft a.out *.o core *~ OUTPUT gen_test
