## Makefile.am for java code -*-Makefile-*-
## Author: Tommy Reilly <tpr@neog.com>
## Author: Vadim Tkachenko <vt@freehold.crocodile.org>
## $Id: Makefile.am,v 1.23 2000/03/15 20:02:09 admin Exp $

SUBDIRS = org

ARCHIVE = $(PACKAGE).jar
jardir = ${libexecdir}
jar_DATA=${ARCHIVE}

# VT: NOTE: This is not going to be as bad as in ECS because the findstring
# doesn't contain complicated conditions

FINDSTRING = -name "*.class"
ECHO = @ECHO@
JAR = @JAR@
JAR_SIGNER = @JAR_SIGNER@
JARSIGNER = @JARSIGNER@
TEST = @TEST@
SED = @SED@

EXTRA_DIST = .deps deps.sh jdeps jdeps.jar ApacheJServ.jar

#information from JavaDeps
include .deps


if MAINTAINER_BUILD
.deps: Makefile
	./deps.sh
endif

clean-generic:
	${RM} -f *~ sources
	
.PHONY: ${ARCHIVE}

${ARCHIVE}:
	@ if ${TEST} ! -f "${ARCHIVE}" || ${TEST} -n "`${FIND} . \( ${FINDSTRING} \) -newer "${ARCHIVE}"`"; then \
		${RM} -f ${ARCHIVE}; \
		echo "Creating ${ARCHIVE}..."; \
		${JAR} -cf ${ARCHIVE} `${FIND} . \( ${FINDSTRING} \) -print|${SED} -e "s@^./@@"`; \
		if ${TEST} -n "${JAR_SIGNER}"; then \
			echo "Signing the archive"; \
			${JARSIGNER} ${ARCHIVE} ${JAR_SIGNER}; \
		fi; \
	else \
		echo "${ARCHIVE}: up to date"; \
	fi

