#*******************************************************************
# Motorola 683xx BDM Driver for Linux Kernel and GNU Debugger
#
# Makefile-dev - Makefile for standalone compilation
#
# CFLAG definitions must exactly match flags used by Linux kernel
# If you have no special reason to use this setup use Makefile-mod
# instead - it ensures match of flags with kernel.
#
# (C) Copyright 1999 by Pavel Pisa 
#
# The BDM driver is distributed under the Gnu General Public Licence. 
# See file COPYING for details.
#*******************************************************************/

CC=gcc

# which interface do you want to use
# now you can select both without problems
INTERFACE+= -D PD_INTERFACE
INTERFACE+= -D ICD_INTERFACE

# if you want to use ispGAL programming
CFLAGS   += -DEFIICDISP

# last possible way to make system work when you have problems
# with single step or stop
# it tries to find 17 bit protocol boundary
# after single step or stop
BDM_DEFS += -D BDM_TRY_RESYNCHRO

# if the kernel is configured for autoloading via kerneld, uncomment this line
#AUTOLOADING= -DMODVERSIONS
AUTOLOADING= `[ -f /usr/include/linux/modversions.h ] && echo -DMODVERSIONS`

CFLAGS= -Wall -O2 -I. -m486 -D__KERNEL__ -DKERNEL $(INTERFACE) \
        -DMODULE  $(AUTOLOADING) $(BDM_DEFS)

#CFLAGS+= -D__SMP__

all:	bdm.o
	cp $^ /lib/modules/`uname -r`/misc
	rmmod  bdm
	insmod bdm


bdm.o:	bdm.c bdm.h k_compat.h

.SUFFIXES: .i .s
.c.i:
	$(CC) -E $(CFLAGS) $< >$@

.c.s:
	$(CC) -S $(CFLAGS) $<


