prefix = /usr

INCDIR	= $(prefix)/include
MODDIR	= /lib/modules/`uname -r`/misc

# If the kernel is configured for module versions, uncomment this line
# If the kernel is configured for module versions and you fail to uncomment
# this line the driver will install and work properly, but depmod will
# complain about unresolved symbols.
MODVERSIONS=-DMODVERSIONS

#
# If you use a 5307 or have the PST lines free for BDM use
# you can compile the driver to have PST support. This improves
# long term debugging due to bit errors which can corrupt the
# the CSR register and generate a false halt bit.
#USE_PST=-DUSE_PST

LIB	= libBDM.a

CFLAGS = -Wall -g -O -pipe -I.. -DMODULE -D__KERNEL__ $(MODVERSIONS) $(USE_PST)

all: linux-bdm.o

$(LIB): $(LIB)(bdmIO.o)
	ranlib $(LIB)

install: all
	-mkdir -p $(INCDIR) $(MODDIR)
	cp ../bdm.h $(INCDIR)/bdm.h
	cp linux-bdm.o $(MODDIR)/bdm.o
	depmod -a

linux-bdm.o: ../bdm.h ../bdm.c

clean:
	rm -f *.o $(LIB)
