#-----------------------------------------------------------------------------
#
# 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
#if !VxWorksConfig || !LinuxConfig
TEST := $(TEST)	matest batest fatest mxtest rftest pftest
#endif

testsuite:	$(TEST)

default:
	echo "make what?"

rciUserModule(rciCreate)
rciUserModule(loadtask)
rciUserModule(auxBoot)
rciUserModule(cpuAlloc)
rciUserModule(remoteMemory)
rciUserModule(arbMonitor)
rciUserModule(crashMessage)
rciUserModule(download)
rciUserModule(primitives)
rciUserModule(lockRobot)
rciUserModule(sigHandlers)
rciUserModule(rciGlobalMem)
rciUserModule(interruptRef)
rciUserModule(loadRobot)
rciUserModule(attachRobot)
rciUserModule(robotFile)
rciUserModule(robotDefs)
rciUserModule(parameterFile)
rciUserModule(parameterDefs)
rciUserModule(allocMem)
rciUserModule(sharedMemory)
rciUserModule(hashSetup)
rciUserModule(lockMemory)
#if SgiConfig
rciUserModule(hostFxns.SGI)
#endif
#if VxWorksConfig
rciUserModule(hostFxns.vxw)
#endif
#if LinuxConfig
rciUserModule(hostFxns.lin)
#endif
#if !SgiConfig && !VxWorksConfig && !LinuxConfig
rciUserModule(hostFxns)
#endif

rciCtrlModule(auxMonitor)
rciCtrlModule(auxShare)
rciCtrlModule(monitor)
rciCtrlModule(monitorSubs)
rciCtrlModule(message)
rciCtrlModule(mutex)
rciCtrlModule(rciAbort)
rciCtrlModule(rciErrorMsg)
rciCtrlModule(descriptor)
rciCtrlModule(getMemory)
rciCtrlModule(buddyAlloc)
rciCtrlModule(monitorCom)
rciCtrlModule(signalRef)
rciCtrlModule(accessMem)
rciCtrlModule(rciSetOptions)
rciCtrlModule(levelCheck)
rciCtrlModule(hashRef)
rciCtrlModule(locateMemory)
rciCtrlModule(firstAlloc)
rciCtrlModule(rciConfig)
rciCtrlModule(simSupport)
rciCtrlModule(sparcStubs)
#if SgiConfig
rciCtrlModule(supportFx.SGI)
rciCtrlModule(atomicOps.SGI)
rciCtrlModule(clockFxns.SGI)
rciCtrlModule(sgiCtrlTask)
#endif
#if LinuxConfig
rciCtrlModule(supportFx.lin)
rciCtrlModule(atomicOps.lin)
rciCtrlModule(clockFxns.lin)
rciCtrlModule(linCtrlTask)
#endif


#if VxWorksConfig
rciCtrlModule(supportFxns.vxw)
rciCtrlModule(atomicOps.vxw)
rciCtrlModule(clockFxns.vxw)
rciCtrlModule(hostExec.vxw)
rciCtrlModule(vxwCrash)
rciCtrlModule(vxwCtrlTask)
rciCtrlModuleDep(vxwIntrTask)
# we compile this explicitly because we can't use FPU in interupt
# level code, and the default CFLAGS has -f68881, which causes this
vxwIntrTask.o:  vxwIntrTask.c
	$(CC) -c -g $(C_INCS) $(C_DEFS) $<
#endif
#if !SgiConfig && !VxWorksConfig && !LinuxConfig
rciCtrlModule(supportFxns)
rciCtrlModule(atomicOps)
rciCtrlModule(clockFxns)
rciCtrlModule(hostExec)
#endif
#if !uVaxConfig && !VxWorksConfig && !LinuxConfig
rciCtrlModule(auxkernStubs)
#endif
#ifdef VaxArch
rciCtrlModuleDep(noticeBuf)
noticeBuf.o: noticeBuf.c
	$(CC) $(CFLAGS) -S noticeBuf.c; mv noticeBuf.s noticeBuf.S
	sed -f inline.sed < noticeBuf.S > noticeBuf.s
	$(RCC) $(CFLAGS) -c CTRL noticeBuf.s
	rm noticeBuf.S noticeBuf.s
#else
rciCtrlModule(noticeBuf)
#endif
rciCtrlModule(rciGetJls)

maintainRciUser(libs)
maintainRciCtrl(libs)
maintainVxwLibs(vxwRci,vxlibs)


#if !VxWorksConfig

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 $@

#endif

OU = 	
OC =	

# program to test the rci primitives
rccTestProgram (rcitest,rcitest.o,rcitestCtrl.o,)

# program to test the robot interface
rccTestProgram (rbttest,rbttest.o,rbttestCtrl.o,)

# program to test basic robot communication:
rccTestProgram (rbtcom,rbtcom.o,rbtcomCtrl.o,)

# program to test the object stuff
rccTestProgram (amtest,allocMem.to,accessMem.tO,)

# generic test program
rccTestProgram (test,test.o,testCtrl.o,)

# automatic RCI test program
rccTestProgram (rciCheck,rciCheck.o,rciCheckCtrl.o,)

#if !VxWorksConfig || !LinuxConfig

# program to check the basic rci sample rate
rccTestProgram (rateTest,rateTest.o,rateTestCtrl.o,)

# program to test allocation routines for shared and local memory
# on the arbiter and auxiliary CPUs
rccTestProgram (matest,remoteMemory.to,,)

# program to test the aux Cpu boot routines
rccTestProgram (abtest,auxBoot.to,,)

# program to test buddy allocator
rccTestProgram (batest,buddyAlloc.to,,)

# program to test first fit allocator
rccTestProgram (fatest,firstAlloc.to,,)

# program to test the mutex primitives
rccTestProgram (mxtest,mxtest.o,mxtestCtrl.o,)

# program to test reading robot def file
rccTestProgram (rftest,robotDefs.to,,)

# program to test reading paramter file
rccTestProgram (pftest,parameterFile.to,,)

# program to test the wall clock
rccTestProgram (wctest,wctest.o,wctestCtrl.o,)

# program to control the slave clock device
rccTestProgram (sysclock,sysclock.o,,)

#endif

#if SgiArch

basicProgram (sgiPtest,sgiPtest.o,)
basicProgram (sgiGtest,sgiGtest.o,)
basicProgram (sgiXtest,sgiXtest.o,)
basicProgram (sgiProc,sgiProc.o,)

#endif


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

makeClean(*test abortlog $(OTHERTESTPROGS) )
makeDepend()
maintainVxwSubdir()



