bin_PROGRAMS = jikes

jikes_SOURCES = \
ast.cpp \
body.cpp \
bytecode.cpp \
case.cpp \
class.cpp \
code.cpp \
control.cpp \
decl.cpp \
definite.cpp \
depend.cpp \
diagnose.cpp \
double.cpp \
dump.cpp \
error.cpp \
expr.cpp \
incrmnt.cpp \
init.cpp \
javaact.cpp \
jikes.cpp \
jikesapi.cpp \
long.cpp \
lookup.cpp \
lpginput.cpp \
modifier.cpp \
op.cpp \
option.cpp \
parser.cpp \
platform.cpp \
scanner.cpp \
segment.cpp \
set.cpp \
stream.cpp \
symbol.cpp \
system.cpp \
tab.cpp \
unparse.cpp \
unzip.cpp \
zip.cpp

include_HEADERS = \
jikesapi.h

noinst_HEADERS = \
access.h \
ast.h \
bytecode.h \
case.h \
class.h \
code.h \
control.h \
depend.h \
diagnose.h \
double.h \
error.h \
javaact.h \
javadcl.h \
javadef.h \
javaprs.h \
javasym.h \
jikesapi.h \
long.h \
lookup.h \
lpginput.h \
op.h \
option.h \
parser.h \
platform.h \
scanner.h \
segment.h \
semantic.h \
set.h \
spell.h \
stream.h \
symbol.h \
tab.h \
table.h \
tuple.h \
unzip.h \
zip.h

# Include the java.g and gencode.java files in the .tar ball

EXTRA_DIST = java.g gencode.java

if MAINTAINER_MODE
# Special rules to remake autogenerated files
PARSER_FILES = \
javaact.cpp \
javaact.h \
javadcl.h \
javadef.h \
javaprs.h \
javasym.h

BUILT_SOURCES = $(PARSER_FILES) code.cpp code.h

javaact.stamp: $(srcdir)/java.g
	@rm -f javaact.tmp
	@$(TOUCH) javaact.tmp
	(cd $(srcdir); $(JIKESPG) java.g)
	rm -f $(srcdir)/java.l
	@mv -f javaact.tmp $@

$(PARSER_FILES): javaact.stamp
	@if test -f $@; then :; else \
	  rm -f javaact.stamp; \
	  $(MAKE) $(AM_MAKEFLAGS) javaact.stamp; \
	fi

# FIXME: hardcoded at the moment, makes bootstrap difficult...
JAVA = java
JAVAC = jikes -nowarn -source 1.4
code.stamp: $(srcdir)/gencode.java
	@rm -f code.tmp
	@$(TOUCH) code.tmp
	$(JAVAC) -d $(srcdir) $<
	(cd $(srcdir); $(JAVA) -classpath . gencode)
	@mv -f code.tmp $@

code.cpp code.h: code.stamp
	@if test -f $@; then :; else \
	  rm -f code.stamp; \
	  $(MAKE) $(AM_MAKEFLAGS) code.stamp; \
	fi

# end special maintainer mode section
endif


# This rule will build an efence malloc debugging enabled version of jikes.
# This should be used for testing purposes only! It is really slow!
efence:
	@rm -f jikes$(EXEEXT)
	$(CXXLINK) -o jikes$(EXEEXT) $(jikes_OBJECTS) -lstdc++ -lefence
