# Makefile for the retepPDF library
#
#-----------------------------------------------------------------------------
#
# retepPDF - A PDF Generation Library for Java
# Copyright (C) year name of author
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
# 
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA  02111-1307, USA.
# 
# Please note: If you make any changes to this file, please email either the
# amended files, or a diff to changes@retep.org.uk
#
# Any other problems, please email me at peter@retep.org.uk
#
# Releases, including current development sources will be available on the web
# at http://www.retep.org.uk
#
# $Id: GNUmakefile,v 1.2 2000/05/31 14:14:03 petermount Exp $
#
# This file builds the retepPDF library. To build, simply run:
#
# jdk1.1.x	make jdk11
# java2		make java2
#
# The jar file retepPDF.jar will be built.
#
# make clean will remove the class files.
#
# make dist is used here to build the tar files made available on the web site.
# I doub't you will find them of any use.
#
# make test will compile and run the test code
#
#-----------------------------------------------------------------------------
# $Log: GNUmakefile,v $
# Revision 1.2  2000/05/31 14:14:03  petermount
# Fixed bugs 101654, 103237 & 106296
#
#-----------------------------------------------------------------------------

# A generic name for jar and tar files
JAVA_NAME	= retepPDF

# This is the suffix used locally with the GNUmakefile and README files
JAVA_SUFFIX	= .pdf

# All classes belonging to this package are below this directory
RETEP_ROOT	= uk/org/retep
JAVA_ROOT	= $(RETEP_ROOT)/pdf

# The primary classes for this package (They may have inner classes, but we
# are not worried here as they are picked up later)
JAVA_PACKAGE	= \
			$(JAVA_ROOT)/PDF.class \
			$(JAVA_ROOT)/PDFAnnot.class \
			$(JAVA_ROOT)/PDFFont.class \
			$(JAVA_ROOT)/PDFGraphics.class \
			$(JAVA_ROOT)/PDFImage.class \
			$(JAVA_ROOT)/PDFJob.class \
			$(JAVA_ROOT)/PDFObject.class \
			$(JAVA_ROOT)/PDFOutline.class \
			$(JAVA_ROOT)/PDFPage.class \
			$(JAVA_ROOT)/PDFStream.class \

# These define the JDK1.1.x version of the library
JAVA_PACKAGE_1	= $(JAVA_PACKAGE) \
			$(JAVA_ROOT)/j1/PDFGraphics.class \
			$(JAVA_ROOT)/j1/PDFJob.class \

# These define the Java2 version of the library
JAVA_PACKAGE_2	= $(JAVA_PACKAGE) \
			$(JAVA_ROOT)/j2/PDFGraphics.class \
			$(JAVA_ROOT)/j2/PDFJob.class \

#------------------------------------------------------------------------------
# DO NOT EDIT # Below this point is standard against the GNUmakefile.template #
#------------------------------------------------------------------------------

# The output jar file
JAVA_JAR		= $(JAVA_NAME).jar

# Rule to compile java classes
%.class: %.java
	javac $<

all:
	@echo "------------------------------------------------------------"
	@echo "To compile the library, please enter one of the following"
	@echo "lines, dependent on what version of the JVM you are running:"
	@echo
	@echo "JDK1.1.x   make jdk11 test"
	@echo "Java 2     make java2 test"
	@echo
	@echo "This will compile the correct version for your platform,"
	@echo "build a reteppdf.jar file, and a test document in the file"
	@echo "test/pdf/pdfjob.pdf"
	@echo
	@echo "To clean the source tree (required if you are compiling"
	@echo "both versions), please run make clean first."
	@echo
	@echo "Finally, there is a visual test you can run. To run, type:"
	@echo "make display"
	@echo
	@echo "------------------------------------------------------------"

jdk11:	$(JAVA_PACKAGE) $(JAVA_PACKAGE_1) $(JAVA_JAR)

java2:	$(JAVA_PACKAGE) $(JAVA_PACKAGE_2) $(JAVA_JAR)

# This builds and runs the console test. It should create a pdf test document.
test:		testfiles
		java test.RunTests test.pdf.PDFJobTest

# This builds and runs the visual test. This is used to compare how
# accurate the onscreen and pdf renditions are.
#
display:	testfiles
		java test.pdf.PDFJobTest

# Dummy rule for the test and display tests.
testfiles:	test/RunTests.class \
		test/pdf/PDFJobTest.class

# Builds the jar file
$(JAVA_JAR):	$(JAVA_PACKAGE)
	jar c0vf $@ $$(find $(JAVA_ROOT) -name "*.class" -print)

clean:
	-find . -name "*.class" -exec rm {} \;
	-find . -name "*~" -exec rm {} \;
	-find . -name "*.pdf" -exec rm {} \;
	-rm $(JAVA_JAR)

# In the CVS repository, this file is actually called GNUmakefile.pdf
# This rule cleans the pdf part of the repository, then builds a distribution
# suitable for posting onto the internet. It is usually called by a cron job.
#
# tmp	is a sub directory used to build the distribution
# dist	is a sub directory used to store the built distributions.
#
# Another cron job on maidast.demon.co.uk actually picks these up, and posts
# them to the web site.
#
dist:	clean
	-rm -rf tmp
	mkdir -p tmp/$(JAVA_ROOT)
	cp -vr $(JAVA_ROOT) tmp/$(RETEP_ROOT)
	for i in $(wildcard *$(JAVA_SUFFIX)) ; \
		do cp $$i tmp/$$(basename $$i $(JAVA_SUFFIX)) ; \
		done
	cp COPYING tmp
	-find tmp -name CVS -exec rm -rf {} \;
	cd tmp;tar cvzf ../dist/$(JAVA_NAME)-src-$$(date +%Y%m%d).tgz *

#---------------------------------------------------------------------------

