# Makefile for usrTime
# Author:   Bob Herlien
# Project:  ROV 1.5
# Created:  02/28/91
#

## Features include:
##	MICROTIME - include microtime() call in {get,set}timeofday()
##		    This increases clock resolution from 16.67 ms (for 60 Hz
##		    tick) to the resolution of microtime() (1 us for MVME-162)
##
##      SYNCRTC   - Sync the real-time clock chip hardware to the software-
##                  maintained time-of-day.  This only makes sense if
##                  you're running NTP.
##
##      SET_TZ   -  Set the TIMEZONE environment variable according to
##                  the compiled-in timezone information.


FEATURES = -DMICROTIME -DSET_TZ
#FEATURES =

## rules

.c.o :
	@rm -f $@
	$(CC) $(CFLAGS) $<


## files and directories

VW		= $(WIND_BASE)
VWINC		= $(VW)/target/h
CONFIG		= $(VW)/target/config/mv162
VWSYSINC	= $(VWINC)/drv
MAKEFILE	= Makefile
ARCHIVE		= usrTime.tar

INCLUDES	= usrTime.h mbari_types.h

SOURCES		= usrTime.c sysRtc.c sysMicroClock.c

OBJECTS		= usrTime.o sysRtc.o sysMicroClock.o

ALLFILES	= $(MAKEFILE) $(INCLUDES) $(SOURCES)


## tools
CC		= cc68k
LD		= ld68k
RM		= rm -f


## flags

INCFLAGS	= -I. -I$(VWINC) -I$(CONFIG) -I$(VWSYSINC)
DEBUGFLAG	=
CFLAGS		= -c -O -ansi -Wall -fno-builtin $(DEBUGFLAG) $(INCFLAGS) \
		  -DCPU=MC68040 -m68040 $(FEATURES)
LDFLAGS		= -d -r
LIBS		=


## actions

default : usrTime

clean	:
	  $(RM) *.o

$(ARCHIVE).Z: $(ARCHIVE)
	  compress $(ARCHIVE)

$(ARCHIVE): $(ALLFILES)
	  $(RM) $(ARCHIVE) $(ARCHIVE).Z
	  tar cvhf $(ARCHIVE) $(ALLFILES)

tar	: $(ARCHIVE)


## dependencies

usrTime : $(OBJECTS)
	  $(RM) usrTime
	  $(LD) -o usrTime $(LDFLAGS) $(OBJECTS) $(LIBS)

usrTime.o : $(INCLUDES) usrTime.c
	    $(CC) $(CFLAGS) usrTime.c

sysRtc.o  : $(INCLUDES) sysRtc.c
	    $(CC) $(CFLAGS) sysRtc.c

sysMicroClock.o : $(INCLUDES) sysMicroClock.c
	          $(CC) $(CFLAGS) sysMicroClock.c

testtime.vx : testtime.c
	     $(CC) -DVXWORKS $(CFLAGS) -o testtime.vx testtime.c

testtime.unix : testtime.c
	        cc -o testtime.unix testtime.c
