#
#  Datafab MD2-USB 2.5" IDE-to-USB bridge driver.
#  Makefile for ide-usb MD2 USB disk driver. Maybe this piece
#  of code will be incorporated into the linux main source
# 
#  Copyright (c) 2000 Josef Reisinger (josef.reisinger@web.de)
#  
#  Based on many Linux drivers
#  o usb-storage.c by Michael Gee and Matthew Dharm 
#  o paride.c/pd.c Grant R. Guenther 
#  
# 
#  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 of the License, 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; if not, write to the Free Software Foundation,
#  Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# 
# 
#  Revision history:
#
#  $Log: Makefile,v $
#  Revision 2.3  2001/01/07 00:45:41  root
#  *** empty log message ***
#
#  Revision 2.2  2001/01/06 22:20:11  root
#  Minor bug fixes
#
#  Revision 2.1  2001/01/06 22:04:54  root
#  Added comments
#  Re-arragend the patch of the source tree
#
#
#  The command line below has been derived from a "make -n"
#
INCL=-I/usr/src/linux-2.2.16/include -include /usr/src/linux-2.2.16/include/linux/modversions.h
FLAGS=-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -fno-strength-reduce -m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2 -DCPU=586 
DEFINES=-D__KERNEL__  -D__SMP__ -DMODULE -DMODVERSIONS 
all: ide-usb.o 
#
#	the main driver
#
ide-usb.o: ide-usb.c ide-usb.h ide-usb-debug.h
	kgcc  $(FLAGS) $(INCL) $(DEFINES) -c -o ide-usb.o ide-usb.c
#
clean:
	rm -v *.o *.dif
#
#  create differences between the files "Makefile", "Config.in" in the
#  driver/usb directory and "Configure.help" in the documentation directory
#
diff:
	-diff -uP /usr/src/linux/drivers/usb-orig/Makefile /usr/src/linux/drivers/usb/Makefile >ide-usb.dif
	-diff -uP /usr/src/linux/drivers/usb-orig/Config.in /usr/src/linux/drivers/usb/Config.in >>ide-usb.dif
	-diff -uP /usr/src/linux/Documentation/Configure.help.orig /usr/src/linux/Documentation/Configure.help >>ide-usb.dif
#
#
#  Install patch into kernel source tree. The source files are simply copied
#  (and a previous file is saved), the other files are patched.
#
install: patch
patch:
	(OLD=$$PWD;						\
	  cd /usr/src/linux/drivers/usb;			\
	  for F in ide-usb.c ide-usb.h ide-usb-debug.h ;do	\
	    if [ -f $$F ] ; then mv -f $$F $$F.orig;fi;		\
	    cp -v $$OLD/$$F .;				\
	  done							\
	)
	patch -p0 <ide-usb.dif
#
#	distribution
#
DISTFILES=			\
	ide-usb/ide-usb.dif 	\
	ide-usb/Makefile 	\
	ide-usb/ide-usb.c 	\
	ide-usb/ide-usb.h 	\
	ide-usb/ide-usb-debug.h \
	ide-usb/doc/datafab.sdw
ide-usb.tgz: $(DISTFILES)	
dist: ide-usb.tgz
	(cd ide-usb;tar zcf ide-usb.tgz ide-usb.dif Makefile ide-usb.c ide-usb.h ide-usb-debug.h doc/datafab.sdw)
web:
	cp doc/datafab.sdw doc/web
	cp doc/index.html doc/web
	cp doc/sniffusb.html doc/web
	cp doc/jusb.html doc/web
