### Driver "pcl3" for various PCL-3+ printers #################################
#
# @(#)$Id: contrib.mak.add,v 1.7 2001/07/27 13:52:58 Martin Rel $
# Author: Martin Lottermoser, Greifswaldstrasse 28, 38124 Braunschweig,
#         Germany, e-mail: Martin.Lottermoser@t-online.de.
#
# Read the file README in the pcl3 distribution for general installation
# instructions. If you don't have a distribution, visit
# http://home.t-online.de/home/Martin.Lottermoser/pcl3.html.
#
# If you are including both, hpdj and pcl3, in the compilation, you should
# disable the rules for pclcomp.$(OBJ) and pagecount.$(OBJ) in the hpdj
# section. The versions of these files contained in the pcl3 distribution are
# binary compatible with what hpdj 2.6 expects.
#
# You can add compilation options to the variable "pcl3_options" below.
#
#   NDEBUG
#	Define this to remove certain runtime checks from the code which might
#	then become slightly faster. Don't define this for pcl3 beta releases
#	or ghostscript test releases.
#
#   PCL3_MEDIA_FILE
#	Define this to be a C string containing the absolute path name of a
#	media configuration file if you want the "unspec" subdevice to use this
#	file instead of its default HP DeskJet 850C/855C/870C/890C media
#	configuration. An example definition for UNIX systems is:
#
#	    pcl3_options=-DPCL3_MEDIA_FILE='"$(gsdatadir)/pcl3.mcf"'
#
#       A detailed description of the meaning and the syntax of this file can
#       be found in the reference page gs-pcl3(1). Briefly, it tells the
#	driver which media sizes your printer supports and how. You can
#       override this at run time with the option "-sMediaConfigurationFile".
#
# The variable "eprn_fs_options" is intended for optimization options used only
# when compiling eprnfs.c. Choose the combination producing the fastest code.
# You should leave this variable empty unless (a) you definitely know which
# options produce the fastest code from eprnfs.c, and (b) ghostscript does not
# use the same options anyway.
#
# You should also look at the section below containing the rules for the *.dev
# files in order to find out which values you can add to the DEVICE_DEVS*
# variables in the platform-specific make file. You should always add at least
# the "pcl3" device but you may add others; the latter are shortcuts to the
# subdevices of pcl3.
#
#
# Remarks for Microsoft Windows
# =============================
# When compiling on Microsoft Windows and unless you are using Cygwin, you must
# define the preprocessor symbol "EPRN_NO_PAGECOUNTFILE" and either remove the
# dependency of pcl3 on pagecount.obj or replace pagecount.c with an empty
# file.
#
###############################################################################

# Compilation options
pcl3_options=
eprn_fs_options=

# Version of the pcl3 rules: $Revision: 5.50.2.11 $.

#==============================================================================

# eprn rules
# This is the part you need if you are developing another eprn-based driver.

# Complete set of compilation options
eprn_opts=-DGS_REVISION=$(GS_REVISION) $(pcl3_options)

# Directory with eprn's source code as seen from the gs directory. The name
# does not include a trailing path separator.
eprn_dir=pcl3$(D)eprn
# Same as above but with a separator
eprn_src=$(eprn_dir)$(D)

# List of all eprn object files
eprn_=$(GLOBJ)gdeveprn.$(OBJ) $(GLOBJ)pagecount.$(OBJ) \
  $(GLOBJ)mediasize.$(OBJ) $(GLOBJ)eprnparm.$(OBJ) $(GLOBJ)eprnrend.$(OBJ) \
  $(GLOBJ)eprnfs.$(OBJ)

# List of eprn headers needed when gdeveprn.h is included:
eprn_headers=$(eprn_src)mediasize.h $(eprn_src)gdeveprn.h

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

# Rules for individual files

$(GLOBJ)mediasize.$(OBJ): $(eprn_src)mediasize.c $(eprn_src)mediasize.h
	$(GLCC) $(C_) $(O_)$@ $(eprn_opts) $(eprn_src)mediasize.c

$(GLOBJ)gdeveprn.$(OBJ): $(eprn_src)gdeveprn.c $(eprn_headers) \
	  $(eprn_src)pagecount.h
	$(GLCC) $(C_) $(O_)$@ $(eprn_opts) $(eprn_src)gdeveprn.c

$(GLOBJ)eprnparm.$(OBJ): $(eprn_src)eprnparm.c $(eprn_headers)
	$(GLCC) $(C_) $(O_)$@ $(eprn_opts) $(eprn_src)eprnparm.c

$(GLOBJ)eprnrend.$(OBJ): $(eprn_src)eprnrend.c $(eprn_headers)
	$(GLCC) $(C_) $(O_)$@ $(eprn_opts) $(eprn_src)eprnrend.c

$(GLOBJ)eprnfs.$(OBJ): $(eprn_src)eprnfs.c $(eprn_headers)
	$(GLCC) $(C_) $(O_)$@ $(eprn_opts) $(eprn_fs_options) \
	  $(eprn_src)eprnfs.c

# File also used by hpdj:
$(GLOBJ)pagecount.$(OBJ): $(eprn_src)pagecount.c $(eprn_src)pagecount.h
	$(GLCC) $(C_) $(O_)$@ $(eprn_opts) $(eprn_src)pagecount.c

