# Makefile to install foomatic-db-engine
# $Revision$
# PREFIX defaults to /usr/local for manually installed progs, so that they
# are not messed up on a system upgrade.
#
# `architecture independent', static data files i.e. perl libs go into
# $(PREFIX)/share/foomatic
# (user) executables into $(PREFIX)/bin/
# system binaries go into $(PREFIX)/sbin
# configuration files into /etc/foomatic/*.
#
# The PERLPREFIX allows a seperate prefix for the Perl libraries. Use this
# when Perl libraries in /usr/local are not found.
# Variables
DEBUG=
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
bindir=@bindir@
sbindir=@sbindir@
mandir=@mandir@
datarootdir=@datarootdir@
datadir=@datadir@
sysconfdir=@sysconfdir@
SRC=@srcdir@
INSTALL=@INSTALL@
PREFIX=$(prefix)
PERLPREFIX=@PERLPREFIX@
# Foomatic database location for a regular installation
LIBDIR=@LIBDIR@
# Foomatic database location for a "make inplace" installation
LOCAL_LIBDIR=@LOCAL_LIBDIR@
# foomatic-rip path for a regular installation
FOOMATIC_RIP=@FOOMATIC_RIP@
# foomatic-rip path for a "make inplace" installation
LOCAL_FOOMATIC_RIP=@LOCAL_FOOMATIC_RIP@
# Locations for installing the components of this package
BINDIR=$(bindir)
SBINDIR=$(sbindir)
MANDIR=$(mandir)
ETCDIR=$(sysconfdir)/foomatic
## C settings
CC=@CC@
CFLAGS=@CFLAGS@
XML_CFLAGS=@XML_CFLAGS@
XML_LIBS=@XML_LIBS@
## Settings for Perl
# Where to find the perl binary
PERL=@PERL@
# How to install the perl libs, may be either "site" or "perl"
# details in the ExtUtils::MakeMaker manpage
PERL_INSTALLDIRS=@PERL_INSTALLDIRS@
# Genereal paths for all filter scripts
EXEC_PATH=/usr/local/bin:/usr/bin:/bin
LOG_PATH=/tmp
# Paths for LPD and LPRng
LPD_SPOOL=@LPD_SPOOL@
LPD_LOG=@LPD_LOG@
LPD_BIN=@LPD_BIN@
PRINTCAP=@PRINTCAP@
LPRNG_CONF=@LPRNG_CONF@
LPD_LPR=@LPD_LPR@
LPD_LPQ=@LPD_LPQ@
LPD_LPRM=@LPD_LPRM@
LPD_LPC=@LPD_LPC@
LPRNG_CHECKPC=@LPRNG_CHECKPC@
# Paths and other settings for CUPS
CUPS_ETC=@CUPS_ETC@
CUPS_ADMIN=@CUPS_ADMIN@
CUPS_LPSTAT=@CUPS_LPSTAT@
CUPS_PPDS=@CUPS_PPDS@
CUPS_FILTERS=@CUPS_FILTERS@
CUPS_BACKENDS=@CUPS_BACKENDS@
LIB_CUPS=@LIB_CUPS@
CUPS_DRIVER=@LIB_CUPS@/driver
CUPS_PCONF=@CUPS_PCONF@
CUPS_LPR=@CUPS_LPR@
CUPS_LPQ=@CUPS_LPQ@
CUPS_LPRM=@CUPS_LPRM@
CUPS_LPC=@CUPS_LPC@
CUPS_LP=@CUPS_LP@
CUPS_CANCEL=@CUPS_CANCEL@
CUPS_ENABLE=@CUPS_ENABLE@
CUPS_DISABLE=@CUPS_DISABLE@
CUPS_ACCEPT=@CUPS_ACCEPT@
CUPS_REJECT=@CUPS_REJECT@
CUPS_LPMOVE=@CUPS_LPMOVE@
CUPS_LPOPTIONS=@CUPS_LPOPTIONS@
CUPS_LPINFO=@CUPS_LPINFO@
# Paths for PDQ
PDQ_CONF=@PDQ_CONF@
PDQ_PRINTRC=@PDQ_PRINTRC@
PDQ_FOOMATIC=$(PDQ_CONF)/drivers/foomatic
PDQ_PRINT=@PDQ_PRINT@
PDQ_JOBDIR=~/.printjobs
# Paths for PPR
PPR_PPRD=@PPR_PPRD@
PPR_INTERFACES=@PPR_INTERFACES@
PPR_PPDFILES=@PPR_PPDFILES@
PPR_ETC=@PPR_ETC@
PPR_PPR=@PPR_PPR@
PPR_PPAD=@PPR_PPAD@
PPR_PPOP=@PPR_PPOP@
# Paths for direct, spoolerless printing
DIRECT_ETC=$(ETCDIR)/direct
DIRECT_CONFIG=$(DIRECT_ETC)/.config
# Other paths
NC=@NC@
RLPR=@RLPR@
SMBCLIENT=@SMBCLIENT@
NPRINT=@NPRINT@
PTAL_CONNECT=@PTAL_CONNECT@
PTAL_PIPES=@PTAL_PIPES@
MTINK_PIPES=@MTINK_PIPES@
CAT=@CAT@
GZIP=@GZIP@
WGET=@WGET@
CURL=@CURL@
# This is mainly useful for building a binary foomatic package
DESTDIR=/
### Probably nothing to fiddle past here
# Files generated by the AC_OUTPUT call of "./configure"
AC_OUTPUT_FILES:=Makefile makeDefaults makeMan \
foomatic-configure foomatic-printjob \
foomatic-kitload foomatic-ppdfile foomatic-preferred-driver \
foomatic-cleanupdrivers foomatic-getpjloptions \
foomatic-addpjloptions foomatic-compiledb foomatic-fix-xml \
foomatic-nonumericalids foomatic-replaceoldprinterids \
foomatic-ppd-options foomatic-printermap-to-gutenprint-xml \
foomatic-extract-text foomatic-searchprinter foomatic-ppd-to-xml
# User programs and helper programs
BINFILES:=foomatic-printjob foomatic-configure \
foomatic-combo-xml foomatic-perl-data \
foomatic-ppdfile foomatic-compiledb \
foomatic-ppd-options foomatic-searchprinter foomatic-ppd-to-xml
# Administrative commands, only useful for admins
SBINFILES:=foomatic-kitload \
foomatic-getpjloptions foomatic-addpjloptions \
foomatic-preferred-driver foomatic-fix-xml \
foomatic-nonumericalids foomatic-replaceoldprinterids \
foomatic-printermap-to-gutenprint-xml \
foomatic-cleanupdrivers foomatic-extract-text
# Foomatic XML templates
TEMPLATES:=pjl_enum_choice.xml pjl_enum_option.xml pjl_num_option.xml
# Masks for trash files which have to be removed before packaging Foomatic
TRASHFILES:="*~" "*\#*" ".??*" "*.rej"
all: build
# The install rule should check for kitloads and avoid stomping. It doesn't
install: install-bin install-man
check-config:
@if [ -f .testing-stamp ] ; then \
echo 'Cowardly refusing to install testing Defaults.pm.' ;\
echo 'Use "make testing-clean; make defaults" to get a proper one.' ;\
exit 1 ;\
fi
install-bin: check-config lib/Makefile
# This is the only way to get the Perl-generated Makefile using
# $(DESTDIR) properly
( cd lib && \
$(MAKE) PREFIX=$(PERLPREFIX) && \
$(MAKE) PREFIX=$(PERLPREFIX) DESTDIR=$(DESTDIR) pure_install \
)
${SRC}/mkinstalldirs $(DESTDIR)$(BINDIR)
${SRC}/mkinstalldirs $(DESTDIR)$(SBINDIR)
${SRC}/mkinstalldirs $(DESTDIR)$(ETCDIR)
${SRC}/mkinstalldirs $(DESTDIR)$(LIBDIR)/templates
${INSTALL} -m 755 $(BINFILES) $(DESTDIR)$(BINDIR)
${INSTALL} -m 755 $(SBINFILES) $(DESTDIR)$(SBINDIR)
( cd foomatic-templates && \
${INSTALL} -m 644 $(TEMPLATES) $(DESTDIR)$(LIBDIR)/templates \
)
$(PERL) -p -i -e "s:foomatic-templates:$(LIBDIR)/templates:g" $(DESTDIR)$(SBINDIR)/foomatic-addpjloptions
# Link to allow foomatic-ppdfile be called under the old name
# foomatic-datafile
ln -sf foomatic-ppdfile $(DESTDIR)$(BINDIR)/foomatic-datafile
# Link foomatic-ppdfile to the CUPS 1.2 PPD generator directory,
# so that the cups-driverd automatically generates Foomatic PPDs
# on demand (/usr/lib/cups/driver).
if [ -d $(LIB_CUPS) ]; then \
${SRC}/mkinstalldirs $(DESTDIR)$(CUPS_DRIVER); \
ln -sf $(BINDIR)/foomatic-ppdfile $(DESTDIR)$(CUPS_DRIVER)/foomatic; \
fi
install-man: check-config
${SRC}/mkinstalldirs $(DESTDIR)$(MANDIR)
${SRC}/mkinstalldirs $(DESTDIR)$(MANDIR)/man1
${SRC}/mkinstalldirs $(DESTDIR)$(MANDIR)/man8
${INSTALL} -m 644 *.1 $(DESTDIR)$(MANDIR)/man1
${INSTALL} -m 644 *.8 $(DESTDIR)$(MANDIR)/man8
# If the Perl scripts have "use lib 'lib/';" lines from a former
# "make testing", we remove them.
build: defaults lib/Makefile foomatic-combo-xml foomatic-perl-data man
for m in $(BINFILES) $(SBINFILES); do \
$(PERL) -p -i -e "s=use lib '.*lib/';\n==s" $$m; \
done
chmod a+rx $(AC_OUTPUT_FILES) mkinstalldirs
lib/Makefile: lib/Makefile.PL
( cd lib && $(PERL) Makefile.PL verbose INSTALLDIRS=$(PERL_INSTALLDIRS) )
foomatic-combo-xml: foomatic-combo-xml.c
$(CC) $(CFLAGS) -o foomatic-combo-xml foomatic-combo-xml.c
foomatic-perl-data: foomatic-perl-data.c
$(CC) $(CFLAGS) $(XML_CFLAGS) -o foomatic-perl-data foomatic-perl-data.c $(XML_LIBS)
man: lib/Foomatic/Defaults.pm
chmod a+rx ./makeMan
./makeMan
clean: lib/Makefile remove-trash
$(MAKE) -C lib clean
rm -f lib/Makefile.old
rm -f lib/Foomatic/Defaults.pm
rm -f *~ .testing-stamp
rm -f *.o gs_out
rm -f foomatic-combo-xml
rm -f foomatic-perl-data
rm -f Foomatic
rm -rf foomatic-db
rm -f $(BINFILES:=.1) $(SBINFILES:=.8)
# Remove links from inplace installation
rm -f foomatic-rip foomatic-datafile man
# Remove foomatic-ppds-<version>.tar.gz package
rm -rf foomatic-ppds foomatic-ppds-[0-9]*
rm -rf foomatic-ppds*.tar.gz
distclean: clean
rm -f $(AC_OUTPUT_FILES) config.log config.status config.cache
rm -rf autom*.cache confdefs.h ppd foomatic-db db
maintainer-clean: distclean
rm -f configure aclocal.m4
# Uninstall an installed Foomatic
uninstall: uninstall-bin uninstall-man
uninstall-bin: check-config lib/Makefile
# This is the only way to get the Perl-generated Makefile using
# $(DESTDIR) properly
( cd lib && \
$(MAKE) PREFIX=$(DESTDIR)$(PERLPREFIX) uninstall \
)
( cd $(DESTDIR)$(BINDIR) && \
rm -f $(BINFILES) \
)
rm -f $(DESTDIR)$(BINDIR)/foomatic-datafile
( cd $(DESTDIR)$(SBINDIR) && \
rm -f $(SBINFILES) \
)
( cd $(DESTDIR)$(LIBDIR)/templates && \
rm -f $(TEMPLATES) \
)
rmdir $(DESTDIR)$(LIBDIR)/templates || :
rmdir $(DESTDIR)$(ETCDIR) || :
uninstall-man: check-config
for m in $(BINFILES); do \
rm -f $(DESTDIR)$(MANDIR)/man1/$$m.*; \
done
for m in $(SBINFILES); do \
rm -f $(DESTDIR)$(MANDIR)/man8/$$m.*; \
done
# Various testing/debugging/etc targets
# We insert a "use lib 'lib/';" line into the perl scripts, so that
# they use the local database and libraries, so they also work correctly on
# systems with installed Foomatic.
inplace: testing
testing: INPLACE = --inplace
testing: defaults foomatic-combo-xml foomatic-perl-data man
ln -sf lib/Foomatic .; \
for m in $(BINFILES) $(SBINFILES); do \
$(PERL) -p -i -e "s=^\#\x21$(PERL)(.*)\n=\#\x21$(PERL)\$$1\nuse lib '`pwd`/lib/';\n=s" $$m; \
done
chmod a+rx $(AC_OUTPUT_FILES)
# Links for more convenient usage of the "inplace" installation
ln -sf $(LOCAL_FOOMATIC_RIP) foomatic-rip
ln -sf `pwd`/foomatic-ppdfile foomatic-datafile
# Script for the man pages
echo -en '#!/bin/sh\nman ./\044\061.[1-9n] 2>/dev/null || man \044\061\n' > man || :
chmod a+rx man || :
inplace-clean: testing-clean
testing-clean: clean
# Remove editor backup and temporary files
remove-trash:
for m in $(TRASHFILES); do \
find . -name "$$m" -exec rm "{}" \; ; \
done
# We need to export all Variables for makeDefaults and the target to
# work.
.EXPORT_ALL_VARIABLES:
# Use INPLACE=--inplace to get the special run-in-place Defaults.
defaults: lib/Foomatic/Defaults.pm
lib/Foomatic/Defaults.pm: Makefile makeDefaults
chmod a+rx ./makeDefaults
./makeDefaults $(INPLACE)
if [ x$(INPLACE) = x--inplace ] ; then touch .testing-stamp ; fi
.PHONY: all defaults check-config build install install-bin \
man inplace testing clean inplace-clean testing-clean distclean \
maintainer-clean