# Skem Makefile for BSD-derived systems (tested on FreeBSD). People
# porting to other systems are encouraged to write their own -- all you
# need is to compile up to 3 C files into an multi-threaded exectuable
# and link it with the sendmail-supplied libmilter.

PROG=	skem
MAN=	skem.8

WARNS=	3

SRCS=	milter.c

PREFIX?=/usr/local
BINDIR=	${PREFIX}/sbin
MANDIR=	${PREFIX}/man/man

.ifndef SKEM_NO_LOGWATCHER
SRCS+=	logwatcher.c
CFLAGS+=-DSKEM_LOGWATCHER
.endif

.ifndef SKEM_NO_CLEANUP
SRCS+=	cleanup.c
CFLAGS+=	-DSKEM_CLEANUP
.endif

# Append gcc-specific flags:
.if ${CC:T} == "cc" || ${CC:T} == "gcc"
CFLAGS+=-Wall -Werror -Wno-parentheses \
		-W -Wall -ansi -Wcast-align \
                -Wcast-qual -Wchar-subscripts -Winline \
                -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
                -Wredundant-decls -Wshadow -Wstrict-prototypes # -Wwrite-strings

.endif

CFLAGS+=${PTHREAD_CFLAGS}
CFLAGS+=-DNETINET
# Should libmilter live outside of the compiler's default search paths,
# point at it from the environment -- a variable set on make's command
# line would override the CFLAGS above instead of adding to them:
#	env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib make
# Add NO_WDATE_TIME=yes, if the compiler objects to the __DATE__ and
# the __TIME__ in the version-string.
LDADD+=	-lmilter -lpthread

.include <bsd.prog.mk>
