# JRI 0.2   (C) Simon Urbanek
# This is the actual Makefile - all autconf'ed values should
# be passed as vars, because we also want to use this for
# the Windows build that has no autoconf
#
# Note: the dependencies are often across directories mainly
# for historical reasons. The Java sources are actually compiled
# by the Makefile in the src directory, although they are here,
# because they originally belonged to src.

EX_JAVA=$(wildcard examples/*.java)
EX_CLASS=$(EX_JAVA:%.java=%.class)

JFLAGS+=-target 1.4 -source 1.4

TARGETS=src/JRI.jar $(JRILIB) $(EX_CLASS)

all: $(TARGETS)

src/JRI.jar:
	$(MAKE) -C src JRI.jar

src/${JRILIB}:
	$(MAKE) -C src $(JRILIB)

$(JRILIB): src/$(JRILIB)
	rm -f $@
	cp $< $@

examples/%.class: examples/%.java src/JRI.jar
	$(JAVAC) $(JFLAGS) -classpath src/JRI.jar -d examples $<

clean:
	$(MAKE) -C src clean
	rm -rf $(TARGETS) *~ examples/*.class

examples: $(EX_CLASS)

JRI_JDOCSRC=$(wildcard *.java)

doc:	$(JRI_JDOCSRC)
	rm -rf JavaDoc
	mkdir JavaDoc
	$(JAVA)doc -d JavaDoc -author -version -breakiterator -link http://java.sun.com/j2se/1.4.2/docs/api $^

.PHONY: clean all examples doc

