# Generated automatically from Makefile.in by configure.

#
# try ./configure first to fill in all the definitions corresponding
# to your system, but you always can edit the sections below manually.
#

CC=		gcc
CFLAGS=		-g -O2
RANLIB= 	ranlib
INSTALL=	/usr/bin/install -c

#
# how to compile, link, and name shared libraries
#

SHLIB_LD=	ld -Bshareable
SHLIB_CFLAGS=	-fpic
SHLIB_SUFFIX=	.so
SHLD_FLAGS=	
DL_LIBS=	

SHLIB_LD_LIBS  = @SHLIB_LD_LIBS@

#
# where to install shells, libraries, and includes
#

INST_OTCLSH=	/usr/local/bin
INST_OWISH=	/usr/local/bin
INST_OLIB=	/usr/local/lib
INST_OLIBSH=	/usr/local/lib
INST_OINC=	/usr/local/include


#
# ------------ you shouldn't need to configure below here -----------------
#

INCLUDES = \
	-I. \
	-I../tkbox/include -I../tclbox/include  \
	-I/usr/X11R6/include \
	-I${prefix}/include \
	

DEFINES = \
	 -DNDEBUG -DUSE_SHM

LIB =	-L../tkbox/lib -ltk80 -L../tclbox/lib -ltcl80  \
	-L/usr/X11R6/lib -lXext -lX11  -lm

OTCLLIB= -L. -lotcl

.c.o:
	$(CC) -c $(CFLAGS) $(DEFINES) $(INCLUDES) $<

all: libotcl.a libotcl$(SHLIB_SUFFIX)	# otclsh owish

#
# compile an appinit with tcl and otcl and link against
# libotcl.a plus required tcl libs to give a standalone binary
#

otclsh: otclAppInit.c libotcl.a
	rm -f libotcl$(SHLIB_SUFFIX)
	$(CC) -o otclsh $(SHLD_FLAGS) $(CFLAGS) $(INCLUDES) otclAppInit.c \
	$(OTCLLIB) $(LIB)

#
# compile an appinit with tcl/tk and otcl and link against
# libotcl.a plus required tcl/tk libs to give a standalone binary
#

owish: otkAppInit.c libotcl.a
	rm -f libotcl$(SHLIB_SUFFIX)
	$(CC) -o owish $(SHLD_FLAGS) $(CFLAGS) $(INCLUDES) otkAppInit.c \
	$(OTCLLIB) $(LIB)

#
# compile otcl.c and link it into a library archive
# INCLUDES give a path to tclInt.h (plus tk and X11)
#

libotcl.a: otcl.c
	rm -f libotcl.a otcl.o
	$(CC) -c $(CFLAGS) $(DEFINES) $(INCLUDES) otcl.c
	ar cq libotcl.a otcl.o
	$(RANLIB) libotcl.a

#
# compile otcl.c and link it into a shared object
# INCLUDES give a path to tclInt.h (plus tk and X11)
#

libotcl$(SHLIB_SUFFIX): otcl.c
	rm -f libotcl$(SHLIB_SUFFIX) otcl.o so_locations
	$(CC) -c $(CFLAGS) $(DEFINES) $(SHLIB_CFLAGS) $(INCLUDES) otcl.c
	$(SHLIB_LD) -o libotcl$(SHLIB_SUFFIX) otcl.o

test: otclsh owish
	./otclsh lib/test.tcl
	./owish lib/test.tcl

install: owish otclsh libotcl.a libotcl$(SHLIB_SUFFIX) otcl.h
	$(INSTALL) owish $(INST_OWISH)
	$(INSTALL) otclsh $(INST_OTCLSH)
	$(INSTALL) libotcl.a $(INST_OLIB)
	$(INSTALL) libotcl$(SHLIB_SUFFIX) $(INST_OLIBSH)
	$(INSTALL) otcl.h $(INST_OINC)

clean:
	rm -f owish otclsh libotcl.a libotcl$(SHLIB_SUFFIX) \
	otcl.o otkAppInit.o otclAppInit.o \
	config.status config.log config.cache \
	core so_locations

binclean:
	rm -f otcl.o otkAppInit.o otclAppInit.o \
	config.status config.log config.cache \
	core so_locations

srctar:
	@cwd=`pwd` ; dir=`basename $$cwd` ; \
	    name=otcl-`cat VERSION | tr A-Z a-z` ; \
	    tar=otcl-`cat VERSION`.tar.gz ; \
	    list="" ; \
	    for i in `cat FILES` ; do list="$$list $$name/$$i" ; done; \
	    echo \
	    "(rm -f $$tar; cd .. ; ln -s $$dir $$name)" ; \
	     (rm -f $$tar; cd .. ; ln -s $$dir $$name) ; \
	    echo \
	    "(cd .. ; tar cfh $$tar [lots of files])" ; \
	     (cd .. ; tar cfh - $$list) | gzip -c > $$tar ; \
	    echo \
	    "rm ../$$name; chmod 444 $$tar" ;  \
	     rm ../$$name; chmod 444 $$tar

