#-----------------------------------------------------------------------------
#
# make <rbtname>	- build the "moper" program for a particular robot.
#
# make <prog>		- build a test program for loading into the LSI-11
#
#-----------------------------------------------------------------------------

CC11 = ../Xcompile/bin/cc11
LD11 = ../Xcompile/bin/ld11
CC11FLAGS = -O
CC11LIBS = ../Xcompile/lib/libc.a

SYS =	locore.o exit.o kernel.o serialDev.o

#define pdp11Program(prog,deps)prog:  deps $(SYS)			@@\
	$(LD11) -T 010000 -o prog $(SYS) deps $(CC11LIBS)		@@\

.c.o:	;	$(CC11) $(CC11FLAGS) -c $*.c
.s.o:	;	$(CC11) $(CC11FLAGS) -cppAsm -c $*.s

install:	puma560

MOPER =		moperx.o rbtControl.o sensorIO.o puma.o

pdp11Program(goldenChild,$(MOPER) goldenChild.o drv11.o)
pdp11Program(golden.xy2d,$(MOPER) goldenChild.o drv11.xy2d.o)
pdp11Program(frank,$(MOPER) frank.o drv11.o)
pdp11Program(frank.xy2d,$(MOPER) frank.o drv11.xy2d.o)
pdp11Program(puma760,$(MOPER) puma760.o drv11.o)
pdp11Program(puma560,$(MOPER) puma560.o drv11.o)
pdp11Program(puma260,$(MOPER) puma260.o drv11.o)

pdp11Program(drivertest,drivertest.o drv11.o)
pdp11Program(interrupt,interrupt.o)
pdp11Program(test,test.o)
pdp11Program(dumpRam,dumpRam.o)
pdp11Program(pendantTest,pendantTest.o)
pdp11Program(adc,adc.o)

clean::
	rm -f *.o *.BAK
	rm -f puma260 puma560 puma760 frank goldenChild
	rm -f testhostIO drivertest interrupt dumpRam

#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

#if 0
depend::
	cp Makefile Makefile.BAK
	( echo '/^# XXX line used by make depend/,$$c' ; \
  	  echo '# XXX line used by make depend - DO NOT DELETE XXX' ; \
  	  echo '' ; \
  	  MakeDependCmd -I$$RCCL/h -I$(IDIR) *.c | PackDependCmd | \
		sed 's/.o:/.s:/' ; \
  	  echo . ; \
  	  echo w ; \
  	  echo q ) | ed - Makefile
#else
depend::
	@if [ -f DependFile ] ; then \
	   echo mv DependFile DependFile.BAK; \
	   mv DependFile DependFile.BAK; else exit 0; fi
	   $(CC11) -M *.[cs] | PackDependCmd > DependFile

DependFile:
include DependFile
#endif
