# $Id: Makefile,v 1.2 1995/03/03 10:25:30 deans Exp $

.SUFFIXES: .cdl .C

# SCO
# CPPFLAGS = -dbx -DSCO
# The -dbx overcomes a bug in the SCO cfront based CC to do with
# static constructors and multiple definitions in object files.

# SUNOS
# CPPFLAGS = -DSUNOS

# SOLARIS
# CPPFLAGS = -DSOLARIS

# The location of the Tcl public includes files (tcl.h)
TCL_PUBLIC	=

# The location of the Tcl private includes file (tclInt.h)
TCL_PRIVATE	=	$(TCL_PUBLIC)

# The location of the Tcl library (libtcl.a)
TCL_LIB		=	$(TCL_PUBLIC)

CPP		=
CPPFLAGS	= 

# Shouldn't require any more modifications
CPPINCLUDES	=	-I. \
			-I$(TCL_PUBLIC) \
			-I$(TCL_PRIVATE)
CDL		=	cdl
AR		=	ar
RANLIB		=	ranlib

.C.o:
			$(CPP) $(CPPFLAGS) $(CPPINCLUDES) -c $<
.cdl.o:
			$(CDL) $< $*.C
			$(CPP) $(CPPFLAGS) $(CPPINCLUDES) -c $*.C
			rm $*.C

LIB_OBJECTS	=	Otcl.o \
			OtclClass.o \
			OtclMethod.o \
			OtclAttribute.o \
			OtclObjMgr.o \
			OtclObject.o \
			OtclPart.o \
			OtclFormalArg.o

TCLSH_OBJECTS	=	tclAppInit.o \
			tclMain.o

TSH_OBJECTS	=	Test.o \
			Test_cdl.o \
			tclMain.o \
			tclAppInit.o

CDL_OBJECTS	=	CdlFile.o \
			CdlItem.o \
			CdlArg.o \
			CdlRtn.o \
			CdlMethod.o \
			cdlMain.o

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

all:		libotcl.a cdl tclsh tsh

libotcl.a:	$(LIB_OBJECTS)
		rm -f libotcl.a
		$(AR) cr libotcl.a $(LIB_OBJECTS)
		$(RANLIB) libotcl.a

tclsh:		libotcl.a $(TCLSH_OBJECTS)
		$(CPP) $(CPPFLAGS) $(CPPINCLUDES) -o tclsh $(TCLSH_OBJECTS) \
			libotcl.a $(TCL_LIBS)

tsh:		libotcl.a $(CDL) $(TSH_OBJECTS)
		$(CPP) $(CPPFLAGS) $(CPPINCLUDES) -o tsh $(TSH_OBJECTS) \
			libotcl.a $(TCL_LIBS)

cdl:		$(CDL_OBJECTS)
		$(CPP) $(CPPFLAGS) $(CPPINCLUDES) -o cdl $(CDL_OBJECTS) \
			$(TCL_LIBS)
clean:
		rm -f *.o libotcl.a tclsh tsh cdl core *..dbx *_cdl.C
