# Make file for sendmail/src directory
#
# Things you might want to change.  Pass them in on the command line:
# ROOT - should point to the root where the commands will be installed
#        (e.g. /deliver/INETSVCS/indnetwk)

ROOT=

PRODUCTS=/usr/sbin/sendmail \
	/usr/sbin/smtpd \
	/usr/sbin/newaliases \
	/usr/bin/mailq \
	/usr/share/lib/sendmail.hf

# Defaults file containing the shell, compiler options, etc
BUILDRULES=/source/INETSVCS/$(LOGNAME)/config/defaults

include ${BUILDRULES}

LIBS= ../../util/libutil.a -ldbm -lndbm ../db/libdb.a

INCLUDES=-I../../include -I/usr/include -I../db -I.
CCFLAGS=$(INCLUDES) -DDEBUG -DHP_NFS -DNDBM -DNEWDB -DNIS $(CFLAGS) -DUSERDB

SRCS=   alias.c arpadate.c clock.c collect.c conf.c convtime.c daemon.c \
        deliver.c domain.c envelope.c err.c headers.c macro.c main.c \
        map.c mci.c mime.c parseaddr.c queue.c readcf.c recipient.c \
        savemail.c srvrsmtp.c stab.c stats.c sysexits.c \
        trace.c udb.c usersmtp.c util.c version.c \
	cdefs.h conf.h mailstats.h pathnames.h sendmail.h sysexits.h useful.h

OBJS=   alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o \
        deliver.o domain.o envelope.o err.o headers.o macro.o main.o \
        map.o mci.o mime.o parseaddr.o queue.o readcf.o recipient.o \
        savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
        trace.o udb.o usersmtp.o util.o version.o 

#Install database name
INSTALLDB=/source/INETSVCS/$(LOGNAME)/config/installdb

#Script called to parse the install deliverable
INSTALLSCPT=/source/INETSVCS/$(LOGNAME)/config/install_script

default: all

all: clean build install

clean:
	$(RM) -f core
	$(RM) -f $(OBJS)
	$(RM) -f sendmail
	$(RM) -f smtpd newaliases mailq
	$(RM) -f a.out Version.o
	$(RM) -f tags .depend 
	
install:
	for file in $(PRODUCTS) ; do \
		$(INSTALLSCPT) $$file $(INSTALLDB) ;  \
	done

.c.o:
	$(CC) $(CCFLAGS) -c $<

build:  sendmail 

sendmail:  $(OBJS)
	$(ECHO) "Building.. sendmail"
	$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

links:
	ln -s /usr/sbin/sendmail mailq
	ln -s /usr/sbin/sendmail newaliases
	ln -s /usr/sbin/sendmail smtpd	

