#
# "$Id: Makefile 343 2007-07-13 19:52:48Z mike $"
#
#   Makefile for the CUPS DDK.
#
#   Copyright 2007 by Apple Inc.
#   Copyright 2002-2007 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


#
# Subdirectories...
#

SUBDIRS	=	\
		cups \
		ppdc \
		data \
		doc \
		examples \
		man \
		po


#
# Make everything...
#

all:		config.h Makedefs
	for dir in $(SUBDIRS); do \
		echo Making all in $$dir...;\
		(cd $$dir ; $(MAKE) $(MFLAGS)) || exit 1;\
	done


#
# Clean everything...
#

clean:
	$(RM) core
	$(RM) core.* *.bak *.bck
	for dir in $(SUBDIRS); do \
		echo Cleaning all in $$dir...;\
		(cd $$dir ; $(MAKE) $(MFLAGS) clean) || exit 1;\
	done


#
# Clean for distribution...
#

distclean:	clean
	$(RM) config.h config.log config.status
	$(RM) cupsddk.list Makedefs
	$(RM) -r autom4te*


#
# Update dependencies...
#

depend:
	for dir in $(SUBDIRS); do \
		echo Updating dependencies in $$dir...;\
		(cd $$dir ; $(MAKE) $(MFLAGS) depend) || exit 1;\
	done


#
# Install...
#

install:
	for dir in $(SUBDIRS); do \
		echo Installing all in $$dir...;\
		(cd $$dir ; $(MAKE) $(MFLAGS) install) || exit 1;\
	done


#
# Uninstall...
#

uninstall:
	for dir in $(SUBDIRS); do \
		echo Uninstalling all in $$dir...;\
		(cd $$dir ; $(MAKE) $(MFLAGS) uninstall) || exit 1;\
	done


#
# Make software distributions using EPM (http://www.easysw.com/epm/)...
#

EPMFLAGS	=	-v --output-dir dist $(EPMARCH)

aix bsd deb depot inst pkg setld slackware swinstall tardist:
	epm $(EPMFLAGS) -f $@ cupsddk packaging/cupsddk.list

epm:
	epm $(EPMFLAGS) -s packaging/cupsddk.xpm cupsddk packaging/cupsddk.list

osx:
	epm $(EPMFLAGS) -f osx -s packaging/cupsddk.tif cupsddk packaging/cupsddk.list

rpm:
	epm $(EPMFLAGS) -f rpm -s packaging/cupsddk.xpm cupsddk packaging/cupsddk.list

.PHONEY:	dist
dist:	all
	$(RM) -r dist
	$(MAKE) $(MFLAGS) epm
	case `uname` in \
		*BSD*) $(MAKE) $(MFLAGS) bsd;; \
		Darwin*) $(MAKE) $(MFLAGS) osx;; \
		IRIX*) $(MAKE) $(MFLAGS) tardist;; \
		Linux*) $(MAKE) $(MFLAGS) rpm;; \
		SunOS*) $(MAKE) $(MFLAGS) pkg;; \
	esac


#
# autoconf stuff...
#

Makedefs:		configure Makedefs.in
	if test -f config.status; then \
		./config.status --recheck || exit 1; \
		./config.status || exit 1; \
	else \
		./configure || exit 1; \
	fi
	touch config.h

config.h:		configure config.h.in
	if test -f config.status; then \
		./config.status --recheck || exit 1; \
		./config.status || exit 1; \
	else \
		./configure || exit 1; \
	fi
	touch config.h


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