# Makefile generated by imake - do not edit!
# $Xorg: imake.c,v 1.6 2001/02/09 02:03:15 xorgcvs Exp $

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This Makefile was generated automatically from Imakefile, using imake,
# which is provided as part of the X Windows distribution. imake was
# written by Todd Brunhoff and Jim Fulton from the Mit X Consortium.
#
# The rules for turning an Imakefile into a Makefile are located in
# conf/Imake.tmpl and conf/Imake.rules. Platform specific parameters
# are set in the .cf files. Site specific parameters are set in the
# system's CONFIG file. Rules and templates for RCCL/RCI created by
# John Lloyd, McGill University, November 27, 1990.
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

      TARGET_DEFS = -D"LINUX_CFG"
              RCC = rcc

               CC = gcc
               LD = ld
             LDIR = ../lib
             BDIR = ../bin

             FCMD = undefined

            RMCMD = /bin/rm -f
        JUNKFILES = *.BAK .*.BAK *~ *.CKP .*.CKP \\\#* *.o *.to *.tO core makelog

C_INCS :=
C_DEFS :=  $(TARGET_DEFS)
C_OPNS :=

C_DEFS := $(C_DEFS) -D"RWU"

       RCC_CFLAGS = $(C_OPNS) $(C_INCS) $(C_DEFS) $(TRACE)

            LUSER = $(LDIR)/rciUser.a
            LCTRL = $(LDIR)/rciCtrl.a
            LPUMA = $(LDIR)/libPuma.a

            LAUXK =

            LLIBC = $(LDIR)/libC.a
           LCTREE = $(LDIR)/libCtree.a
 VOLATILE_RCILIBS = $(LUSER) $(LCTRL)
      ALL_RCILIBS = $(LUSER) $(LCTREE) $(LCTRL) $(LAUXK) $(LLIBC)

.SUFFIXES:	.to .tO

.c.to:
	@if [ -f $*.o ] ; then \
	tmp=\#obj_tmp$$$$; mv $*.o $$tmp; fi; \
	echo $(CC) $(CFLAGS) -c -DTEST $^ '[' -o $*.to ']' ; $(CC) $(CFLAGS) -c -DTEST $^; mv $*.o $*.to; \
	if [ "$$tmp" != "" ] ; then mv $$tmp $*.o; else exit 0; fi
.c.tO:
	@if [ -f $*.o ] ; then \
	tmp=\#obj_tmp$$$$; mv $*.o $$tmp; fi; \
	echo $(RCC) $(CFLAGS) -c -DTEST CTRL $^ '[' -o $*.tO ']' ; $(RCC) $(CFLAGS) -c -DTEST CTRL $^; mv $*.o $*.tO; \
	if [ "$$tmp" != "" ] ; then mv $$tmp $*.o; else exit 0; fi

ULIST :=
CLIST :=
PLIST :=
UOBJS :=
COBJS :=
POBJS :=
UTARGS :=
VXWLO :=
VXWBO :=

define CheckForVXWDir
	if [ ! -d VXW ] ; then
	   if [ -f VXW ] ; then
	      echo error: VXW exits, but is not a directory; exit 1
	   fi
	   echo mkdir VXW
	   mkdir VXW
	fi
endef

#=-=-=-=-=-=-=-=-=-=-=-=- Imakefile starts here -=-=-=-=-=-=-=-=-=-=-=-=-=

# -----------------------------------------------------------------------------
#
# make libs	- build library routines and install them in the appropriate
#		  modules in ../lib
#
# make <testprog> - make the indicated test program
#
# RTLinux configuraton most resembles VxWorks and SGI configuration
# -----------------------------------------------------------------------------

CFLAGS = $(RCC_CFLAGS) -g

# The set of all test programs

TEST := rcitest rbttest rbtcom amtest

TEST := $(TEST)	matest batest fatest mxtest rftest pftest

testsuite:	$(TEST)

default:
	echo "make what?"

ULIST := $(ULIST) $(LUSER)(rciCreate.o)
UOBJS := $(UOBJS) rciCreate.o

ULIST := $(ULIST) $(LUSER)(loadtask.o)
UOBJS := $(UOBJS) loadtask.o

