#
# Makefile for mda.o, Monochrome monitor driver for Linux
#
#
# (c) 1995,1996 P.J.Caulfield
#

#
# If you want automatic selection of major numbers then set this to DYNAMIC
#
MAJOR_NR    = 31
#MAJOR_NR    = DYNAMIC

#
# Default installation directories. The module goes into INSTALL_DIR and
# the insmod script into INSTALL_SCRIPT_DIR
#
INSTALL_DIR = /lib/modules/misc
INSTALL_SCRIPT_DIR = /usr/local/bin

CC     = gcc
CFLAGS = -Wall -fstrict-prototypes -D__KERNEL__ -D__NO_VERSION__ -fomit-frame-pointer -O -DMONO_MAJOR=$(MAJOR_NR) -DMODULE
#
# Include autoconf.h if we have it
#
ifeq (/usr/include/linux/autoconf.h, $(wildcard /usr/include/linux/autoconf.h))
DFLAGS = -DHAVE_AUTOCONF
endif


mda.o: mda.c vt100.c mda.h
	$(CC) $(CFLAGS) $(DFLAGS) -c mda.c -o mda.o 

clean:
	rm -f mda.o *~ *.bak *.uue *.gz
    
install:
	install -d $(INSTALL_DIR) 
	install mda.o $(INSTALL_DIR)/mda.o
	install load_mda $(INSTALL_SCRIPT_DIR)/load_mda
	if [ -e /dev/mono ] ; then rm -f /dev/mono ; fi
	if [ $(MAJOR_NR) != DYNAMIC ] ; then mknod --mode 0666 /dev/mono c $(MAJOR_NR) 1 ; fi

dist:
	cd ..; tar czf mda/mda.tar.gz mda/mda.c mda/mda.h mda/vt100.c mda/README mda/TODO mda/NEWS mda/load_mda mda/Makefile mda/herc/*
	uuencode mda.tar.gz mda.tar.gz >mda.uue
