# Makefile for cyrus library
# 
# lib/Makefile.  Generated from Makefile.in by configure.
# 
# Copyright (c) 1994-2008 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 legal
#    details, please contact
#      Carnegie Mellon University
#      Center for Technology Transfer and Enterprise Creation
#      4615 Forbes Avenue
#      Suite 302
#      Pittsburgh, PA  15213
#      (412) 268-7393, fax: (412) 268-7395
#      innovation@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.75.2.1 2010/02/12 03:38:21 brong Exp $

# Authorization namespace.
AUTH=auth.o auth_krb.o auth_unix.o auth_krb5.o auth_pts.o

# ACL interpretation.  Only one choice for now:
ACL=acl_afs.o

srcdir = .
top_srcdir = ..


CC = gcc

INSTALL = /usr/bin/install -c -o pbulk -g users
RANLIB = ranlib

DEFS = -DHAVE_CONFIG_H 
CPPFLAGS = -I.. -I/usr/pkg/include/db4 -I/usr/pkg/include/db4 -I/usr/include -I/usr/pkg/include -I/usr/include -I/usr/include -I${top_srcdir}/com_err/et -I/usr/pkg/include
LIBS =   -lresolv -lfl   -L/usr/pkg/lib  -Wl,-R/usr/pkg/lib -ldb4 -lssl -lcrypto -lz

MAKEDEPEND_CFLAGS = -O2 -D_FORTIFY_SOURCE=2 -I/usr/pkg/include/db4 -I/usr/include -I/usr/pkg/include
CFLAGS = -O2 -D_FORTIFY_SOURCE=2 -I/usr/pkg/include/db4 -I/usr/include -I/usr/pkg/include -DPIC -fPIC 
LDFLAGS = -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib/perl5/5.30.0/earmv7hf-netbsd-thread-multi/CORE -L/usr/lib

SHELL = /bin/sh
MAKEDEPEND = makedepend

prefix = /usr/pkg
exec_prefix = ${prefix}
cyrus_prefix = /usr/pkg/cyrus

libdir = ${exec_prefix}/lib

BUILTSOURCES = imapopts.h imapopts.c

LIBCYR_HDRS = $(srcdir)/acl.h $(srcdir)/assert.h $(srcdir)/auth.h \
	$(srcdir)/bsearch.h $(srcdir)/charset.h $(srcdir)/glob.h \
	$(srcdir)/gmtoff.h $(srcdir)/imclient.h $(srcdir)/imparse.h \
	$(srcdir)/lock.h $(srcdir)/map.h $(srcdir)/mkgmtime.h \
	$(srcdir)/nonblock.h $(srcdir)/parseaddr.h $(srcdir)/prot.h \
	$(srcdir)/retry.h $(srcdir)/sysexits.h $(srcdir)/strhash.h \
	$(srcdir)/lsort.h $(srcdir)/stristr.h \
	$(srcdir)/util.h $(srcdir)/xstrlcpy.h $(srcdir)/xstrlcat.h \
	$(srcdir)/xmalloc.h $(srcdir)/imapurl.h \
	$(srcdir)/cyrusdb.h $(srcdir)/iptostring.h $(srcdir)/rfc822date.h \
	$(srcdir)/libcyr_cfg.h $(srcdir)/byteorder64.h \
	$(srcdir)/md5.h $(srcdir)/hmac-md5.h

LIBCYR_OBJS = acl.o bsearch.o charset.o glob.o retry.o util.o \
	libcyr_cfg.o mkgmtime.o prot.o parseaddr.o imclient.o imparse.o \
	lsort.o stristr.o rfc822date.o cyrusdb.o strhash.o \
	chartable.o imapurl.o nonblock_fcntl.o lock_fcntl.o \
	gmtoff_tm.o map_shared.o $(ACL) $(AUTH) \
	 cyrusdb_flat.o cyrusdb_skiplist.o cyrusdb_quotalegacy.o cyrusdb_berkeley.o  \
	iptostring.o xmalloc.o wildmat.o byteorder64.o \
	xstrlcat.o xstrlcpy.o

LIBCYRM_HDRS = $(srcdir)/hash.h $(srcdir)/mpool.h $(srcdir)/xmalloc.h \
	$(srcdir)/xstrlcat.h $(srcdir)/xstrlcpy.h $(srcdir)/util.h \
	$(srcdir)/strhash.h $(srcdir)/libconfig.h $(srcdir)/assert.h \
	imapopts.h
LIBCYRM_OBJS = libconfig.o imapopts.o hash.o mpool.o xmalloc.o strhash.o \
	xstrlcat.o xstrlcpy.o assert.o util.o 

all: $(BUILTSOURCES) libcyrus_min.a libcyrus.a

install:
	$(srcdir)/../install-sh -d $(DESTDIR)$(libdir)
	$(INSTALL) -m 644 libcyrus.a $(DESTDIR)$(libdir)
	$(INSTALL) -m 644 libcyrus_min.a $(DESTDIR)$(libdir)
	 $(RANLIB) $(DESTDIR)$(libdir)/libcyrus.a
	for file in $(LIBCYR_HDRS); \
	do \
		$(INSTALL) -m 644 $$file $(DESTDIR)$(prefix)/include/cyrus || exit 1; \
	done
	for file in $(LIBCYRM_HDRS); \
	do \
		$(INSTALL) -m 644 $$file $(DESTDIR)$(prefix)/include/cyrus || exit 1; \
	done

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

libcyrus.a: $(LIBCYR_OBJS)
	rm -f libcyrus.a
	ar cr libcyrus.a $(LIBCYR_OBJS)
	$(RANLIB) libcyrus.a

libcyrus_min.a: $(LIBCYRM_OBJS)
	rm -f libcyrus_min.a
	ar cr libcyrus_min.a $(LIBCYRM_OBJS)
	$(RANLIB) libcyrus_min.a

imapopts.c: imapoptions $(srcdir)/../tools/config2header
	$(srcdir)/../tools/config2header CC="$(CC)" $(srcdir)/imapopts.c $(srcdir)/imapopts.h < $(srcdir)/imapoptions

imapopts.h: imapopts.c

chartable.c: mkchartable.pl
	@echo "### Building chartables..."
	rm -f chartable.c
	perl ./mkchartable.pl \
	 -m $(srcdir)/charset/unifix.txt	\
	 -m $(srcdir)/charset/unidata2.txt \
	 $(srcdir)/charset/*.t \
	 > chartable.c \
	 || (rm -f chartable.c && exit 1)
	@echo "### Done building chartables."

clean:
	rm -f *.o *.a chartable.c Makefile.bak makedepend.log \
	$(BUILTSOURCES)

distclean: clean
	rm -f Makefile

depend:
	${MAKEDEPEND} $(CPPFLAGS) $(DEFS) -I$(srcdir) $(MAKEDEPEND_CFLAGS) *.c $(srcdir)/*.c 1>makedepend.log 2>&1

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