# Generated automatically from Makefile.in by configure.
##
##  Makefile -- smtpclient makefile
##  Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. 
##

#-----------------------------------------------------
TOPDIR  :=  $(shell /bin/pwd)
TOPDIR  :=  $(TOPDIR)/..

include $(TOPDIR)/prerules.mk
#-----------------------------------------------------


# ------------------------------------------------
#   DEFINITIONS
# ------------------------------------------------

CFLAGS          += -g -O2
LDFLAGS         = 
LIBS            =  -lnsl -lresolv

INSTALL         = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL} -s -m 755
INSTALL_SCRIPT  = ${INSTALL} -m 755
INSTALL_DATA    = ${INSTALL} -m 644
MKDIR           = ./etc/mkinstalldirs

prefix          = /usr/local

# ------------------------------------------------
#   THE DEFAULT TARGETS
# ------------------------------------------------

all: config smtpclient smtpclient.1

# ------------------------------------------------
#   THE CONFIGURATION SUPPORT
# ------------------------------------------------

config: configure config.h.in

configure: configure.in 
	rm -f configure
	autoconf configure.in >configure
	chmod 770 configure

config.h.in: configure.in
	rm -f config.h.in
	autoheader configure.in >config.h.in

# ------------------------------------------------
#   THE RELEASE STUFF
# ------------------------------------------------

_GETDISTINFO = \
    _version=`./etc/newvers -lc -d smtpclient_vers.c`; \
    _date=`date '+%y%m%d_%H%M'`

_BUILDDIST = \
    echo "Creating tarball..."; \
    tar cvf - * |\
    tardy --user_number=1000  --user_name=rse \
          --group_number=1000 --group_name=en \
          --prefix=$${_distname} - |\
    gzip >$${_tarball}; \
    echo "Done"; \
    ls -l $${_tarball}

_NEWVERS = \
    ./etc/newvers -lc -p SMTPclient $$OPT smtpclient_vers.c; \
    V=`./etc/newvers -lc -D gfont_vers.c`;\
    sed -e "s/Version .*(.*)/Version $$V/g" <README >README.n && mv README.n README

_UPDATEVERS = \
    V=`./etc/newvers -lc -d smtpclient_vers.c`;\
    ./etc/newvers -lc -p SMTPclient -r $$V smtpclient_vers.c; \
    V=`./etc/newvers -lc -D smtpclient_vers.c`;\
    sed -e "s/Version .*(.*)/Version $$V/g" <README >README.n && mv README.n README

release: distclean fixperm
	@$(_GETDISTINFO) \
    _distname="smtpclient-$${_version}"; \
    _tarball="/tmp/$${_distname}.tar.gz"; \
    echo "Release Distribution: SMTPclient Version $$_version"; \
    $(_BUILDDIST); \
    mv /tmp/$${_distname}.tar.gz $${_distname}.tar.gz; \

new-version:
	OPT=-iv; $(_NEWVERS)

new-revision:
	OPT=-ir; $(_NEWVERS)

new-betalevel:
	OPT=-ib; $(_NEWVERS)

new-patchlevel:
	OPT=-iP; $(_NEWVERS)

new-release:
	OPT=-r$(R); $(_NEWVERS)

update-version:
	$(_UPDATEVERS)

fixperm:
	./etc/fixperm *

# ------------------------------------------------
#   THE PROGRAM
# ------------------------------------------------

smtpclient: smtpclient_main.o smtpclient_getopt.o smtpclient_errno.o smtpclient_vers.o dns.o
	$(CC) $(LDFLAGS) -o smtpclient smtpclient_main.o smtpclient_getopt.o smtpclient_errno.o smtpclient_vers.o dns.o $(LIBS)
	$(STRIP) $@

smtpclient_main.o: smtpclient_main.c
	$(CC) $(CFLAGS) -o smtpclient_main.o -c smtpclient_main.c

smtpclient_getopt.o: smtpclient_getopt.c
	$(CC) $(CFLAGS) -o smtpclient_getopt.o -c smtpclient_getopt.c

smtpclient_errno.o: smtpclient_errno.c
	$(CC) $(CFLAGS) -o smtpclient_errno.o -c smtpclient_errno.c

smtpclient_vers.o: smtpclient_vers.c
	$(CC) $(CFLAGS) -o smtpclient_vers.o -c smtpclient_vers.c
dns.o:dns.c
	$(CC) $(CFLAGS) -o dns.o -c dns.c

# ------------------------------------------------
#   THE DOCUMENTATION
# ------------------------------------------------

smtpclient.1: smtpclient.pod
	V=`./etc/newvers -l c -D smtpclient_vers.c`; \
    sed -e "s|\@V\@|$$V|g" \
        <smtpclient.pod >/tmp/smtpclient.pod; \
    pod2man --section=1 \
            --center="Ralf S. Engelschall" \
            --release="EN" \
            /tmp/smtpclient.pod >smtpclient.1 && \
    rm -f /tmp/smtpclient.pod

# ------------------------------------------------
#   INSTALLATION
# ------------------------------------------------

install: all
	mkdir -p $(T_USBIN)
	cp -pdR smtpclient $(T_USBIN)

# ------------------------------------------------
#   CLEANUP
# ------------------------------------------------

clean:
	-rm -f *.[od]
	-rm -f smtpclient 
	-rm -f core *.core
	-rm -f *~

distclean:
	-@make clean
	-rm -f config.h
	-rm -f config.status config.cache config.log
	-rm -f Makefile

#-----------------------------------------------------
include $(TOPDIR)/rules.mk
#-----------------------------------------------------
##EOF##
