## Makefile.am -- Process this file with automake to produce Makefile.in
# $Id: Makefile.am,v 1.273 2007/05/05 04:08:02 ca Exp $

MAINTAINERCLEANFILES	= Makefile.in

INCLUDES		= -I$(top_builddir) -I$(top_builddir)/include -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/..

IS		= include/sm
ISM		= $(top_srcdir)/include/sm
noinst_HEADERS	= $(ISM)/assert.h \
	$(ISM)/avl.h \
	$(ISM)/base64.h \
	$(ISM)/bf.h \
	$(ISM)/bhtable.h \
	bhtable.h \
	$(ISM)/bht2.h \
	$(ISM)/bht-int.h \
	$(ISM)/bitstring.h \
	$(ISM)/cdefs.h \
	$(ISM)/clock.h \
	$(ISM)/common.h \
	$(ISM)/connctl.h \
	$(ISM)/confsetpath.h \
	$(ISM)/cstr.h \
	$(ISM)/ctype.h \
	$(ISM)/da.h \
	$(ISM)/das.h \
	$(ISM)/debug.h \
	$(ISM)/dirent.h \
	$(ISM)/err.h \
	$(ISM)/errlog.h \
	$(ISM)/error.h \
	$(ISM)/sm_extracthdr.h \
	$(ISM)/fcntl.h \
	$(ISM)/fdset.h \
	$(ISM)/fs.h \
	$(ISM)/generic.h \
	$(ISM)/greyctl.h \
	$(ISM)/greycnf.h \
	$(ISM)/greycnfdef.h \
	greyctl.h \
	$(ISM)/hdrmod.h \
	$(ISM)/heap.h \
	$(ISM)/hostname.h \
	$(ISM)/io.h \
	$(ISM)/ioctl.h \
	$(ISM)/iostub.h \
	$(ISM)/limits.h \
	$(ISM)/log.h \
	$(ISM)/magic.h \
	$(ISM)/mem.h \
	$(ISM)/memops.h \
	$(ISM)/misc.h \
	$(ISM)/net.h \
	$(ISM)/note.h \
	$(ISM)/param.h \
	$(ISM)/ring.h \
	$(ISM)/ringhd.h \
	$(ISM)/rpool-int.h \
	$(ISM)/rpool.h \
	$(ISM)/setjmp.h \
	$(ISM)/servid.h \
	$(ISM)/sha.h \
	$(ISM)/signal.h \
	$(ISM)/socket.h \
	$(ISM)/stat.h \
	$(ISM)/statfs.h \
	$(ISM)/stdio.h \
	$(ISM)/str-int.h \
	$(ISM)/str.h \
	$(ISM)/strexp.h \
	$(ISM)/reccom.h \
	$(ISM)/regex.h \
	$(ISM)/resource.h \
	$(ISM)/rcb.h \
	$(ISM)/rcbl.h \
	$(ISM)/rcbst.h \
	$(ISM)/rcbcomm.h \
	$(ISM)/rdstr.h \
	$(ISM)/rsc-int.h \
	$(ISM)/rsc.h \
	$(ISM)/rsct.h \
	$(ISM)/strrcb.h \
	$(ISM)/str2rcb.h \
	$(ISM)/string.h \
	$(ISM)/sysexits.h \
	$(ISM)/syslog.h \
	$(ISM)/test.h \
	$(ISM)/time.h \
	$(ISM)/tlscnf.h \
	$(ISM)/tlscnfs.h \
	$(ISM)/tlsreqcnf.h \
	$(ISM)/tlsreqcnfs.h \
	$(ISM)/tree.h \
	$(ISM)/types.h \
	$(ISM)/uio.h \
	$(ISM)/units.h \
	$(ISM)/util.h \
	$(ISM)/varargs.h \
	$(ISM)/wait.h \
	$(ISM)/pool.h \
	$(ISM)/queue.h \
	$(ISM)/mman.h \
	$(ISM)/cmsg.h \
	$(ISM)/rfc2821.h $(ISM)/rfc2822.h \
	$(ISM)/unixsock.h \
	$(ISM)/stsock.h \
	$(ISM)/stthreads.h \
	$(ISM)/fxszq.h \
	$(ISM)/smtpdef.h \
	$(ISM)/smtls.h \
	$(ISM)/tls.h \
	$(ISM)/tlsbio.h \
	$(ISM)/sasl.h \
	heapdbg.h

## used by pmilter
## note: this is an X.1 item
pkginclude_HEADERS = $(ISM)/hdrmoddef.h

# currently unused:
#	$(ISM)/sterror.h

