axiom_c_runtime_extra = @axiom_c_runtime_extra@

# local include files shared by graphics
LINC=	$(axiom_src_srcdir)/graph/include

# global include files shared by everyone 
GINC=	$(axiom_src_srcdir)/include

build_libdir = $(abs_top_builddir)/src/lib

bin_PROGRAMS = viewman$(EXEEXT)

viewman_sources = cleanup.c fun2D.c fun3D.c make2D.c make3D.c \
		makeGraph.c readView.c sselect.c viewman.c

viewman_objects = $(viewman_sources:.c=.$(OBJEXT))

viewman_headers = $(srcdir)/viewman.h \
		$(addprefix $(axiom_src_srcdir)/graph/include/,\
			component.h view2D.h view3D.h tube.h \
			actions.h viewCommand.h) \
		$(axiom_src_srcdir)/include/com.h


viewman_DEPENDENCIES = $(build_libdir)/libspad.a
viewman_LDFLAGS = -L$(build_libdir) -lspad $(axiom_c_runtime_extra)

subdir = src/graph/viewman/

AXIOM_CFLAGS = ${CCF} ${AXIOM_X11_CFLAGS} -I${LINC} -I${GINC} -I$(srcdir) \
			$(axiom_includes)

.PHONY: all all-ax all-viewman
all: all-ax

all-ax all-viewman: stamp
	@ echo 30 finished $(srcdir)

stamp: $(axiom_target_libdir)/viewman$(EXEEXT)
	-rm -f stamp
	$(STAMP) stamp


.PRECIOUS: %.$(OBJEXT)

%.$(OBJEXT): $(viewman_HEADERS)

%.$(OBJEXT): $(srcdir)/%.c $(axiom_c_macros_h)
	$(CC) $(CFLAGS) $(AXIOM_CFLAGS) -c -o $@ $<

$(axiom_target_libdir)/viewman$(EXEEXT): $(viewman_objects) $(viewman_DEPENDENCIES)
	${CC} $(viewman_objects) -o $@ $(viewman_LDFLAGS) \
		$(AXIOM_X11_LDFLAGS)

mostlyclean-local:
	-rm -f $(viewman_objects)
	-rm -f stamp

clean-local: mostlyclean-local
	-rm -f $(axiom_target_libdir)/viewman$(EXEEXT)

distclean-local: clean-local

