
LTLIBRARY_NAME = libsapi.la
LTLIBRARY_SOURCES = servlet.c java.c
LTLIBRARY_DEPENDENCIES = phpsrvlt.jar

EXTRA_CFLAGS = $(JAVA_CFLAGS)
EXTRA_INCLUDES = $(JAVA_INCLUDE)

include $(top_srcdir)/build/ltlib.mk

java.c : ../../ext/java/java.c
	@cp ../../ext/java/java.c .

phpsrvlt.jar : servlet.java ../../ext/java/reflect.java
	$(mkinstalldirs) net/php
	@echo library=php4>net/php/reflect.properties
	@echo library=php4>net/php/servlet.properties
	@cp formatter.java net/php
	@cp servlet.java net/php
	@cp ../../ext/java/reflect.java net/php
	javac net/php/reflect.java
	@test ! -f reflect.class || mv reflect.class net/php # bug in KJC javac
	javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH) net/php/servlet.java
	@test ! -f servlet.class || mv servlet.class net/php # bug in KJC javac
	javac -classpath .:$(SERVLET_CLASSPATH):$(CLASSPATH) net/php/formatter.java
	@test ! -f formatter.class || mv formatter.class net/php # bug in KJC javac
	$(JAVA_JAR) phpsrvlt.jar net/php/*.class net/php/*.properties
	@rm net/php/servlet.* net/php/reflect.* net/php/formatter.*
	@rmdir net/php
	@rmdir net