##	$(ISM)/batv.h
##	$(ISM)/batvcnf.h
##	$(ISM)/batvcnfdef.h

## not (yet) required:
##	$(ISM)/msg.h

#	$(ISM)/strtemplate.h
#	$(ISM)/conncache.h

SMIO	= blockmode.c \
	bf.c \
	dldf.c \
	falign.c \
	findfp.c \
	fclose.c \
	fflush.c \
	fopen.c \
	ffill.c \
	fgetncstr.c \
	fgetn.c \
	fgetint.c \
	fpad.c \
	fprintf.c \
	fputint.c \
	fput2int.c \
	fput3int.c \
	fput.c \
	fputn.c \
	fputcstr.c \
	fputstr.c \
	fputv.c \
	fread.c \
	fscanf.c \
	fskip.c \
	fseek.c \
	fvwrite.c \
	fwalk.c \
	fwrite.c \
	makebuf.c \
	memdup.c \
	putc.c \
	read_wait.c \
	refill.c \
	setvbuf.c \
	smiotord.c \
	smstdio.c \
	snprintf.c \
	sscanf.c \
	stdio.c \
	stthreadsio.c \
	strprintf.c \
	strvprintf.c \
	str2file.c \
	ungetc.c \
	vfprintf.c \
	vfscanf.c \
	vprintf.c \
	vsnprintf.c \
	vasprintf.c \
	vsscanf.c \
	wbuf.c \
	write_wait.c \
	wsetup.c \
	fvwrite.h \
	io-int.h \
	io-glue.h \
	smerr2txt.h
# not yet:
#	smionull.c
#	asprintf.c
##	strprint.c

noinst_PROGRAMS	= t-hostname \
	statit
noinst_LIBRARIES	= \
	libmta.a libmtar.a \
	libsmmisc.a libsmmiscr.a \
	libsmctl.a libsmctlr.a \
	librcb.a librcbst.a librsct.a \
	librcbcomm.a \
	libdb2keys.a \
	libcstr.a libcstrr.a \
	libsmtls.a \
	libstthreads.a \
	libsmsasl.a

## disabled
##	libbatv.a

RWFD	= read_fd.c write_fd.c

LIBMTA_SRCS	= assert.c \
	arpadate.c \
	bhtable.c bhtmap.c rsc.c \
	childstatus.c \
	heap.c \
	mem.c \
	ptrhash.c \
	log.c \
	$(SMIO) \
	ring.c \
	rpool.c \
	recvfd.c sendfd.c \
	memcaseq.c \
	$(RWFD) \
	strto.c \
	strc.c strclr.c strcmp.c strcasecmp.c \
	strcatmv.c strcopydata.c strcrt.c streq.c \
	strfree.c strget.c strgetlen.c strgetmax.c strgetsize.c \
	strdc.c \
	strnew.c strresize.c \
	strscopy.c strsetmax.c strspace.c \
	strstr.c strstr0.c \
	strshorten.c \
	strscatn.c \
	strscatv.c \
	strlower.c \
	strshift.c \
	strunquote.c \
	strfchrquoted.c \
	strfchr.c \
	strlchr.c \
	strrmtrail.c \
	strrmtrailsp.c \
	strsanitize.c \
	strput.c strputint.c strputstr.c \
	strscpy0.c \
	strwrelem.c \
	strrdelem.c \
	strcatpart.c \
	strsplit.c \
	str2argv.c \
	str2args.c \
	strexpdig.c \
	strexpmac.c \
	strexpmaccb.c \
	getnextstring.c \
	fgetline.c \
	fgetline0.c \
	getsmtpsid.c \
	id2idc.c \
	rfc2821.c rfc2822.c \
	rfc2821dom.c \
	rfc2821local.c \
	rfc2821parts.c \
	sm_extracthdr.c \
	sm_mkdir.c \
	sm_inet_a2ipv4.c sm_inet_ipv42a.c \
	sm_inet_ipv42arpa.c sm_inet_arpa2ipv4.c \
	myhostname.c \
	unixsock.c unixsockconn.c unixsocklisten.c unixaccept.c \
	netsockconn.c netsocklisten.c netaccept.c \
	netsockconnipv4.c \
	socklisten.c \
	sockaccept.c \
	sockconn.c \
	parsesockstr.c \
	tree.c tree2.c tree-fn.c tree-search.c tree-depth.c \
	tree-walk.c tree-destroy.c \
	connctl.c \
	xtextify.c \
	freediskspace.c fsspace.c \
	malloc.c \
	smerr2txt.c \
	exit2txt_r.c \
	smrslv2txt.c \
	prtfmtted.c \
	hdrmodh.c \
	hdrmodins.c \
	verpify.c

