#-----------------------------------------------------------------------------
#
# make arc 	- creates a version of arc, in this directory, that does
#		  not have built in robot kinematic functions.
# make arc.rbt  - creates a version of arc, in this directory, that does
#		  have built in kinematic functions for specific robots
#		  which are known to RCCL/RCI.
#
# make install	- puts a copy of arc.rbt into ../bin/arc
#
#-----------------------------------------------------------------------------

CFLAGS = $(RCC_CFLAGS) -O

GENOBJS = 	arc.o doubleOp.o integerOp.o matrixFunc.o scalarFunc.o \
		input.o output.o error.o fileIO.o symtable.o \
		matrixAlloc.o matrixLib.o talloc.o \
		transFunc.o transLib.o actions.o gtype.o \
		helpFileName.o invert.o

RBTLIBS = 	$(LUSER) $(LCTRL) $(LUSER) $(LCTRL) $(LAUXK) $(LLIBC)

#if HasFortran
ARC_LIBS = $(FLIBS) $(LLIBC) -lm
ARCRBT_LIBS = $(FLIBS) $(RBTLIBS) -lm
#else
ARC_LIBS = $(LLIBC) -lm
ARCRBT_LIBS = $(RBTLIBS) -lm
#endif

ARC_OBJS = $(GENOBJS) function.o
ARCRBT_OBJS = $(GENOBJS) function.ro robots.o

basicProgram(arc,$(ARC_OBJS),$(ARC_LIBS))

basicProgram(arc.rbt,$(ARCRBT_OBJS),$(ARCRBT_LIBS))

utilityProgram(arc,$(ARCRBT_OBJS),$(ARCRBT_LIBS))
utilityManPage(../man/man1/arc.1,arc.1)

shadowModule(function.ro,function,-DROBOTS)

arc.o:		lex.yy.c y.tab.c
		$(CC) $(CFLAGS) y.tab.c -c
		mv y.tab.o arc.o

y.tab.c:	arc.y
		bison arc.y
		mv arc.tab.c y.tab.c
	
lex.yy.c:	arc_lex.l
		flex -l  arc_lex.l

#if HasFortran
invert.o:	invert.f
		echo fortran available
		$(FCMD) -c invert.f
basicModule(matrixLib)
#else
basicModule(invert)
matrixLib.o:	matrixLib.c
		$(CC) -c $(CFLAGS) -DNOFORTRAN matrixLib.c
#endif

maintainUtils(install)

makeClean(*.ro y.tab.c lex.yy.c arc arc.rbt)

makeDepend()