ULIST := $(ULIST) $(LUSER)(auxBoot.o)
UOBJS := $(UOBJS) auxBoot.o

ULIST := $(ULIST) $(LUSER)(cpuAlloc.o)
UOBJS := $(UOBJS) cpuAlloc.o

ULIST := $(ULIST) $(LUSER)(remoteMemory.o)
UOBJS := $(UOBJS) remoteMemory.o

ULIST := $(ULIST) $(LUSER)(arbMonitor.o)
UOBJS := $(UOBJS) arbMonitor.o

ULIST := $(ULIST) $(LUSER)(crashMessage.o)
UOBJS := $(UOBJS) crashMessage.o

ULIST := $(ULIST) $(LUSER)(download.o)
UOBJS := $(UOBJS) download.o

ULIST := $(ULIST) $(LUSER)(primitives.o)
UOBJS := $(UOBJS) primitives.o

ULIST := $(ULIST) $(LUSER)(lockRobot.o)
UOBJS := $(UOBJS) lockRobot.o

ULIST := $(ULIST) $(LUSER)(sigHandlers.o)
UOBJS := $(UOBJS) sigHandlers.o

ULIST := $(ULIST) $(LUSER)(rciGlobalMem.o)
UOBJS := $(UOBJS) rciGlobalMem.o

ULIST := $(ULIST) $(LUSER)(interruptRef.o)
UOBJS := $(UOBJS) interruptRef.o

ULIST := $(ULIST) $(LUSER)(loadRobot.o)
UOBJS := $(UOBJS) loadRobot.o

ULIST := $(ULIST) $(LUSER)(attachRobot.o)
UOBJS := $(UOBJS) attachRobot.o

ULIST := $(ULIST) $(LUSER)(robotFile.o)
UOBJS := $(UOBJS) robotFile.o

ULIST := $(ULIST) $(LUSER)(robotDefs.o)
UOBJS := $(UOBJS) robotDefs.o

ULIST := $(ULIST) $(LUSER)(parameterFile.o)
UOBJS := $(UOBJS) parameterFile.o

ULIST := $(ULIST) $(LUSER)(parameterDefs.o)
UOBJS := $(UOBJS) parameterDefs.o

ULIST := $(ULIST) $(LUSER)(allocMem.o)
UOBJS := $(UOBJS) allocMem.o

ULIST := $(ULIST) $(LUSER)(sharedMemory.o)
UOBJS := $(UOBJS) sharedMemory.o

ULIST := $(ULIST) $(LUSER)(hashSetup.o)
UOBJS := $(UOBJS) hashSetup.o

ULIST := $(ULIST) $(LUSER)(lockMemory.o)
UOBJS := $(UOBJS) lockMemory.o

ULIST := $(ULIST) $(LUSER)(hostFxns.lin.o)
UOBJS := $(UOBJS) hostFxns.lin.o

