# Makefile -- makefile for the Linux Toshiba SMM driver for 2.0.x series kernels
#
# Copyright 1997-2001  Jonathan A. Buzzard (jonathan@buzzard.org.uk)
#

CC = gcc
KERNEL = -D__KERNEL__ -DKERNEL -DMODULE
MODDIR = /lib/modules/`uname -r`/misc
INSTALL = /usr/bin/install -c

all: toshiba.o

toshiba.o: toshiba.c
	$(CC) -m486 -O2 -Wall $(KERNEL) -c toshiba.c -o $@

install: all
	if [ "`ls -l /dev/toshiba 2>/dev/null | awk '{print $$6}'`" != "181" ] \
		; then rm -f/dev/toshiba ; mknod -m 666 /dev/toshiba c 10 181 ; fi
	$(INSTALL) -m 644 toshiba.o $(MODDIR)
	if ! modprobe -c | grep -q 'alias char-major-10-181 toshiba' ; then \
		if [ -r /etc/modutils/aliases ] ; then \
			echo 'alias char-major-10-181 toshiba' \
				>> /etc/modutils/aliases ; \
			/sbin/update-modules ; \
		elif [ -r /etc/modules.conf ] ; then \
			echo 'alias char-major-10-181 toshiba' \
				>> /etc/modules.conf ; \
		elif [ -r /etc/conf.modules ] ; then \
			echo 'alias char-major-10-181 toshiba' \
				>> /etc/conf.modules ; \
		fi ; \
	fi

clean:
	rm -f *.o *.bak core a.out kernel.o
