#
# Common makefile definitions for CUPS.
#
# Copyright © 2007-2019 by Apple Inc.
# Copyright © 1997-2007 by Easy Software Products, all rights reserved.
#
# Licensed under Apache License v2.0.  See the file "LICENSE" for more
# information.
#

#
# CUPS version...
#

CUPS_VERSION    =       @CUPS_VERSION@


#
# Programs...
#

AR		=	@AR@
AWK		=	@AWK@
CC		=	@LIBTOOL_CC@ @CC@
CHMOD		=	@CHMOD@
CXX		=	@LIBTOOL_CXX@ @CXX@
DSO		=	@DSO@
DSOXX		=	@DSOXX@
GZIPPROG	=	@GZIPPROG@
INSTALL		=	@INSTALL@
LD		=	@LD@
LD_CC		=	@LD_CC@
LD_CXX		=	@LD_CXX@
LIBTOOL		=	@LIBTOOL@
LN		=	@LN@ -sf
MKDIR           =       @MKDIR@ -p
MV		=	@MV@
RANLIB		=	@RANLIB@
RM		=	@RM@ -f
RMDIR		=	@RMDIR@
SED		=	@SED@
SHELL		=	/bin/sh

#
# Installation programs...
#

INSTALL_BIN	=	@LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
INSTALL_COMPDATA =	$(INSTALL) -c -m 444 @INSTALL_GZIP@
INSTALL_CONFIG	=	$(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA	=	$(INSTALL) -c -m 444
INSTALL_DIR	=	$(INSTALL) -d
INSTALL_LIB	=	@LIBTOOL_INSTALL@ $(INSTALL) -c -m @CUPS_EXE_FILE_PERM@ @INSTALL_STRIP@
INSTALL_MAN	=	$(INSTALL) -c -m 444
INSTALL_SCRIPT	=	$(INSTALL) -c -m @CUPS_EXE_FILE_PERM@

#
# Default user, group, and system groups for the scheduler...
#

CUPS_USER	=	@CUPS_USER@
CUPS_GROUP	=	@CUPS_GROUP@
CUPS_SYSTEM_GROUPS =	@CUPS_SYSTEM_GROUPS@
CUPS_PRIMARY_SYSTEM_GROUP =	@CUPS_PRIMARY_SYSTEM_GROUP@

#
# Default permissions...
#

CUPS_CONFIG_FILE_PERM = @CUPS_CONFIG_FILE_PERM@
CUPS_CUPSD_FILE_PERM = @CUPS_CUPSD_FILE_PERM@
CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@

#
# Languages to install...
#

LANGUAGES	=	@LANGUAGES@
INSTALL_LANGUAGES =	@INSTALL_LANGUAGES@
UNINSTALL_LANGUAGES =	@UNINSTALL_LANGUAGES@

#
# Cross-compilation support: "local" target is used for any tools that are
# built and run locally.
#

LOCALTARGET     =       @LOCALTARGET@


#
# Libraries...
#

LIBCUPS		=	@LIBCUPS@
LIBCUPSIMAGE	=	@LIBCUPSIMAGE@
LIBCUPSOBJS	=	@LIBCUPSOBJS@
LIBCUPSSTATIC	=	@LIBCUPSSTATIC@
LIBGSSAPI	=	@LIBGSSAPI@
LIBHEADERS	=	@LIBHEADERS@
LIBHEADERSPRIV	=	@LIBHEADERSPRIV@
LIBMALLOC	=	@LIBMALLOC@
LIBPAPER	=	@LIBPAPER@
LIBUSB		=	@LIBUSB@
LIBWRAP		=	@LIBWRAP@
LIBZ		=	@LIBZ@

#
# Install static libraries?
#

INSTALLSTATIC	=	@INSTALLSTATIC@

#
# IPP backend aliases...
#

IPPALIASES	=	@IPPALIASES@


#
# ippeveprinter commands...
#

IPPEVECOMMANDS	=	@IPPEVECOMMANDS@


#
# Install XPC backends?
#

INSTALLXPC	=	@INSTALLXPC@

#
# Code signing...
#

CODE_SIGN	=	@CODE_SIGN@
CODE_SIGN_IDENTITY = -

#
# Program options...
#
# ARCHFLAGS     Defines the default architecture build options.
# OPTIM         Defines the common compiler optimization/debugging options
#               for all architectures.
# OPTIONS       Defines other compile-time options (currently only -DDEBUG
#               for extra debug info)
#

ALL_CFLAGS	=	-I.. -D_CUPS_SOURCE $(CFLAGS) \
			$(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \
			$(ONDEMANDFLAGS) $(OPTIONS)
ALL_CXXFLAGS	=	-I.. -D_CUPS_SOURCE $(CXXFLAGS) \
			$(SSLFLAGS) @LARGEFILE@ @PTHREAD_FLAGS@ \
			$(ONDEMANDFLAGS) $(OPTIONS)
ALL_DSOFLAGS	=	-L../cups @ARCHFLAGS@ @RELROFLAGS@ $(DSOFLAGS) $(OPTIM)
ALL_LDFLAGS	=	-L../cups @LDARCHFLAGS@ @RELROFLAGS@ $(LDFLAGS)  \
			@PIEFLAGS@ $(OPTIM)
ARCHFLAGS	=	@ARCHFLAGS@
ARFLAGS		=	@ARFLAGS@
BACKLIBS	=	@BACKLIBS@
BUILDDIRS	=	@BUILDDIRS@
CFLAGS		=	@CPPFLAGS@ @CFLAGS@
COMMONLIBS	=	@LIBS@
CXXFLAGS	=	@CPPFLAGS@ @CXXFLAGS@
CXXLIBS		=	@CXXLIBS@
DBUS_NOTIFIER	=	@DBUS_NOTIFIER@
DBUS_NOTIFIERLIBS =	@DBUS_NOTIFIERLIBS@
DNSSD_BACKEND	=	@DNSSD_BACKEND@
DSOFLAGS	=	@DSOFLAGS@
DNSSDLIBS	=	@DNSSDLIBS@
IPPFIND_BIN	=	@IPPFIND_BIN@
IPPFIND_MAN	=	@IPPFIND_MAN@
LDFLAGS		=	@LDFLAGS@
LINKCUPS	=	@LINKCUPS@
LINKCUPSSTATIC	=	../cups/$(LIBCUPSSTATIC) $(LIBS)
LIBS		=	$(LIBGSSAPI) $(DNSSDLIBS) $(SSLLIBS) $(LIBZ) $(COMMONLIBS)
ONDEMANDFLAGS	=	@ONDEMANDFLAGS@
ONDEMANDLIBS	=	@ONDEMANDLIBS@
OPTIM		=	@OPTIM@
OPTIONS		=	@WARNING_OPTIONS@
PAMLIBS		=	@PAMLIBS@
SERVERLIBS	=	@SERVERLIBS@
SSLFLAGS	=	@SSLFLAGS@
SSLLIBS		=	@SSLLIBS@
UNITTESTS	=	@UNITTESTS@


#
# Directories...
#
# The first section uses the GNU names (which are *extremely*
# difficult to find in a makefile because they are lowercase...)
# We have to define these first because autoconf uses ${prefix}
# and ${exec_prefix} for most of the other directories...
#
# The "datarootdir" variable may not get defined if you are using
# a version of autoconf prior to 2.60.
#
# This is immediately followed by definition in ALL CAPS for the
# needed directories...
#

bindir		=	@bindir@
datadir		=	@datadir@
datarootdir	=	@datarootdir@
exec_prefix	=	@exec_prefix@
includedir	=	@includedir@
infodir		=	@infodir@
libdir		=	@libdir@
libexecdir	=	@libexecdir@
localstatedir	=	@localstatedir@
mandir		=	@mandir@
oldincludedir	=	@oldincludedir@
prefix		=	@prefix@
privateinclude	=	@privateinclude@
sbindir		=	@sbindir@
sharedstatedir	=	@sharedstatedir@
srcdir		=	@srcdir@
sysconfdir	=	@sysconfdir@
top_srcdir	=	@top_srcdir@

BUILDROOT	=	$(DSTROOT)$(DESTDIR)

BINDIR		=	$(BUILDROOT)@bindir@
BUNDLEDIR	=	@CUPS_BUNDLEDIR@
CACHEDIR	=	$(BUILDROOT)@CUPS_CACHEDIR@
DATADIR		=	$(BUILDROOT)@CUPS_DATADIR@
DOCDIR		=	$(BUILDROOT)@CUPS_DOCROOT@
ICONDIR		=	@ICONDIR@
INCLUDEDIR	=	$(BUILDROOT)$(includedir)
LIBDIR		=	$(BUILDROOT)$(libdir)
LOCALEDIR	= 	$(BUILDROOT)@CUPS_LOCALEDIR@
LOGDIR		= 	$(BUILDROOT)@CUPS_LOGDIR@
MANDIR		=	$(BUILDROOT)@mandir@
MENUDIR		=	@MENUDIR@
PRIVATEINCLUDE	=	$(BUILDROOT)@PRIVATEINCLUDE@
RCLEVELS	=	@RCLEVELS@
RCSTART		=	@RCSTART@
RCSTOP		=	@RCSTOP@
REQUESTS	= 	$(BUILDROOT)@CUPS_REQUESTS@
RESOURCEDIR	=	@CUPS_RESOURCEDIR@
SBINDIR		=	$(BUILDROOT)@sbindir@
SERVERBIN	= 	$(BUILDROOT)@CUPS_SERVERBIN@
SERVERROOT	= 	$(BUILDROOT)@CUPS_SERVERROOT@
STATEDIR	=	$(BUILDROOT)@CUPS_STATEDIR@

PAMDIR		=	@PAMDIR@
PAMFILE		=	@PAMFILE@

DBUSDIR		=	@DBUSDIR@
INITDIR		=	@INITDIR@
INITDDIR	=	@INITDDIR@
LAUNCHD_DIR	=	@LAUNCHD_DIR@
SMFMANIFESTDIR	= 	@SMFMANIFESTDIR@
SYSTEMD_DIR	=	@SYSTEMD_DIR@
XINETD		=	@XINETD@

USBQUIRKS	=	@USBQUIRKS@


#
# Rules...
#

.SILENT:
.SUFFIXES:	.a .c .cxx .h .o

.c.o:
	echo Compiling $<...
	$(CC) $(ARCHFLAGS) $(OPTIM) $(ALL_CFLAGS) -c -o $@ $<

.cxx.o:
	echo Compiling $<...
	$(CXX) $(ARCHFLAGS) $(OPTIM) $(ALL_CXXFLAGS) -c -o $@ $<
