srcdir = @srcdir@
VPATH = @srcdir@
@SET_MAKE@

SHELL=		/bin/sh
CC=		@CC@
COPTS=		@CFLAGS@
CPPDEP=		@CPPDEP@
prefix=		@prefix@
exec_prefix=	@exec_prefix@
MAILBIN=	@MAILBIN@
MAILSHARE=	@MAILSHARE@
MANDIR=		@mandir@
INSTALL=	@INSTALL@
TOPDIR=		../..

VMSGDEF=	@MAILSHARE@/vacation.msg
DEFS=		@DEFS@ -DVMSGDEF='"$(VMSGDEF)"'

INCL=		-I$(TOPDIR) -I$(TOPDIR)/include
DBMLIB=		@LIBDBMS@
CONVTIME= convtime.o
MANEXT=1

COPTS=		@CFLAGS@
CFLAGS=		$(COPTS) $(DEFS) -DZMAILER $(INCL)

SOURCE=		vacation.c convtime.c

all: vacation

vacation: vacation.o $(CONVTIME)
	rm -f $@
	$(CC) $(CFLAGS) -o $@ vacation.o $(CONVTIME) $(DBMLIB)

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

clean:
	rm -f *.o *~ \#* vacation
distclean: clean
	rm -f Makefile

install: vacation
	$(INSTALL) -o root -m 755 vacation.sh $(MAILBIN)/vacation.sh
	-rm -f $(MAILBIN)/vacation
	cd $(MAILBIN) ; ln -s vacation.sh vacation
	$(INSTALL) -o root -m 755 vacation $(MAILBIN)/vacation.exe
	@if [ ! -f $(VMSGDEF) ] ; then					\
		$(INSTALL) -o root -m 644 vacation.msg $(VMSGDEF)	; \
	else								\
		echo "** File $(VMSGDEF) already installed" ;		\
	fi
	@echo "** Add a symlink from somewhere in user paths to $(MAILBIN)/vacation"
	@echo "** to finish off the installation;  Also the location of the man-page"
	@echo "** might need reconsideration (now at $(MANDIR)/man$(MANEXT))"

depend:
	CPPDEP="${CPPDEP}" $(TOPDIR)/bin/mkdep $(CFLAGS) $(SOURCE)
