JAVA = @JAVA@
JAVAC = @JAVAC@
JAVACFLAGS = @JAVACFLAGS@

GSDL_DIR  = ../../..

OBJECTS   = JdbmAPI.class Jdb2Txt.class Txt2Jdb.class JdbGet.class \
            JdbSet.class JdbDel.class JdbKeys.class


JDBM_JAR  = ../../packages/jdbm/jdbm-1.0/dist/jdbm-1.0.jar

all: JDBMWrapper.jar
	@echo "Done"

JDBMWrapper.jar: $(OBJECTS)
	jar cvf JDBMWrapper.jar $(OBJECTS)

install: all
	/bin/cp JDBMWrapper.jar $(GSDL_DIR)/bin/java

%.class: %.java
ifeq ($(GSDLOS),windows)
# for cygwin with a native Windows java compiler
	$(JAVAC) $(JAVACFLAGS) -classpath "$(JDBM_JAR);." $<
else
	$(JAVAC) $(JAVACFLAGS) -classpath $(JDBM_JAR):. $<
endif

clean:
	/bin/rm -f *.class test.lg test.jdb

distclean: clean
	/bin/rm -f JDBMWrapper.jar

test-api:
	$(JAVA) -classpath $(JDBM_JAR):JDBMWrapper.jar JdbmAPI test
