# Makefile
# $Id: Makefile,v 1.2 1996/05/30 16:04:32 abaird Exp $
# This makefile should build the libShuffle.o along with the shuffler process.
# This package is not required in order to run the jigsaw serverm however, you
# should use it whenever possible, if you want to speed up the delivery
# of data back to clients.
# It has only been built on solaris >= 2.3

# Your compiler setting
      CC = gcc

# Where is your java distribution ?
# Enter here, the directory in which you unfold the JDK tar file.

    JAVA = /afs/w3.org/usr/abaird/WWW-abaird/Java/java

# Where did you compile the Jigsaw java sources ?
# Enter the directory in which you have compiled the Jigsaw server sources.

  JIGSAW = /afs/w3.org/usr/abaird/WWW-abaird/WWW/Jigsaw/src/classes

# ***** Don't edit below this line *****

    JINC = -I$(JAVA)/include -I$(JAVA)/include/solaris
  CFLAGS = $(JINC) -fpic -O

all: libShuffle.so libShuffle_g.so shuffler

# Building the stubs:

       STUBS = w3c_jigsaw_http_Shuffler.h w3c_jigsaw_http_Shuffler.c

  CLASSESDEP = $(JIGSAW)/w3c/jigsaw/http/Shuffler.java 

     CLASSES = w3c.jigsaw.http.Shuffler \
		w3c.jigsaw.http.ShuffleMessage \
		w3c.jigsaw.http.ShuffleHandler

stubs: $(STUBS) 

w3c_jigsaw_http_Shuffler.h: $(CLASSESDEP)
	javah -o w3c_jigsaw_http_Shuffler.h $(CLASSES)

w3c_jigsaw_http_Shuffler.c: $(CLASSESDEP)
	javah -o w3c_jigsaw_http_Shuffler.c -stubs $(CLASSES)

# Building the library (to be dynamilly linked into the Java runtime)

SHUFFLELIB_OBJS = shuffle.o \
	w3c_jigsaw_http_Shuffler.o \
	ShufflerProtocol.o 

libShuffle.so: stubs $(SHUFFLELIB_OBJS) 
	ld -r -o libShuffle.so $(SHUFFLELIB_OBJS)

libShuffle_g.so: libShuffle.so
	cp libShuffle.so libShuffle_g.so

SHUFFLER_OBJS = shuffler.o \
	ShufflerProtocol.o 

# Building the shuffler server
	
shuffler: $(SHUFFLER_OBJS) ShufflerProtocol.h 
	$(CC) $(CFLAGS) -o shuffler $(SHUFFLER_OBJS) -lnsl -lsocket -lthread

# Clean the world

clean:
	rm -f shuffler $(SHUFFLER_OBJS) $(SHUFFLELIB_OBJS) $(STUBS) *~ \
		libShuffle.so libShuffle_g.so
