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

ifndef COMPILING_WHOLE_TREE	
TOPDIR=$(shell pwd)
endif

# Inclure les règles de base, et en particulier la macro make_subdirs
include $(TOPDIR)/Rules.make

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

#CC              = gcc
UDNS_DIR ?= ../udns
CFLAGS          = -g -O2 -I$(UDNS_DIR)
LDFLAGS         = 
LIBS            =  -lnsl -L$(UDNS_DIR) -ludns

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

prefix          = /opt/smtpclient

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

all: 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 :
	install -o root -g root -m 755 smtpclient $(ROOT_FS_DIR)/usr/bin/smtpclient

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 
	$(CC) $(LDFLAGS) -o smtpclient smtpclient_main.o smtpclient_getopt.o smtpclient_errno.o smtpclient_vers.o $(LIBS)

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

# ------------------------------------------------
#   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) $(prefix)/bin
	$(MKDIR) $(prefix)/man/man1
	$(INSTALL_PROGRAM) smtpclient $(prefix)/bin/smtpclient
	$(INSTALL_DATA) smtpclient.1 $(prefix)/man/man1/smtpclient.1

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

clean:
	-rm -f *.o
	-rm -f smtpclient 
	-rm -f core *.core
	-rm -f config.cache

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

##EOF##