#==============================================================================

# pcl3 rules

# Complete set of compilation options
pcl3_opts=-DGS_REVISION=$(GS_REVISION) -I$(eprn_dir) $(pcl3_options)

# Root directory of pcl3 distribution as seen from the gs directory. The
# variable includes a trailing path separator.
pcl3_root=pcl3$(D)

# Directory with pcl3's source code (name includes a trailing path separator)
pcl3_src=$(pcl3_root)src$(D)

# Headers used by most pcl3 files
pcl3_headers=$(eprn_headers) \
  $(pcl3_src)pclgen.h $(pcl3_src)pclcap.h $(pcl3_src)pclsize.h

# List of all object files needed for pcl3
pcl3_=$(eprn_) $(GLOBJ)gdevpcl3.$(OBJ) $(GLOBJ)pclcap.$(OBJ) \
  $(GLOBJ)pclgen.$(OBJ) $(GLOBJ)pclcomp.$(OBJ) $(GLOBJ)pclsize.$(OBJ)

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

# Rules for individual files

$(GLOBJ)pclgen.$(OBJ): $(pcl3_src)pclgen.c $(pcl3_src)pclgen.h
	$(GLCC) $(C_) $(O_)$@ $(pcl3_opts) $(pcl3_src)pclgen.c

$(GLOBJ)pclsize.$(OBJ): $(pcl3_src)pclsize.c $(eprn_src)mediasize.h \
	  $(pcl3_src)pclsize.h $(pcl3_src)pclgen.h
	$(GLCC) $(C_) $(O_)$@ $(pcl3_opts) $(pcl3_src)pclsize.c

$(GLOBJ)pclcap.$(OBJ): $(pcl3_src)pclcap.c $(pcl3_headers)
	$(GLCC) $(C_) $(O_)$@ $(pcl3_opts) $(pcl3_src)pclcap.c

$(GLOBJ)gdevpcl3.$(OBJ): $(pcl3_src)gdevpcl3.c $(pcl3_headers)
	$(GLCC) $(C_) $(O_)$@ $(pcl3_opts) $(pcl3_src)gdevpcl3.c

# File also used by hpdj:
$(GLOBJ)pclcomp.$(OBJ): $(pcl3_src)pclcomp.c $(pcl3_src)pclgen.h
	$(GLCC) $(C_) $(O_)$@ $(pcl3_opts) $(pcl3_src)pclcomp.c

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

# Device rules. The targets here (e.g., "pcl3.dev") are the values you
# can add to the DEVICE_DEVS* variables in the platform-specific make file.

# The generic pcl3 device with selectable subdevices
pcl3.dev: $(pcl3_) page.dev
	$(SETPDEV) pcl3 $(pcl3_)

# Fixed devices for specific printers
hpdjplus.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdjplus $(pcl3_)
hpdjportable.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdjportable $(pcl3_)
hpdj310.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj310 $(pcl3_)
hpdj320.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj320 $(pcl3_)
hpdj340.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj340 $(pcl3_)
hpdj400.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj400 $(pcl3_)
hpdj500.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj500 $(pcl3_)
hpdj500c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj500c $(pcl3_)
hpdj510.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj510 $(pcl3_)
hpdj520.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj520 $(pcl3_)
hpdj540.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj540 $(pcl3_)
hpdj550c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj550c $(pcl3_)
hpdj560c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj560c $(pcl3_)
hpdj600.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj600 $(pcl3_)
hpdj660c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj660c $(pcl3_)
hpdj670c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj670c $(pcl3_)
hpdj680c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj680c $(pcl3_)
hpdj690c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj690c $(pcl3_)
hpdj850c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj850c $(pcl3_)
hpdj855c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj855c $(pcl3_)
hpdj870c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj870c $(pcl3_)
hpdj890c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj890c $(pcl3_)
hpdj1120c.dev: $(pcl3_) page.dev
	$(SETPDEV) hpdj1120c $(pcl3_)

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

# The pcl3opts command.
# This is deliberately not included in the normal compilation because (a) the
# rule is unlikely to work and (b) the code is unlikely to compile on any but
# UNIX systems.

pcl3opts: $(GLOBJ)pcl3opts$(XE)
pcl3opts_=$(pcl3_src)pcl3opts.c $(pcl3_src)pclscan.c $(eprn_src)mediasize.c \
	$(pcl3_src)pclsize.c

$(GLOBJ)pcl3opts$(XE): $(pcl3opts_)
	$(CC_) -o $@ -I$(eprn_src) $(pcl3opts_)
	gencat $(GLOBJ)pcl3opts-en.cat $(pcl3_src)pcl3opts-en.msg
	gencat $(GLOBJ)pcl3opts-de.cat $(pcl3_src)pcl3opts-de.msg

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

# Installation rules (work only for UNIX). Note that the PostScript examples
# are not copied.
pcl3-install:
	for f in gs-pcl3 pcl3opts; do	\
	  $(INSTALL_DATA) $(pcl3_root)doc$(D)$$f.1 $(man1dir)/$$f.$(man1ext) \
	    || exit 1;	\
	  $(INSTALL_DATA) $(pcl3_root)doc$(D)$$f.html $(docdir) || exit 1; done
	$(INSTALL_PROGRAM) $(GLOBJ)pcl3opts$(XE) $(bindir)

