#
# Makefile
# Copyright (c) 2005 by Diamond Systems.
#
# Makefile for building dscudkp.o Linux kernel module.  Use the install.sh
# script instead of calling make directly.  Makefile must be called with
#


#
# BUILD FOR KERNEL 2.0 - 2.4
#
ifeq ($(KERNEL),LINUX_24)

include $(KDIR)/.config

CFLAGS = -O2 -D__KERNEL__ -DMODULE -I$(KDIR)/include

ifdef CONFIG_SMP
    CFLAGS += -D__SMP__ -DSMP
endif

all: dscudkp.o

dscudkp.o:
	gcc -c -o dscudkp.o dscudkp.c $(CFLAGS)

install: dscudkp.o
	mkdir -p /lib/modules/misc
	cp dscudkp.o /lib/modules/misc/

clean:
	rm -f dscudkp.o


#
# BUILD FOR KERNEL 2.6
#
else

ifneq ($(KERNELRELEASE),)
obj-m	:= dscudkp.o

else
PWD		:= $(shell pwd)

default:
	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

install: dscudkp.o
	mkdir -p /lib/modules/misc
	cp dscudkp.ko /lib/modules/misc/

clean:
	rm -f dscudkp.ko dscudkp.o dscudkp.mod.*

endif

endif

