# This is a BSD Makefile
# Run pmake, not make, if you are not on a BSD system

# Domain "handles" from which filenames are derived.  For every
# domain 'foo', you must have two files: foo.aliases.raw and
# foo.rewrite.raw.

DOMAIN_FILES    = vygo hairy ninio gilad to-beav rotbart


# The suffix of DBM files.  If using BSD DBM, say ".db".
# If using NDBM or GDBM, say ".dir" and define .pag in DB_CLEAN.
# If your DBM library adds no suffix, define ADD_SUFFIX.

DB		= .dir
#DB_CLEAN	=
DB_CLEAN	= ${SRCS:S/.raw$/.pag/g}
#ADD_SUFFIX	= yes


# The location of exim_dbmbuild binary

MAKEDBM		= /usr/local/lib/exim/exim_dbmbuild

# --- No user serviceable parts beyond this point. ---

.SUFFIXES:	${DB} .raw

DOMAIN_SRCS	= ${DOMAIN_FILES:S/$/.raw/g}
SRCS		= list.raw admin.raw ${DOMAIN_SRCS}
DBMS		= ${SRCS:S/.raw$/${DB}/g}
CLEANFILES	= ${DB_CLEAN} *.core core

all: ${DBMS}

clean:
	-rm -rf ${DBMS} ${CLEANFILES}

# The following may not work on Solaris, the only UNIX with no POSIX shell.
.raw${DB}:
.if defined(ADD_SUFFIX)
	${MAKEDBM} $< $@
.else
	@TARG=$@ && \
		echo ${MAKEDBM} $< $${TARG%${DB}} && \
		${MAKEDBM} $< $${TARG%${DB}}
.endif
