#
# 1. System specific settings
# 

# GNU/Linux and GNU/Hurd
CC = gcc
CFLAGS = -DHAVE_VASPRINTF -DHAVE_GETOPT_LONG -D_GNU_SOURCE -ansi -pedantic -W -Wall -O2
LFLAGS = -s
EXTRAOBJS =

# FreeBSD, NetBSD, OpenBSD
#CC = gcc
#CFLAGS = -DHAVE_VASPRINTF -DHAVE_GETOPT_LONG -ansi -pedantic -W -Wall -O2
#LFLAGS = -s
#EXTRAOBJS = 

# SunOS
#CC = cc
#CFLAGS = -UHAVE_VASPRINTF -UHAVE_GETOPT_LONG
#LFLAGS = -lsocket -lnsl -s
#EXTRAOBJS = getopt.o getopt1.o

# If your system is not listed above, find out the settings yourself:
# - If your system has the getopt_long() function (try man 3 getopt_long),
#   use -DHAVE_GETOPT_LONG and set EXTRAOBJS to an empty string (see the
#   GNU/Linux section for an exmaple). If it doesn't have getopt_long, 
#   use -UHAVE_GETOPT_LONG and set EXTRAOBJS to getopt.o getopt1.o (see
#   the SunOS section).
# - If your system has the vasprintf() function (try man 3 vasprintf),
#   use -DHAVE_VASPRINTF (see GNU/Linux), else use -UHAVE_VASPRINTF (see 
#   SunOS).
# - Set LFLAGS to -s and add system specific flags if necessary 
#   (see SunOS: -lsocket and -lnsl).
# Please send your settings to marlam@users.sourceforge.net for inclusion
# in later versions of msmtp!

#
# 2. Choose EITHER GnuTLS/libgcrypt OR OpenSSL
#

# Use GnuTLS/libgcrypt instead of OpenSSL
#CFLAGS += -DUSE_GNUTLS `libgnutls-config --cflags`
#LFLAGS += `libgnutls-config --libs`
# Use OpenSSL instead of GnuTLS/libgcrypt
CFLAGS += -UUSE_GNUTLS		# add -I/path/to/openssl/include if necessary
LFLAGS += -lssl -lcrypto 	# add -L/path/to/openssl/lib if necessary

#
# 3. Choose EITHER GnuSASL OR built-in code
#

# Use GnuSASL (libgsasl)
#CFLAGS += -DUSE_GSASL		# -add -I/path/to/libgsasl/include if necessary
#LFLAGS += -lgsasl		# -add -L/path/to/libgsasl/lib if necessary
# Use built in authentication code
CFLAGS += -UUSE_GSASL
EXTRAOBJS += base64.o cram_md5.o


###############################################################################

PROG = msmtp
OBJS = msmtp.o conffile.o esmtp.o net.o tls.o merror.o list.o xmalloc.o \
	$(EXTRAOBJS)

all:
		make $(PROG)

$(PROG):	$(OBJS)
		$(CC) -o $(PROG) $(OBJS) $(LFLAGS)


msmtp.1.html:	msmtp.1
		groff -Thtml -mandoc msmtp.1 > msmtp.1.html


clean:
		rm -f *.o *~ core $(PROG)
clear:
		rm -f *.o *~ core
