# Makefile for ptclient
# 
# @configure_input@
# 
# 
# Copyright (c) 1996-2000 Carnegie Mellon University.  All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer. 
#
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in
#    the documentation and/or other materials provided with the
#    distribution.
#
# 3. The name "Carnegie Mellon University" must not be used to
#    endorse or promote products derived from this software without
#    prior written permission. For permission or any other legal
#    details, please contact  
#      Office of Technology Transfer
#      Carnegie Mellon University
#      5000 Forbes Avenue
#      Pittsburgh, PA  15213-3890
#      (412) 268-4387, fax: (412) 268-7395
#      tech-transfer@andrew.cmu.edu
#
# 4. Redistributions of any form whatsoever must retain the following
#    acknowledgment:
#    "This product includes software developed by Computing Services
#     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
#
# CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
# THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
# FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
# OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# $Id: Makefile.in,v 1.27 2004/05/28 18:03:08 rjs3 Exp $
# 
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
PURIFY = /usr/local/bin/purify

CC = @CC@
INSTALL = @INSTALL@
RANLIB = @RANLIB@

DEFS = @DEFS@
CPPFLAGS = -I.. -I$(srcdir)/../imap -I$(srcdir)/../lib @COM_ERR_CPPFLAGS@ @CPPFLAGS@
AFS_LDFLAGS = @AFS_LDFLAGS@ @COM_ERR_LDFLAGS@
AFS_LIBS = @AFS_LIBS@
IMAP_LIBS = @IMAP_LIBS@ @LIB_RT@
LIBS = $(IMAP_LIBS) @COM_ERR_LIBS@
LIB_SASL = @LIB_SASL@
LIB_WRAP = @LIB_WRAP@
DEPLIBS = ../imap/libimap.a ../lib/libcyrus.a ../lib/libcyrus_min.a @DEPLIBS@
UTIL_LIBS = ../imap/mutex_fake.o ../imap/cli_fatal.o

LDAP_LIBS=@LDAP_LIBS@
LDAP_CPPFLAGS=@LDAP_CPPFLAGS@
LDAP_LDFLAGS=@LDAP_LDFLAGS@

CFLAGS = @CFLAGS@
LDFLAGS = @LDFLAGS@

SHELL = /bin/sh
MAKEDEPEND = @MAKEDEPEND@

prefix = @prefix@
exec_prefix = @exec_prefix@
cyrus_prefix = @cyrus_prefix@
service_path = @service_path@

EXTRA_PROGS = # ptextract pttest
PROGS = ptexpire ptloader ptdump $(EXTRA_PROGS)

LIB_RT = @LIB_RT@

SERVICE=../master/service.o
SERVICETHREAD=../master/service-thread.o

all: $(PROGS)

install:
	$(INSTALL) -m 755 ptloader $(DESTDIR)$(service_path)
	$(INSTALL) -m 755 ptexpire $(DESTDIR)$(service_path)
	$(INSTALL) -m 755 ptdump $(DESTDIR)$(service_path)

.c.o:
	$(CC) -c $(CPPFLAGS) $(LDAP_CPPFLAGS) $(DEFS) $(CFLAGS) $<

ptloader: ptloader.o @WITH_PTS@.o ../imap/mutex_fake.o $(DEPLIBS)
	$(CC) $(LDFLAGS) -o $@ ptloader.o @WITH_PTS@.o ../imap/mutex_fake.o $(SERVICETHREAD) ${AFS_LDFLAGS} ${LDAP_LDFLAGS} $(AFS_LIBS) ${LDAP_LIBS} $(DEPLIBS) $(LIB_SASL) $(LIBS) $(LIB_WRAP) $(LIB_RT)

ptloader.pure: ptloader.o @WITH_PTS@.o ../imap/mutex_fake.o $(DEPLIBS)
	$(PURIFY) $(PUREARGS) $(CC) $(LDFLAGS) -o $@ ptloader.o @WITH_PTS@.o ../imap/mutex_fake.o $(SERVICETHREAD) ${AFS_LDFLAGS} ${LDAP_LDFLAGS} $(AFS_LIBS) ${LDAP_LIBS} $(DEPLIBS) $(LIB_SASL) $(LIBS) $(LIB_WRAP) $(LIB_RT)

ptexpire: ptexpire.o $(DEPLIBS) $(UTIL_LIBS)
	$(CC) $(LDFLAGS) -o $@ ptexpire.o $(UTIL_LIBS) $(DEPLIBS) $(LIB_SASL) $(LIBS) $(LIB_RT)

ptexpire.pure: ptexpire.o $(DEPLIBS) $(UTIL_LIBS)
	$(PURIFY) $(PUREARGS) $(CC) $(LDFLAGS) -o $@ ptexpire.o $(UTIL_LIBS) $(DEPLIBS) $(LIB_SASL) $(LIBS) $(LIB_WRAP) $(LIB_RT)

ptdump: ptdump.o $(DEPLIBS) $(UTIL_LIBS)
	$(CC) $(LDFLAGS) -o $@ ptdump.o $(UTIL_LIBS) $(DEPLIBS) $(LIB_SASL) $(LIBS) $(LIB_RT)

ptdump.pure: ptexpire.o $(DEPLIBS) $(UTIL_LIBS)
	$(PURIFY) $(PUREARGS) $(CC) $(LDFLAGS) -o $@ ptdump.o $(UTIL_LIBS) $(DEPLIBS) $(LIB_SASL) $(LIBS) $(LIB_WRAP) $(LIB_RT)

ptextract: ptextract.o $(DEPLIBS) $(UTIL_LIBS)
	$(CC) $(LDFLAGS) -o $@ ptextract.o $(UTIL_LIBS) $(DEPLIBS) $(LIBS)

clean:
	rm -f *.o Makefile.bak $(PROGS) makedepend.log

distclean: clean
	rm -f Makefile

depend: 
	$(MAKEDEPEND) $(CPPFLAGS) $(DEFS) $(CFLAGS) *.c $(srcdir)/*.c \
	1>makedepend.log 2>&1

# DO NOT DELETE THIS LINE -- make depend depends on it.
