#################################################################################
# File level history, record changes for this file here.                        #
#                                                                               #
# v 0.0.0 16 Oct 2007 by Golden Wang                                            #
#  Give support to Linux kernel 2.4.x                                           #
#                                                                               #
#################################################################################  

# Kernel includes.  Please avoid
# using '/usr/include' unless all
# other options exhausted.
#
PROJECT=usb-serial
VERSION=0.1.0
PACKAGE=$(PROJECT)-$(VERSION)

KDIR=/lib/modules/`uname -r`/build
KINC=$(KDIR)/include


# uncomment line below if you have SMP
#SMPFLAGS=	-D__SMP__ -DCONFIG_SMP=1

# Unless you have a 386/486, you shouldn't need
# to change anything below here...

CPUFLAGS=	-DCPU=586 -march=i586
MODULE=		pl2303
CC=		gcc

KERNFLAGS=	\
	-D__KERNEL__ -I$(KINC) $(CPUFLAGS) $(SMPFLAGS) \
	-Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
	-fno-strict-aliasing -pipe -DMODULE

EXTRA_CFLAGS= -DEXPORT_SYMTAB

# DBGCFLAGS = -DDEBUG -DUSB_SERIAL_DEBUG

CFLAGS=		$(KERNFLAGS) $(DBGCFLAGS)


all::		$(MODULE).o usbserial.o

$(MODULE).o:	$(MODULE).c usb-serial.h
	$(CC) $(CFLAGS) -c $<

usbserial.o: usbserial.c usb-serial.h
	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c $<

inst:
	insmod ./usbserial.o
	insmod ./pl2303.o

uninst:
	rmmod pl2303
	rmmod usbserial

package:
	cd .. && rm -f $(PACKAGE) && ln -s `basename $(CURDIR)` $(PACKAGE) && tar --exclude-from EXCLUDE -cf - $(PACKAGE)/. | gzip --best -c > $(PACKAGE).tar.gz

clean:
	rm -f *.o *~
