CFLAGS = $(RCC_CFLAGS) $(GOPTS) -g

SIMOBJS = hostIO.o \
	  specialIO.o \
	  genericIO.o \
	  manipIO.o \
	  manipSim.o \
	  rbtControl.o \
	  display.o \
	  simFxns.o \
	  robotsim.o \
	  linkedList.o \
	  configFile.o

GOBJS :=  grf4.o grf4GenDraw.o grf4GenObject.o hidden.o \
	  grf4Sunview.o grf4Gl.o grf4Glwf.o grf4X11.o
RBTGO :=  rbtStan.o rbtElbow.o rbtPuma.o rbtGraphics.o

#if HasSunView
GLIBS := $(GLIBS) -lsuntool -lsunwindow -lpixrect
GOPTS := $(GOPTS) -DSUNVIEW_GRAPHICS
#endif

#ifdef HasGLGraphics
GOBJS := $(GOBJS) grf4GlObject.o
GLIBS := $(GLIBS) GLLibSpec
GOPTS := $(GOPTS) -DGL_GRAPHICS
#ifdef GLIncDir
GOPTS := $(GOPTS) -I$(EMPTY)GLIncDir
#endif
#endif

#ifdef HasX11Lib
GLIBS := $(GLIBS) X11LibSpec -ldl
GOPTS := $(GOPTS) -DX11_GRAPHICS -D$(EMPTY)HasX11Lib
#ifdef X11IncDir
GOPTS := $(GOPTS) -I$(EMPTY)X11IncDir
#endif
#endif

/* we shouldn't have to do the libs this way, but loader isn't very smart */
#ifdef AixArch
RCCLIBS = $(LUSER) $(LCTRL) ../lib/begin.o ../lib/end.o
#else
RCCLIBS =  $(LCTRL) $(LUSER) $(LCTRL) $(LAUXK)
#endif

#if HasSunView
grf4Sunview.o:	grf4Sunview.c
		$(CC) $(RCC_CFLAGS) -DSUNVIEW_GRAPHICS -c grf4Sunview.c
#endif

basicProgram(poly,polytest.o $(GOBJS) grf4Support.o chull.o,$(LLIBC) $(GLIBS) -lm)

basicProgram(robotsim,$(SIMOBJS) $(GOBJS) $(RBTGO) $(RCCLIBS), \
		       $(LCTREE) $(GLIBS) $(LLIBC) -lm)
utilityProgram(robotsim,$(SIMOBJS) $(GOBJS) $(RBTGO) \
		$(RCCLIBS),$(LCTREE) $(GLIBS) $(LLIBC) -lm)

# various testing programs ...

basicProgram(grf4Test,grf4Test.o grf4Support.o $(GOBJS),$(LLIBC) $(GLIBS) -lm)
basicProgram(vclip,vclip.o grf4Support.o $(GOBJS),$(GLIBS) -lm)

# utility programs ...

basicProgram(RCISimMuxd,RCISimMuxd.o,)
utilityProgram(RCISimMuxd,RCISimMuxd.o,)

rccTestProgram(testhostIO,testhostIO.o hostIO.o,,)

maintainUtils(install)

makeClean(robotsim testhostIO RCISimMuxd poly grf4Test)
makeDepend($(GOPTS))

