# nndb --- an nntp server for mail, with a database backend.
# Copyright (C) 1996 Joe Hildebrand

# Author:   Joe Hildebrand <hildjj@fuentez.com>
# Keywords: news mail

# nndb is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# nndb is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with GNU Emacs; see the file COPYING.  If not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

PRODUCT = @PRODUCT@
VERSION = @VERSION@

SHELL = /bin/sh
srcdir = @srcdir@
VPATH = @srcdir@
@SET_MAKE@

CC     = @CC@
CFLAGS = @CFLAGS@

LDFLAGS = @LDFLAGS@
LIBS    = @LIBS@
RM      = rm -f
INSTALL = @INSTALL@
PERL    = @PERL@

INSTALL_DATA    = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
infodir = $(prefix)/info

SCRIPTS = @SCRIPTS@

MDEFINES = CC='$(CC)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' LIBS='$(LIBS)' \
prefix='$(prefix)' exec_prefix='$(exec_prefix)' \
bindir='$(bindir)' infodir='$(infodir)'

SUBDIRS   = 
DISTFILES = 	nndb.in nndel.c config.h.in TODO ChangeLog \
		install.sh Makefile.in configure configure.in

# Files that can be generated, but should be up to date for a distribution.
DISTDEP   =  	Makefile

COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
LINK = $(CC) $(LDFLAGS) -o $@

.SUFFIXES: .c .o

.c.o:
	$(COMPILE) $<

SOURCES = nndel.c
OBJECTS = nndel.o


all: nndb nndel

Makefile: Makefile.in config.status
	CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status

config.status: configure
	./config.status --recheck

configure: configure.in
	autoconf

clean:
	$(RM) nndel nndb *~ *.o

config.h: config.h.in
	./config.status 

nndel: $(OBJECTS) config.h
	$(LINK) $(OBJECTS) $(LIBS)

nndb: nndb.in
	./config.status 
	chmod +x nndb

distclean: clean
	$(RM) Makefile config.h  config.status config.cache config.log

realclean: distclean

dist: $(DISTDEP)
	$(RM) -r $(PRODUCT)-$(VERSION)
	mkdir $(PRODUCT)-$(VERSION)
	chmod 777 $(PRODUCT)-$(VERSION)
	@echo "Copying distribution files"
	@for file in $(DISTFILES); do \
	  ln $(srcdir)/$$file $(PRODUCT)-$(VERSION) 2> /dev/null \
	    || cp -p $(srcdir)/$$file $(PRODUCT)-$(VERSION); \
	done
	chmod -R a+r $(PRODUCT)-$(VERSION)
	tar chof $(PRODUCT)-$(VERSION).tar $(PRODUCT)-$(VERSION)
	gzip -9 $(PRODUCT)-$(VERSION).tar
	rm -rf $(PRODUCT)-$(VERSION)
