#! /usr/sbin/smake
# Component: Makefile
# Purpose: Makefile for the ICE PIC board
# Developer: T. Potthast, The Espy Corporation (http://www.espycorp.com(
#            tom@espycorp.com (407) 876-5720 
#
# To dynamiclly load the driver, type "make install" this will lboot the
#  driver into the kernel
#
# To rebuild /unix with the driver, type "make kernel" this will build a
#  /unix.install file, then reboot the system to load the driver, Once
#  this is done, the driver will load automatically each time the system is
#  booted.
#
# Check out /var/adm/SYSLOG for driver print statements (or the console)
# 
# for More debug information to the syslog, uncomment the -DDEBUG line below
#  in DEBUG_OPTIONS, then rebuild the driver


VER=1.00

INC_DIR=.
DRV=picdrv
TARGETS=${DRV}.o
HEADERS=${INC_DIR}/picdrv.h
CPUBOARD!=uname -m
IRIX!=uname -r
DATE!=date
#if $(IRIX) == "6.2"
COMPILATION_MODEL=64
APPLICATION_COMP_MODE=-n32
#else
COMPILATION_MODEL=32
#endif

INCLUDES=-I../../inc
VERSION_INFO=-DDATE="\"$(DATE)\"" -DVERSION="\"$(VER)"\"
sinclude /var/sysgen/Makefile.kernio

CFLAGS+=-G0 #Needed for dynamically lbooting the driver
CFLAGS+=${INCLUDES} -r -c -jalr -DSN -D_SGI

MPATH=/var/sysgen/master.d
SPATH=/var/sysgen/system
OPATH=/var/sysgen/boot

DEBUG_OPTIONS=-woff 1174,1196,1116 #-DDEBUG

all:    ${TARGETS} pictest

.c.o: $*.c Makefile ${HEADERS} picdrv.h 
	$(CC) $(VERSION_INFO) $(DEBUG_OPTIONS) $(CFLAGS) $*.c

pictest: pictest.c picdrv.h 
	$(CC) -n32 -D_SGI -g pictest.c -I. -I../../inc -o pictest

clean:
	rm *.o

install:
	cp ${DRV}.o ${OPATH}/${DRV}.o
	cp ${DRV}  ${MPATH}/${DRV}
	lboot -L ${DRV}

kernel:
	cp ${DRV}.o ${OPATH}/${DRV}.o
	cp ${DRV}_static  ${MPATH}/${DRV}
	cp ${DRV}.sm  ${SPATH}/${DRV}.sm
	autoconfig -fv

unkernel:
	rm  ${OPATH}/${DRV}.o
	rm ${MPATH}/${DRV}
	rm ${SPATH}/${DRV}.sm
	autoconfig -fv
