##
# Makefile automatically generated by genmake 1.0, May-03-00
# genmake 1.0 by muquit@muquit.com, http://www.muquit.com/
##
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
CC= @CC@
DEFS= @DEFS@ -DUNIX
PROGNAME= mailsend
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

DESTDIR = 
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
bindir = @bindir@
mandir = @mandir@
man1dir = $(mandir)/man1
BINDIR = $(DESTDIR)$(bindir)
MAN1DIR = $(DESTDIR)$(man1dir)

#BINDIR= /usr/bin
MANPAGE= doc/mailsend.1.gz
#MANDIR= /usr/share/man/man1

MUTILS_INCLUDE= -I./libs/libmutils
MSOCK_INCLUDE= -I./libs/libmsock
SLL_INCLUDE= -I./libs/libsll

MUTILS_LIB= ./libs/libmutils/libmutils.a
MSOCK_LIB=./libs/libmsock/libmsock.a
SLL_LIB= ./libs/libsll/libsll.a

OPENSSL_DIR=@OPENSSL_DIR@
OPENSSL_INC=@OPENSSL_INC@
OPENSSL_LIBS=@OPENSSL_LIBS@ @DL_LIB@

STRIP=@STRIP@

INCLUDES=  -I. $(MUTILS_INCLUDE) $(MSOCK_INCLUDE) $(SLL_INCLUDE) $(OPENSSL_INC)

DEFINES= $(INCLUDES) $(DEFS) -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 \
	-DHAVE_MATH_H=1

CFLAGS= @CFLAGS@ $(DEFINES)
LIBS=$(MSOCK_LIB) $(SLL_LIB) $(MUTILS_LIB) $(OPENSSL_LIBS) @LIBS@

SRCS = main.c smtp.c utils.c setget.c examples.c
OBJS = main.o smtp.o utils.o setget.o examples.o

.c.o:
	rm -f $@
	$(CC) $(CFLAGS) -c $*.c

all: $(PROGNAME)


$(PROGNAME) : mlibs $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o $(PROGNAME) $(LIBS)

install: installdirs install-bin install-man

install-bin: $(BINDIR) $(PROGNAME)
	$(INSTALL_PROGRAM) $(PROGNAME) $(BINDIR)/$(PROGNAME)

install-man:
	$(INSTALL_DATA) $(MANPAGE) $(MAN1DIR)

installdirs:
	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${bindir}
	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man1

deb:
	@ruby ./mk_debian_package.rb

help:
	@echo "make         - to compile"
	@echo "make install - to install"
	@echo "make docs    - generate document"
	@echo "make deb     - create debian package"

docs:
	@ruby scripts/mk_doc.rb
ex:
	@ruby scripts/mk_examples.rb > examples.c

libmsock: libmutils
	+make -C libs/libmsock

libmutils:
	+make -C libs/libmutils

libsll:
	+make -C libs/libsll

mlibs: libmsock libsll

clean:
	+(cd libs/libmsock && make clean)
	+(cd libs/libmutils && make clean)
	+(cd libs/libsll && make clean)
	rm -f *.o *~ core $(PROGNAME)
