## Process this with automake to create Makefile.in

include $(top_srcdir)/Make-rules

java_FUTURE = \
  ParsedXMLPrinter.java \
  MakeTreeNode.java \
  TreeNode.java \
  SimpleFilter.java \
  XMLConsumer.java

java_sources = \
  NamedChildrenFilter.java \
  NamespaceBinding.java \
  NodeTree.java \
  SName.java \
  XMLPrinter.java \
  XName.java \
  ParsedXMLToConsumer.java

java_BUILT = \
  ParsedXMLHandler.java \
  ParsedXMLHandlerByte.java \
  XMLParserChar.java \
  XMLParserByte.java

BUILT_SOURCES = $(java_BUILT)
EXTRA_DIST = package.html \
  XMLParser.java.in ParsedXMLHandler.java.in

# Used when pre-processing a file using sed.
DONT_EDIT_SUBS = -e '1s|//.*-Java-.*|// Automatically generated file - DO NOT EDIT!.  -*- buffer-read-only: t -*-|'

FROM_XMLParser = $(DONT_EDIT_SUBS) \
  -e '1s|//.*-Java-.*|// This file is automatically generated from XMLParser.java.in.|'
FROM_ParsedXMLHandler = $(DONT_EDIT_SUBS) \
  -e '1s|//.*-Java-.*|// This file is automatically generated from ParsedXMLHandler.java.in - DO NOT EDIT!|'
BYTE_SUBS = -e 's|@CHAR@|byte|g' -e 's|@XMLParser@|XMLParserByte|g' \
  -e 's|@ParsedXMLHandler@|ParsedXMLHandlerByte|g' \
  -e '/@if CHAR is char@/,/@endif CHAR is char@/d' \
  -e '/@*if CHAR is byte@/d'
CHAR_SUBS = -e 's|@CHAR@|char|g' \
  -e 's|@XMLParser@|XMLParserChar|g'  -e 's|@ParsedXMLHandler@|ParsedXMLHandler|g'\
  -e '/@if CHAR is byte@/,/@endif CHAR is byte@/d' \
  -e '/@*if CHAR is char@/d'

XMLParserByte.java:  $(srcdir)/XMLParser.java.in
	sed $(BYTE_SUBS) $(FROM_XMLParser) \
	  <$(srcdir)/XMLParser.java.in >XMLParserByte.java 

XMLParserChar.java:  $(srcdir)/XMLParser.java.in
	sed $(CHAR_SUBS) $(FROM_XMLParser) \
	  <$(srcdir)/XMLParser.java.in >XMLParserChar.java 

ParsedXMLHandlerByte.java:  $(srcdir)/ParsedXMLHandler.java.in
	sed $(BYTE_SUBS) $(FROM_ParsedXMLHandler) \
	  <$(srcdir)/ParsedXMLHandler.java.in >ParsedXMLHandlerByte.java 

ParsedXMLHandler.java:  $(srcdir)/ParsedXMLHandler.java.in
	sed $(CHAR_SUBS) $(FROM_ParsedXMLHandler) \
	  <$(srcdir)/ParsedXMLHandler.java.in >ParsedXMLHandler.java 

PACKAGE_FNAME = gnu-xml
GCJ_INPUTS =  $(java_Java)

all: Makefile java-classes.stamp $(@GCJ_COMPILED_SELECTED@)