CLIST := $(CLIST) $(LCTRL)(auxMonitor.o)
COBJS := $(COBJS) auxMonitor.o
auxMonitor.o:  auxMonitor.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(auxShare.o)
COBJS := $(COBJS) auxShare.o
auxShare.o:  auxShare.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(monitor.o)
COBJS := $(COBJS) monitor.o
monitor.o:  monitor.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(monitorSubs.o)
COBJS := $(COBJS) monitorSubs.o
monitorSubs.o:  monitorSubs.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(message.o)
COBJS := $(COBJS) message.o
message.o:  message.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(mutex.o)
COBJS := $(COBJS) mutex.o
mutex.o:  mutex.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(rciAbort.o)
COBJS := $(COBJS) rciAbort.o
rciAbort.o:  rciAbort.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(rciErrorMsg.o)
COBJS := $(COBJS) rciErrorMsg.o
rciErrorMsg.o:  rciErrorMsg.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(descriptor.o)
COBJS := $(COBJS) descriptor.o
descriptor.o:  descriptor.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(getMemory.o)
COBJS := $(COBJS) getMemory.o
getMemory.o:  getMemory.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(buddyAlloc.o)
COBJS := $(COBJS) buddyAlloc.o
buddyAlloc.o:  buddyAlloc.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(monitorCom.o)
COBJS := $(COBJS) monitorCom.o
monitorCom.o:  monitorCom.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(signalRef.o)
COBJS := $(COBJS) signalRef.o
signalRef.o:  signalRef.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(accessMem.o)
COBJS := $(COBJS) accessMem.o
accessMem.o:  accessMem.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(rciSetOptions.o)
COBJS := $(COBJS) rciSetOptions.o
rciSetOptions.o:  rciSetOptions.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(levelCheck.o)
COBJS := $(COBJS) levelCheck.o
levelCheck.o:  levelCheck.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(hashRef.o)
COBJS := $(COBJS) hashRef.o
hashRef.o:  hashRef.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(locateMemory.o)
COBJS := $(COBJS) locateMemory.o
locateMemory.o:  locateMemory.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(firstAlloc.o)
COBJS := $(COBJS) firstAlloc.o
firstAlloc.o:  firstAlloc.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(rciConfig.o)
COBJS := $(COBJS) rciConfig.o
rciConfig.o:  rciConfig.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(simSupport.o)
COBJS := $(COBJS) simSupport.o
simSupport.o:  simSupport.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(sparcStubs.o)
COBJS := $(COBJS) sparcStubs.o
sparcStubs.o:  sparcStubs.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(supportFx.lin.o)
COBJS := $(COBJS) supportFx.lin.o
supportFx.lin.o:  supportFx.lin.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(atomicOps.lin.o)
COBJS := $(COBJS) atomicOps.lin.o
atomicOps.lin.o:  atomicOps.lin.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(clockFxns.lin.o)
COBJS := $(COBJS) clockFxns.lin.o
clockFxns.lin.o:  clockFxns.lin.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(linCtrlTask.o)
COBJS := $(COBJS) linCtrlTask.o
linCtrlTask.o:  linCtrlTask.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(noticeBuf.o)
COBJS := $(COBJS) noticeBuf.o
noticeBuf.o:  noticeBuf.c
	$(RCC) $(CFLAGS) -c CTRL $<

CLIST := $(CLIST) $(LCTRL)(rciGetJls.o)
COBJS := $(COBJS) rciGetJls.o
rciGetJls.o:  rciGetJls.c
	$(RCC) $(CFLAGS) -c CTRL $<

.PHONY: libs
libs:	$(ULIST) $(LUSER)(__.SYMDEF)
$(LUSER)(__.SYMDEF): $(UOBJS)
	ranlib $(LUSER)
.PHONY: libs
libs:	$(CLIST) $(LCTRL)(__.SYMDEF)
$(LCTRL)(__.SYMDEF): $(COBJS)
	ranlib $(LCTRL)

libs:	../lib/begin.o ../lib/end.o

../lib/begin.o: begin.c
	$(CC) -c begin.c; mv begin.o $@

../lib/end.o: end.c
	$(CC) -c end.c; mv end.o $@

OU =
OC =

# program to test the rci primitives

rcitest:	$(VOLATILE_RCILIBS)
rcitest:  rcitest.o rcitestCtrl.o $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ rcitest.o $(OU) CTRL rcitestCtrl.o $(OC) $(CLIBS)
	# chmod u+s $@

# program to test the robot interface

rbttest:	$(VOLATILE_RCILIBS)
rbttest:  rbttest.o rbttestCtrl.o $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ rbttest.o $(OU) CTRL rbttestCtrl.o $(OC) $(CLIBS)
	# chmod u+s $@

# program to test basic robot communication:

rbtcom:	$(VOLATILE_RCILIBS)
rbtcom:  rbtcom.o rbtcomCtrl.o $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ rbtcom.o $(OU) CTRL rbtcomCtrl.o $(OC) $(CLIBS)
	# chmod u+s $@

# program to test the object stuff

amtest:	$(VOLATILE_RCILIBS)
amtest:  allocMem.to accessMem.tO $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ allocMem.to $(OU) CTRL accessMem.tO $(OC) $(CLIBS)
	# chmod u+s $@

# generic test program

test:	$(VOLATILE_RCILIBS)
test:  test.o testCtrl.o $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ test.o $(OU) CTRL testCtrl.o $(OC) $(CLIBS)
	# chmod u+s $@

