# -*- Mode: Makefile -*-
# Makefile.Debian
# Copyright (c) 2004, 2010 Steward and Lee, LLC
# This is part of pdftk.
#
# Visit: www.pdftk.com for pdftk information and articles
# Permalink: http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/
#
# Please email Sid Steward with questions or bug reports.
# Include "pdftk" in the subject line to ensure successful delivery:
# sid.steward at pdflabs dot com

# Brief Instructions
#
#   Compile:             make -f Makefile.Debian
#   Install (as root):   make -f Makefile.Debian install
#   Uninstall:           make -f Makefile.Debian uninstall
#   Clean:               make -f Makefile.Debian clean
# 	 								

# tools
# need direct path to libgcj for gcjh (starting in gcj 4.1.2 per Aurélien GÉRÔME)
TOOLPATH=/sw/lib/gcc4.5/bin/
export VERSUFF=-fsf-4.5
export CXX= $(TOOLPATH)g++$(VERSUFF)
export GCJ= $(TOOLPATH)gcj$(VERSUFF)
export GCJH= $(TOOLPATH)gcjh$(VERSUFF)
export GJAR= $(TOOLPATH)gjar$(VERSUFF)
export LIBGCJ= /sw/lib/gcc4.5/share/java/libgcj-4.5.0.jar
export AR= ar
export RM= rm
export ARFLAGS= rs
export RMFLAGS= -vf

# pdftk compiler flags; 0x2f is a forward slash; 0x5c is a backslash
# if you want pdftk to ask before overwriting a file, set
# ASK_ABOUT_WARNINGS to true; otherwise: false; override this default
# with the dont_ask or do_ask command-line options
#
# drop CXXFLAG -O3 due to template inlining causing:
# "error: mixing C++ and Java catches in a single translation unit" per Andrew Haley;
# fix added for gcc-4.3; this problem might be fixed in 4.4
#
# GCJFLAG -O3 causes pdftk to segfault (during a cat operation) when compiled on sarge using gcc 3.4.4
# per Johann Felix Soden:
# In gcc 4.3 "-O3" gives an error. This is fixed in PR C++/39380 which is at least in debian's gcc 4.4.1-4
#
# GCJFLAG -fsource=1.3 identifies the version of the java source
#
# when building/using a shared itext library:
#   CXXFLAGS: -fpic (or-fPIC)
#   GCJFLAGS: -Wl,-Bsymbolic -fpic (or -fPIC) -Wl,-rpath,/usr/lib/gcj
# stock pdftk links statically against its own, modified itext library
#
# -findirect-dispatch
# introduced in gcj 4:
# "Using that option causes GCJ to generate native code for classes and methods that follow the precise same binary compatibility rules as described in the Java Language Specification."
# http://lwn.net/Articles/130796/
# omitted because it caused linking errors using gcc 4.4; it also seems to make a larger binary
#
# -Wl,--as-needed
# see: http://www.gentoo.org/proj/en/qa/asneeded.xml
# only effects libraries following option on the command line
#
#  
export MACOSX_DEPLOYMENT_TARGET= 10.4
export CPPFLAGS= -DPATH_DELIM=0x2f -DASK_ABOUT_WARNINGS=false -DUNBLOCK_SIGNALS -fdollars-in-identifiers -mmacosx-version-min=10.4
export CXXFLAGS= -Wall -Wextra -Weffc++ -O2
export GCJFLAGS= -Wall -fsource=1.3 -O2
export GCJHFLAGS= -force
export LDLIBS= /sw/lib/gcc4.5/lib/libgcj.dylib /sw/lib/gcc4.5/lib/libstdc++.dylib /sw/lib/gcc4.5/lib/libgcc_s.1.dylib -liconv -lz

include Makefile.Base