# currently unused:
#	smerr2txt_r.c
#	sterror.c
#	avl.c
#	rfc2821locdet.c		superseeded by rfc2821parts.c


LIBSMSASL_SRCS	= sasl-common.c

LIBSMMISC_SRCS	= \
	chkpidfile.c \
	cpu_count.c \
	dbgcat.c \
	errno2err.c \
	genconfpath.c \
	parsectlvl.c \
	pm_add_domain.c \
	servid.c \
	sm_dirname.c \
	sm_prtrlimits.c \
	us_sleep.c \
	validdomain.c \
	timestamp.c

LIBSMCTL_SRCS	= \
	greyctl.c

## disabled:
##	duration2txt.c
## not (yet) required:
##	msg.c
## do not build these (for now)
##	pool.c
##	gettimeval.c gettimespec.c
##	conncache.c
##	strtemplate.c

LIBSMTLS_SRCS	= tlsbio.c \
		smtls.c \
		smtlsi.c \
		smtlsversion.c
libsmtls_a_SOURCES	= $(LIBSMTLS_SRCS)

libmta_a_SOURCES	= $(LIBMTA_SRCS)

libmtar_a_SOURCES	= $(LIBMTA_SRCS)
libmtar_a_CC=$(PTHREAD_CC)
libmtar_a_CFLAGS = -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
libmtar_a_LIBS=$(PTHREAD_LIBS) $(LIBS)

libsmmisc_a_SOURCES	= $(LIBSMMISC_SRCS)

libsmmiscr_a_SOURCES	= $(LIBSMMISC_SRCS)
libsmmiscr_a_CC		= $(PTHREAD_CC)
libsmmiscr_a_CFLAGS	= -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
libsmmiscr_a_LIBS	= $(PTHREAD_LIBS) $(LIBS)


libsmctl_a_SOURCES	= $(LIBSMCTL_SRCS)
libsmctlr_a_SOURCES	= $(LIBSMCTL_SRCS)
libsmctlr_a_CC		= $(PTHREAD_CC)
libsmctlr_a_CFLAGS	= -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
libsmctlr_a_LIBS	= $(PTHREAD_LIBS) $(LIBS)


##libbatv_a_SOURCES	= smbatvsign.c \
##	smbatvsign1.c \
##	smbatvsaddr.c \
##	smbatvvrfy.c \
##	smbatvgetkey.c

libstthreads_a_SOURCES	= $(RWFD) \
	stsock.c \
	stsocklisten.c \
	stsockspec.c \
	stthreadssignal.c \
	errlog.c
libstthreads_a_CFLAGS = -DMTA_USE_STATETHREADS

libsmsasl_a_SOURCES	= $(LIBSMSASL_SRCS)
libsmsasl_a_CFLAGS	= $(MTA_SASL_INC)

RCBS = strnew.c strfree.c \
	strresize.c strgetlen.c strgetmax.c strgetsize.c \
	rcbopen.c rcbopen2.c \
	rcbget.c \
	rcbgetint.c \
	rcbget2int.c \
	rcbget3int.c \
	rcbget4int.c \
	rcbgetaint.c \
	rcbgetuint64.c \
	rcbget3uint64.c \
	rcbskip.c \
	rcbpeek2int.c \
	rcbgetn.c \
	rcbgetstr.c \
	rcbgetnstr.c \
	rcbgetn0str.c \
	rcbgetdata.c \
	strput.c \
	strputint.c \
	rcbput2int.c \
	rcbput3int.c \
	rcbput4int.c \
	rcbputnint.c \
	rcbputaint.c \
	rcbputuint64.c \
	rcbput3uint64.c \
	rcbputastr.c \
	rcbputv.c rcbputrec.c \
	strputstr.c strscatn.c strscatv.c \
	rcbputinit.c strclr.c \
	rcbrcv.c rcbsnd.c \
	rcbenew.c rcbefree.c rcbesetcb.c \
	hdrmodlrd.c \
	hdrmodlwr.c

##	strc.c \
##	strcatmv.c
librcb_a_SOURCES= $(RCBS)
librcb_a_CFLAGS	= -DSM_STR_READ

librcbst_a_SOURCES	= $(RCBS)
librcbst_a_CFLAGS	= -DSM_STR_READ -DSM_RCB_ST

librsct_a_SOURCES= rsc.c
librsct_a_CC=$(PTHREAD_CC)
librsct_a_CFLAGS= -DSM_RSC_TYPED -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
librsct_a_LIBS=$(PTHREAD_LIBS) $(LIBS)