# automatic RCI test program

rciCheck:	$(VOLATILE_RCILIBS)
rciCheck:  rciCheck.o rciCheckCtrl.o $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ rciCheck.o $(OU) CTRL rciCheckCtrl.o $(OC) $(CLIBS)
	# chmod u+s $@

# program to check the basic rci sample rate

rateTest:	$(VOLATILE_RCILIBS)
rateTest:  rateTest.o rateTestCtrl.o $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ rateTest.o $(OU) CTRL rateTestCtrl.o $(OC) $(CLIBS)
	# chmod u+s $@

# program to test allocation routines for shared and local memory
# on the arbiter and auxiliary CPUs

matest:	$(VOLATILE_RCILIBS)
matest:  remoteMemory.to  $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ remoteMemory.to $(OU) CTRL  $(OC) $(CLIBS)
	# chmod u+s $@

# program to test the aux Cpu boot routines

abtest:	$(VOLATILE_RCILIBS)
abtest:  auxBoot.to  $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ auxBoot.to $(OU) CTRL  $(OC) $(CLIBS)
	# chmod u+s $@

# program to test buddy allocator

batest:	$(VOLATILE_RCILIBS)
batest:  buddyAlloc.to  $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ buddyAlloc.to $(OU) CTRL  $(OC) $(CLIBS)
	# chmod u+s $@

# program to test first fit allocator

fatest:	$(VOLATILE_RCILIBS)
fatest:  firstAlloc.to  $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ firstAlloc.to $(OU) CTRL  $(OC) $(CLIBS)
	# chmod u+s $@

# program to test the mutex primitives

mxtest:	$(VOLATILE_RCILIBS)
mxtest:  mxtest.o mxtestCtrl.o $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ mxtest.o $(OU) CTRL mxtestCtrl.o $(OC) $(CLIBS)
	# chmod u+s $@

# program to test reading robot def file

rftest:	$(VOLATILE_RCILIBS)
rftest:  robotDefs.to  $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ robotDefs.to $(OU) CTRL  $(OC) $(CLIBS)
	# chmod u+s $@

# program to test reading paramter file

pftest:	$(VOLATILE_RCILIBS)
pftest:  parameterFile.to  $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ parameterFile.to $(OU) CTRL  $(OC) $(CLIBS)
	# chmod u+s $@

# program to test the wall clock

wctest:	$(VOLATILE_RCILIBS)
wctest:  wctest.o wctestCtrl.o $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ wctest.o $(OU) CTRL wctestCtrl.o $(OC) $(CLIBS)
	# chmod u+s $@

# program to control the slave clock device

sysclock:	$(VOLATILE_RCILIBS)
sysclock:  sysclock.o  $(OU) $(OC)
	$(RCC) $(CFLAGS) -o $@ sysclock.o $(OU) CTRL  $(OC) $(CLIBS)
	# chmod u+s $@

OTHERTESTPROGS = procs sgiPtest sgiGtest sgiXtest sgiProc rciCheck 		 rbtcom sysclock clock memory

clean::
	$(RMCMD) $(JUNKFILES) *.o *.to *.tO
	$(RMCMD) *test abortlog $(OTHERTESTPROGS)

depend::
	/bin/ls *.c | sed -e 's/.c$$/.s/' | xargs rm -f
	@if [ -f DependFile ] ; then \
	echo mv DependFile DependFile.BAK; \
	mv DependFile DependFile.BAK; else exit 0; fi
	$(CC) -MM -I$$RCCL/h $(C_INCS) $(C_DEFS)  *.c \
	> DependFile

DependFile:
include DependFile

vpath %.h ..
vpath %.c ..
vpath %.s ..
vxw:		$(LDIR)/vxw.o
$(LDIR)/vxw.o:
	(cd $(LDIR); $(MAKE) $(MFLAGS) vxw)

#=-=-=-=-=-=-=-=-=-=-=-=-= Imakefile ends here =-=-=-=-=-=-=-=-=-=-=-=-=-=

depend::

clean::

# XXX line used by make depend - DO NOT DELETE XXX

