# DeatByCaptcha makefile for java examples
# run make on the folder to compile the examples
# to run an example do examples.<ExampleName>
# ie: java examples.ExampleFuncaptcha
# fill credentials and parameteres before compile

JAVAC = javac
JAR = jar
JAVADOC = javadoc

NAME = DeathByCaptcha

OPT_SRC = org/*/*.java
LIB_SRC = com/$(NAME)/*.java
EXAMPLES_SRC = examples/Example*.java

all: clean lib jar doc exampleclients jenkins package


clean:
	find . -type f -name \*.class -delete
	find . -type f -name \*.jar -delete
	-rm -rf doc/
	-rm -f dbc_api_java.zip

.PHONY: lib
lib:
	$(JAVAC) $(OPT_SRC) $(LIB_SRC)

.PHONY: jar
jar: lib
	mkdir -p jar
	$(JAR) cf jar/org.base64.jar org/base64/*.class
	$(JAR) cf jar/org.json.jar org/json/*.class
	$(JAR) cf jar/com.DeathByCaptcha.jar com/DeathByCaptcha/*.class

.PHONY: doc
doc:
	$(JAVADOC) -public -d doc $(LIB_SRC)

exampleclients:
	$(JAVAC) $(EXAMPLES_SRC)

jenkins:
	$(JAVAC) ExampleGetBalance.java

package:
	zip -9rX dbc_api_java.zip $(OPT_SRC) $(LIB_SRC) $(EXAMPLES_SRC) jar/*.jar Makefile doc readme.html -x \*/.svn/\*
