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

MAJOR_NR    = 31
INSTALL_DIR = /lib/modules/1.3.57/misc

CC     = gcc -Wall
#
# Include autoconf.h if we have it
#
ifeq (/usr/include/linux/autoconf.h, $(wildcard /usr/include/linux/autoconf.h))
DFLAGS = -DHAVE_AUTOCONF
endif

CFLAGS = -D__KERNEL__ -fomit-frame-pointer -O -DMONO_MAJOR=$(MAJOR_NR) -DMODULE $(DFLAGS)

all: mda.o mdaming

mda.o: main.o graphic.o text.o
	ld -r main.o graphic.o text.o -o mda.o

clean:
	rm -f *.o *~ *.bak *.uue *.gz mdaming
    
mdaming: ming.c
	gcc -fomit-frame-pointer -O ming.c -o mdaming

install:
	install -d $(INSTALL_DIR) 
	install mda.o $(INSTALL_DIR)/mda.o
	for i in mono monotext monographic ; do if [ -e /dev/$$i ] ; then rm -f /dev/$$i ; fi ; done
	mknod --mode 0666 /dev/monotext c $(MAJOR_NR) 2
	mknod --mode 0666 /dev/monographic c $(MAJOR_NR) 1
	cd /dev; ln -s monotext mono
	rmmod mda

dist:
	cd ..; tar cf - mda/*.c mda/*.h mda/README mda/TODO mda/NEWS mda/Makefile mda/monomirror | gzip -9 > mda/mda.tar.gz
	uuencode mda.tar.gz mda.tar.gz >mda.uue