RCBCOMM = rcbcomm.c
librcbcomm_a_SOURCES	= $(RCBCOMM)
librcbcomm_a_CFLAGS	= -DSM_STR_READ

libdb2keys_a_SOURCES	= bhtable.c
libdb2keys_a_CFLAGS	= -DSM_TWO_KEYS

LIBCSTR_SRCS	= cstrcmp.c cstreq.c cstrcaseq.c cstrcrt.c cstrscpyn.c \
		cstrscpyn0.c cstrfree.c rcbgetncstr.c \
		cstrscpyv0.c \
		cstrdup.c

libcstr_a_SOURCES	= $(LIBCSTR_SRCS)
libcstrr_a_SOURCES	= $(LIBCSTR_SRCS)
libcstrr_a_CC=$(PTHREAD_CC)
libcstrr_a_CFLAGS = -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
libcstrr_a_LIBS=$(PTHREAD_LIBS) $(LIBS)

sbin_PROGRAMS = greyprint \
	greyrm

# compile and run
TESTP = t-hostname \
	t-errno2err \
	t-exit2txt-0 \
	t-getsmtpsid \
	t-id2idc \
	t-idcmp \
	t-dirname \
	t-strexpmac \
	t-strexpmaccb \
	t-validdomain \
	t-log-0 \
	t-greyctl-0 \
	statit \
	t-parsesockstr \
	t-hdrmodh-0 \
	t-pmadd \
	t-dldf-0
## disabled:
##	t-duration2txt
# compile only, do not run
TESTC = t-extracthdr \
	t-greyctl-1 \
	t-greyctl-2 \
	t-greycnf-0 \
	t-greyrm \
	t-chkpidfile \
	t-verpify
# run only
TESTSH = t-extracthdr-0.sh \
	t-chkpidfile.sh \
	t-verpify-0.sh
# do not run at all...
TESTDATA = 

# list programs to compile here
check_PROGRAMS 		= $(TESTP) $(TESTC)

TESTS = $(TESTP) $(TESTSH)

EXTRA_DIST 	= $(TESTSH) $(TESTDATA)

LDADD		= ../libmta/libmta.a
LDADDR		= ../libmta/libmtar.a
LDCSTR		= ../libmta/libcstr.a
LDREPL		= ../librepl/librepl.a
LDMISC		= ../libmta/libsmmisc.a
LDCTL		= ../libmta/libsmctl.a
LDCTLR		= ../libmta/libsmctlr.a
LDCONF		= ../libconf/libconf.a
LDCHK		= ../libcheck/libcheck.a
LDBDB		= @MTA_DB_LIB@

greyprint_SOURCES	= greyprint.c
greyprint_LDADD		=  $(LDTHR) $(LDADDR) $(LDBDB) $(PTHREAD_LIBS) $(LDREPL)
greyprint_CC		= $(PTHREAD_CC)
greyprint_CFLAGS	= -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
greyprint_LDFLAGS	= $(PTHREAD_CFLAGS)

greyrm_SOURCES	= greyrm.c
greyrm_LDADD	= $(LDCTL) $(LDTHR) $(LDADDR) $(LDBDB) $(PTHREAD_LIBS) $(LDREPL)
greyrm_CC	= $(PTHREAD_CC)
greyrm_CFLAGS	= -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
greyrm_LDFLAGS	= $(PTHREAD_CFLAGS)

statit_SOURCES	= statit.c
statit_LDADD	= $(LDREPL)

t_hostname_SOURCES	= t-hostname.c
t_hostname_LDADD	= $(LDADD) $(LDCHK) $(LDREPL)

t_errno2err_SOURCES	= t-errno2err.c
t_errno2err_LDADD	= $(LDADD) $(LDMISC) $(LDCHK) $(LDREPL)

t_exit2txt_0_SOURCES	= t-exit2txt-0.c
t_exit2txt_0_LDADD	= $(LDADD) $(LDMISC) $(LDCHK) $(LDREPL)

t_getsmtpsid_SOURCES	= t-getsmtpsid.c
t_getsmtpsid_LDADD	= $(LDADD) $(LDCHK) $(LDREPL)

t_id2idc_SOURCES	= t-id2idc.c
t_id2idc_LDADD		= $(LDADD) $(LDCHK) $(LDREPL)

t_idcmp_SOURCES		= t-idcmp.c
t_idcmp_LDADD		= $(LDADD) $(LDCHK) $(LDREPL)

t_dirname_SOURCES	= t-dirname.c
t_dirname_LDADD		= $(LDADD) $(LDMISC) $(LDCHK) $(LDREPL)

