# 
# Copyright 1999 by Digi International (www.digi.com)
# 
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; 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.  
#
#	Main Makefile for PCI DataFire RAS/AccelePort RAS/AccelePort 2000 driver
#	for Linux
#
#	$Id: Makefile26,v 1.4 2003/07/15 21:10:55 scottk Exp $
#

# To make correct module for 2.5 and up:
# make -C path/to/kernel/src SUBDIRS=$PWD modules

# Grab version and other important stuff
include ${PWD}/../Makefile.inc

MODULE= dgrp.ko

# Send in some extra things...
EXTRA_CFLAGS += -I${PWD} -I${PWD}/include -I${PWD}/../commoninc \
	-DDIGI_VERSION=\"$(TRUE_VERSION)\" -DDGRP_TRACER

# Conform to correct kbuild conventions...
obj-m += dgrp.o
dgrp-objs := dgrp_common.o  dgrp_driver.o  dgrp_mon_ops.o  dgrp_net_ops.o\
	dgrp_ports_ops.o  dgrp_proc.o  dgrp_specproc.o dgrp_tty.o


.PHONY: build all install uninstall postinstall preuninstall


all: build

build:
	make -C @KERNEL_HEADERS@ SUBDIRS=$$PWD modules

install:
	install -d  $(DGRPBIN)
	install -d  $(DGRPMAN)
	install -m 644 $(MODULE) $(DGRPBIN)/
	install -m 644 dgrp.man $(DGRPMAN)/dgrp.8

postinstall: $(MODDIR)
	ln -sf /usr/bin/dgrp/dgrp.ko $(MODDIR)/dgrp.ko
	/sbin/depmod -a

preuninstall:
	-rm -f $(MODDIR)/dgrp.ko

uninstall:
	-rm -f $(DGRPBIN)/$(MODULE)
	-rm -f $(DGRPMAN)/dgrp.8*
	-rm -f /var/catman/cat8/dgrp.8*

clobber: clean
	rm -rf Makefile


clean:
	rm -f *.o
	rm -f *.ko
	rm -f dgrp.mod.c
	rm -f .*.cmd
	-rm -f *.i *.s

