
## End User configurable options ###
SHELL = @SHELL@

@VPATH@
# Installation directories
prefix       = @prefix@
exec_prefix  = @exec_prefix@
bindir       = @bindir@
includedir   = @includedir@
libdir       = @libdir@
# Build directories
libbuild_dir = @libbuild_dir@
top_srcdir   = @top_srcdir@
srcdir       = @srcdir@

JC           = @JC@
JAR          = @JAR@
JH           = @JH@
RM           = @RM@

TARGET   = $(libbuild_dir)/traceprint.jar
PACKAGE  = logformat.trace
JSRC     = DobjDef.java Print.java
JSRC4C   = InputLog.java

CLS      = $(JSRC:.java=.class)
CLS4C    = $(JSRC4C:.java=.class)
HDR      = $(CLS4C:.class=.h)

.SUFFIXES:	.java .class .jar .h

# CLASSDIR is where classfiles are located, all counted from the top
SRCDIR     = $(top_srcdir)
CLASSDIR   = ../..
CLASSPATH  = ../..
PKGDIR     = logformat/trace

JCFLAGS = -sourcepath @JPATH_START@$(SRCDIR)@JPATH_FINAL@ -classpath @JPATH_START@$(CLASSPATH)@JPATH_FINAL@ -d @JPATH_START@$(CLASSDIR)@JPATH_FINAL@ @JFLAGS@

.java.class:
	$(JC) $(JCFLAGS) $(JFLAGS) @JPATH_START@$<@JPATH_FINAL@

.class.h:
	$(JH) -classpath @JPATH_START@$(CLASSPATH)@JPATH_FINAL@ $(PACKAGE).$*


ALL: $(HDR) $(TARGET)

$(TARGET): $(CLS) $(CLS4C)
	cd $(CLASSDIR) && \
	$(RM) $(PACKAGE).manifest && \
	echo "Main-Class: $(PACKAGE).Print" > $(PACKAGE).manifest ; \
	jarfile=@JPATH_START@$@@JPATH_FINAL@ ; \
	$(JAR) $(JARFLAGS)cfm $${jarfile} $(PACKAGE).manifest ; \
	for dir in base/io/ base/drawable/ $(PKGDIR)/ ; do \
	    classdir_prefix=@JPATH_START@$${dir}@JPATH_FINAL@ ; \
	    $(JAR) $(JARFLAGS)uf $${jarfile} $${classdir_prefix}*.class ; \
	done

clean:
	cd $(CLASSDIR) && \
	$(RM) $(PACKAGE).manifest $(PKGDIR)/*.class $(PKGDIR)/*.h

rmlib:
	$(RM) $(TARGET)

realclean: clean rmlib

distclean: realclean
	@-$(RM) Makefile