t_strexpmac_SOURCES	= t-strexpmac.c
t_strexpmac_LDADD	= $(LDADD) $(LDMISC) $(LDCHK) $(LDREPL)

t_extracthdr_SOURCES	= t-extracthdr.c
t_extracthdr_LDADD	= $(LDMISC) $(LDADD) $(LDCHK) $(LDREPL)

t_strexpmaccb_SOURCES	= t-strexpmac.c
t_strexpmaccb_LDADD	= $(LDADD) $(LDMISC) $(LDCHK) $(LDREPL)
t_strexpmaccb_CFLAGS	= $(CFLAGS) -DTEST_STREXPMAC_CB

t_validdomain_SOURCES	= t-validdomain.c
t_validdomain_LDADD	= $(LDMISC) $(LDADD) $(LDCHK) $(LDREPL)

t_greyctl_0_SOURCES	= t-greyctl-0.c
t_greyctl_0_LDADD	= $(LDCTLR) $(LDBDB) $(LDADDR) $(PTHREAD_LIBS) $(LDCHK) $(LDREPL)
t_greyctl_0_CC		= $(PTHREAD_CC)
t_greyctl_0_CFLAGS	= -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
t_greyctl_0_LDFLAGS	= $(PTHREAD_CFLAGS)

t_greyctl_1_SOURCES	= t-greyctl-1.c
t_greyctl_1_LDADD	= $(LDCTLR) $(LDBDB) $(LDADDR) $(PTHREAD_LIBS) $(LDCHK) $(LDREPL)
t_greyctl_1_CC		= $(PTHREAD_CC)
t_greyctl_1_CFLAGS	= -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
t_greyctl_1_LDFLAGS	= $(PTHREAD_CFLAGS)

t_greyctl_2_SOURCES	= t-greyctl-2.c
t_greyctl_2_LDADD	= $(LDCTLR) $(LDBDB) $(LDADDR) $(PTHREAD_LIBS) $(LDCHK) $(LDREPL)
t_greyctl_2_CC		= $(PTHREAD_CC)
t_greyctl_2_CFLAGS	= -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
t_greyctl_2_LDFLAGS	= $(PTHREAD_CFLAGS)

t_greycnf_0_SOURCES	= t-greycnf-0.c
t_greycnf_0_LDADD	= $(LDCONF) $(LDCTL) $(LDADD) $(PTHREAD_LIBS) $(LDCHK) $(LDREPL)

t_greyrm_SOURCES	= t-greyrm.c
t_greyrm_LDADD		= $(LDCTLR) $(LDBDB) $(LDADDR) $(PTHREAD_LIBS) $(LDCHK) $(LDREPL)
t_greyrm_CC		= $(PTHREAD_CC)
t_greyrm_CFLAGS		= -DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
t_greyrm_LDFLAGS	= $(PTHREAD_CFLAGS)

t_chkpidfile_SOURCES	= t-chkpidfile.c
t_chkpidfile_LDADD	= $(LDMISC) $(LDADD) $(LDREPL)

t_verpify_SOURCES	= t-verpify.c
t_verpify_LDADD		= $(LDADD) $(LDCHK) $(LDREPL)

t_parsesockstr_SOURCES	= t-parsesockstr.c
t_parsesockstr_LDADD	= $(LDMISC) $(LDADD) $(LDCHK) $(LDREPL)

t_hdrmodh_0_SOURCES	= t-hdrmodh-0.c
t_hdrmodh_0_LDADD	= $(LDADD) $(LDCSTR) $(LDCHK) $(LDREPL)

t_log_0_SOURCES		= t-log-0.c
t_log_0_LDADD		= $(LDADD) $(LDCHK) $(LDREPL)

t_pmadd_SOURCES	= t-pmadd.c
t_pmadd_LDADD	= $(LDMISC) $(LDADD) $(LDCHK) $(LDREPL)

t_dldf_0_SOURCES	= t-dldf-0.c
t_dldf_0_LDADD	= $(LDMISC) $(LDADD) $(LDCHK) $(LDREPL)

## _LDADD=$(PTHREAD_LIBS)
## _CC	=$(PTHREAD_CC)
## _CFLAGS=-DMTA_USE_PTHREADS $(PTHREAD_CFLAGS)
## _LDFLAGS=$(PTHREAD_CFLAGS)

## t_duration2txt_SOURCES	= t-duration2txt.c
## t_duration2txt_LDADD	= $(LDMISC) $(LDADD) $(LDCHK) $(LDREPL)


syntax highlighted by Code2HTML, v. 0.9.1