#
# "$Id: Makefile 343 2007-07-13 19:52:48Z mike $"
#
#   Makefile for the CUPS PPD Compiler.
#
#   Copyright 2007 by Apple Inc.
#   Copyright 2002-2005 by Easy Software Products.
#
#   These coded instructions, statements, and computer programs are the
#   property of Apple Inc. and are protected by Federal copyright
#   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
#   which should have been included with this file.  If this file is
#   file is missing or damaged, see the license at "http://www.cups.org/".
#

#
# Include standard definitions...
#

include ../Makedefs


#
# Object files...
#

LIBOBJS	= \
		attr.o \
		check.o \
		cmyk.o \
		dither.o \
		lut.o \
		pack.o \
		rgb.o \
		snprintf.o \
		srgb.o \
		string.o

OBJS		= \
		commandtoescpx.o \
		commandtopclx.o \
		cupsprofile.o \
		rastertoescpx.o \
		rastertopclx.o \
		pcl-common.o \
		testcmyk.o \
		testdither.o \
		testrgb.o \
		$(LIBOBJS)

TARGETS		= \
		libcupsdriver.a \
		commandtoescpx \
		commandtopclx \
		cupsprofile \
		rastertoescpx \
		rastertopclx \
		testcmyk \
		testdither \
		testrgb


#
# Make everything...
#

all:		$(TARGETS)


#
# Clean everything...
#

clean:
	$(RM) $(OBJS) core
	$(RM) *.bck core.*
	$(RM) $(TARGETS)
	$(RM) -r images


#
# Update dependencies...
#

depend:
	makedepend -Y -I.. -f Dependencies *.c


#
# Install...
#

install:
	$(INSTALL_DIR) $(BUILDROOT)$(bindir)
	$(INSTALL_BIN) cupsprofile $(BUILDROOT)$(bindir)
	$(INSTALL_DIR) $(BUILDROOT)$(CUPS_SERVERBIN)/filter
	for file in commandtoescpx commandtopclx rastertoescpx rastertopclx; do \
		$(INSTALL_BIN) $$file $(BUILDROOT)$(CUPS_SERVERBIN)/filter; \
	done
	$(INSTALL_DIR) $(BUILDROOT)$(includedir)/cups
	$(INSTALL_DATA) driver.h $(BUILDROOT)$(includedir)/cups


#
# Uninstall...
#

uninstall:
	$(RM) $(BUILDROOT)$(bindir)/cupsprofile
	for file in commandtoescpx commandtopclx rastertoescpx rastertopclx; do \
		$(RM) $(BUILDROOT)$(CUPS_SERVERBIN)/filter/$$file; \
	done
	$(RM) $(BUILDROOT)$(includedir)/cups/driver.h


#
# commandtopclx, the PCL command printer driver.
#

commandtopclx:		commandtopclx.o libcupsdriver.a
	$(CC) $(LDFLAGS) -o $@ commandtopclx.o libcupsdriver.a \
		$(CUPSDRVLIBS) $(LIBS)


#
# commandtoescpx, the ESC/P command printer driver.
#

commandtoescpx:		commandtoescpx.o libcupsdriver.a
	$(CC) $(LDFLAGS) -o $@ commandtoescpx.o libcupsdriver.a \
		$(CUPSDRVLIBS) $(LIBS)


#
# cupsprofile, the simple profiling utility.
#

cupsprofile:		cupsprofile.o libcupsdriver.a
	$(CC) $(LDFLAGS) -o $@ cupsprofile.o libcupsdriver.a \
		$(CUPSLIBS) $(LIBS)


#
# rastertoescpx, the ESC/P raster printer driver.
#

rastertoescpx:		rastertoescpx.o libcupsdriver.a
	$(CC) $(LDFLAGS) -o $@ rastertoescpx.o libcupsdriver.a \
		$(CUPSDRVLIBS) $(LIBS)


#
# rastertopclx, the ESC/P raster printer driver.
#

rastertopclx:		rastertopclx.o pcl-common.o libcupsdriver.a
	$(CC) $(LDFLAGS) -o $@ rastertopclx.o pcl-common.o \
		libcupsdriver.a $(CUPSDRVLIBS) $(LIBS)


#
# testcmyk, test cmyk separation functions.
#

testcmyk:		testcmyk.o libcupsdriver.a
	$(CC) $(LDFLAGS) -o $@ testcmyk.o libcupsdriver.a \
		$(CUPSLIBS_ST) $(LIBS)
	./testcmyk


#
# testdither, test dithering functions.
#

testdither:		testdither.o libcupsdriver.a
	$(CC) $(LDFLAGS) -o $@ testdither.o libcupsdriver.a \
		$(CUPSLIBS_ST) $(LIBS)
	if test ! -d images; then \
		mkdir images; \
	fi
	./testdither > images/0-255.pgm
	./testdither 0 127 255 > images/0-127-255.pgm
	./testdither 0 85 170 255 > images/0-85-170-255.pgm
	./testdither 0 63 127 170 198 227 255 > images/0-63-127-170-198-227-255.pgm
	./testdither 0 210 383 > images/0-210-383.pgm
	./testdither 0 82 255 > images/0-82-255.pgm
	./testdither 0 510 > images/0-510.pgm
	./testdither 0 1020 > images/0-1020.pgm


#
# testrgb, test RGB separation functions.
#

testrgb:		testrgb.o libcupsdriver.a
	$(CC) $(LDFLAGS) -o $@ testrgb.o libcupsdriver.a \
		$(CUPSLIBS_ST) $(LIBS)
	./testrgb


#
# libcupsdriver.a, the CUPS driver library...
#

libcupsdriver.a:	$(LIBOBJS)
	$(RM) $@
	$(AR) $(ARFLAGS) $@ $(LIBOBJS)
	$(RANLIB) $@


#
# ../doc/cupsdriver.html, the CUPS driver library documentation...
#

../doc/cupsdriver.html:	$(LIBOBJS:.o=.c) driver.h
	$(RM) ../doc/cupsdriver.xml
	mxmldoc ../doc/cupsdriver.xml driver.h $(LIBOBJS:.o=.c) >../doc/cupsdriver.html


#
# Include dependencies...
#

include Dependencies


#
# End of "$Id: Makefile 343 2007-07-13 19:52:48Z mike $".
#
