#
# This file is the make file for the tcljava demonstration program.
# 

# Where's the root of the java distribution?
# example: /usr/local/src/java1.0

JAVAHOME=/proj/tcl/ws/java1.0


# Where's the root of the tcl distribution?
# example: /usr/local/src/tcl7.5b2

TCLHOME=/home/kcorey/hack/tcl7.7


# Where's the root of the tk distribution?
# example: /usr/local/src/tk4.1b2

TKHOME=/home/kcorey/hack/tk4.3


# What're the library names to include?
# library example: -ltk4.1 -ltcl7.5

LIBS = -ltk4.3 -ltcl7.7 -lX11 -lm


# What's the java compiler binary?

JAVAC = $(JAVAHOME)/bin/javac


# What's the java header program?

JAVAH = $(JAVAHOME)/bin/javah

CC = cc


# What's the object code suffix on this machine?

SFX = .o


# What's the shared library suffix on this machine?

SHLIBSFX = .so

# If you're using a version of Tk earlier than 4.1b1, you'll 
# need to uncomment this line

# OLDFLAGS += -DCREATEMAINWINDOWHACK

# What flags to compile the C code with?

CFLAGS = -g $(INCLUDE) -G $(OLDFLAGS)

# If your compiler supports the -Rpath argument to the linker
# (solaris does) uncomment these lines. You won't need these if
# you're going to link this statically.
RPATH = \
	-R$(TCLHOME)/unix \
	-R$(TKHOME)/unix

# This provides a workaround for the 'exec' bug.  It's a brain-dead
# replacement for the 'exec' command.  It's basically a 'system("cmd string");'
# and nothing more. Probably only works under Unix, but maybe Dos?

TCLEXECFIX = 1

##################### You shouldn't need to change things below here

.SUFFIXES: .java .class $(SUFFIXES)

LIBPATH = \
	-L$(TCLHOME)/unix \
	-L$(TKHOME)/unix \
	-L$(TCLHOME) \
	-L$(TKHOME)

CLASSES.tcl = \
	tcl.Command \
	tcl.Interp \
	tcl.Result \
	tcl.Value \
	tcl.TkApplication

FILES.java = \
        tcl/Command.java \
        tcl/Interp.java \
        tcl/Result.java \
        tcl/Value.java \
        tcl/TkApplication.java

FILES.class = \
        tcl/Command.class \
        tcl/Interp.class \
        tcl/Result.class \
        tcl/Value.class \
        tcl/TkApplication.class

OBJS = tcl_classes$(SFX) tclJava$(SFX) tkJava$(SFX)

LIBJTK = libjtk$(SHLIBSFX)

INCLUDE = \
	-I$(JAVAHOME)/include \
	-I$(JAVAHOME)/include/solaris \
	-I$(TCLHOME)/generic \
	-I$(TKHOME)/generic \
	-I$(TCLHOME) \
	-I$(TKHOME)

all: $(LIBJTK) TclTest.class

.java.class:
	$(JAVAC) $<

tcl_classes.c: $(FILES.class)
	$(JAVAH) -o tcl_classes.c -stubs $(CLASSES.tcl)

tcl_classes.h: $(FILES.class)
	$(JAVAH) -o tcl_classes.h $(CLASSES.tcl)


TclTest.java: $(LIBJTK)

$(LIBJTK): $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o $(LIBJTK) $(RPATH) $(LIBPATH) $(LIBS)

clean:
	rm -f tcl_* *.class *$(SFX) $(LIBJTK) tcl/*.class *~ doc/*~ tcl/*~

tclJava.c: tcl_classes.h
tkJava.c: tcl_classes.h
