#------------------------------------------------------------------------------
# Configuration options.
#------------------------------------------------------------------------------

# Built Source directory for Tcl relative to this directory or root.  Otcl
# currently works with either Tcl 7.3 or Tcl 7.4b3.  This define maybe omitted
# if the other TCL_* defines below are explictly set to the installed
# locations.
TCL_DIR         =       ../../../tcl7.4b3

# The location of the Tcl public includes files (tcl.h)
TCL_INCLDIR	= 	${TCL_DIR}

# The location of the Tcl private includes file (tclInt.h)
TCL_SRCDIR	= 	${TCL_DIR}

# The location of the Tcl library (libtcl.a)
TCL_LIBDIR	= 	${TCL_DIR}

OTCL_INCLDIR	=	../..

OTCL_LIBS	=	../../tclAppInit.o ../../libotcl.a

CXX		= 	c++
CXXFLAGS	=	-g -O

#------------------------------------------------------------------------------
# Other definitions.
#------------------------------------------------------------------------------

CXXINCLUDES	= 	-I. \
		  	-I$(TCL_INCLDIR) \
		  	-I$(TCL_SRCDIR) \
			-I$(OTCL_INCLDIR)

CDL		= 	../../cdl

EXAMPLE_OBJECTS	=	A.o \
			A_cdl.o

EXAMPLE_HEADERS	=	A_cdl.H

TCL_LIBS	=	-L$(TCL_LIBDIR) -ltcl -lm

.SUFFIXES: .cdl .H .C

.C.o:
			$(CXX) $(CXXFLAGS) $(CXXINCLUDES) -c $<
.cdl.o:
			$(CDL) -s $< $*.C
			$(CXX) $(CXXFLAGS) $(CXXINCLUDES) -c $*.C
			rm $*.C

.cdl.H:
			$(CDL) -h $< $*.H

#------------------------------------------------------------------------------
# Rules.
#------------------------------------------------------------------------------

all:		examplesh

examplesh:	$(EXAMPLE_HEADERS) $(EXAMPLE_OBJECTS)
		$(CXX) $(CXXFLAGS) $(CXXINCLUDES) $(LDFLAGS) -o examplesh \
			 $(EXAMPLE_OBJECTS) $(OTCL_LIBS) $(TCL_LIBS)
clean:
		rm -f *.o examplesh core *..dbx *_cdl.C \
		*_cdl.H
