# 
#  Makefile for the Freenet java reference implementation 
#  written by PiXeLpApst
#  (C) by the Freenet project, GPL v2 applies
#

defaultrule: info

#
# Some settings
#
CLASSPATH:=$(dir $(shell pwd)):$(CLASSPATH)

SUBDIRS = client crypt handshake message support


#
# Compilations rules
#
.PHONY: defaultrule info node cli gui clean

.SUFFIXES: .java .class

# generic rule
.java.class:
	javac $^

# Build the node:
node: Node.class

# Build the Freenet command-line clients:
cli client: client/InsertClient.class client/RequestClient.class

# Build the Freenet swigg client:
gui: client/GUI.class

# Clean up all class files:
clean:
	-rm -f *.class $(addsuffix /*.class,$(SUBDIRS))
	-rm -f *~

# Print out some nice usage information:
info:
	@echo "You can compile the following targets:"
	@echo "  make node  - compiles the freenet node"
	@echo "  make cli   - compiles the command line interface client (simple debug-tool) "
	@echo "  make gui   - compiles the GUI client (requires JDK 1.2)"
	@echo "  make clean - remove all the .class files"
	@echo ""

#
# Warning ! 
# ---------
# In the current version the Makefile does not automatically recompile any
# classes that have changed since the last compilation ! This is because
# the dependency lists are yet to be written. For the Makefile to be useful,
# you'll need to make clean / make node after every change ! I hope i can set
# up the dependencies soon, if one of the java programmers helps me.
#
# The original build script recompiles like this:
#   javac *.java support/*.java message/*.java crypt/*.java
# which is too simple approach IMHO, since it will always recompile all.
# (Well i admit right now the Makefile does the same :)
#
