
## 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@
RM           = @RM@

TARGET  = $(libbuild_dir)/clog2print.jar
PACKAGE = logformat.clog2
SRC     = Const.java MixedDataInputStream.java \
          StrColor.java StrDesc.java StrFile.java StrFormat.java StrBytes.java \
          LineID.java Preamble.java RecHeader.java \
          RecDefState.java RecDefMsg.java \
          RecDefEvent.java RecDefConst.java \
          RecBare.java RecCargo.java RecMsg.java \
          UUID.java RecComm.java \
          RecColl.java RecSrc.java RecTshift.java \
          InputLog.java Print.java

OBJ     = $(SRC:.java=.class)

.SUFFIXES:      .java .class .jar

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

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@

ALL: $(TARGET)

$(TARGET): $(OBJ)
	cd $(CLASSDIR) && \
	$(RM) $(PACKAGE).manifest && \
	echo "Main-Class: $(PACKAGE).Print" > $(PACKAGE).manifest ; \
	jarfile=@JPATH_START@$@@JPATH_FINAL@ ; \
	classdir_prefix=@JPATH_START@$(PKGDIR)/@JPATH_FINAL@ ; \
	$(JAR) $(JARFLAGS)cfm $${jarfile} $(PACKAGE).manifest ; \
        $(JAR) $(JARFLAGS)uf $${jarfile} $${classdir_prefix}*.class

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

rmlib:
	$(RM) $(TARGET)

realclean: clean rmlib

distclean: realclean
	@-$(RM) Makefile
