srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ..
man1dir = $(mandir)/man1
man8dir = $(mandir)/man8
subdir = docs

INSTALL = @INSTALL@
install_sh_PROGRAM = $(install_sh) -c
INSTALL_DATA = @INSTALL_DATA@
PACKAGE = @PACKAGE@
SHELL = @SHELL@
VERSION = @VERSION@
exec_prefix = @exec_prefix@
install_sh = @install_sh@
mandir = @mandir@
prefix = @prefix@
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs

man1_MANS = spasmdb.1 spasm.1
man8_MANS = spasmd.8
MANS = $(man1_MANS) $(man8_MANS)

all: Makefile $(MANS)

Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@

install: all
	$(MAKE) install-man

install-man: install-man1 install-man8

install-man1: $(man1_MANS)
	$(mkinstalldirs) $(man1dir)
	$(INSTALL_DATA) spasmdb.1 $(man1dir)
	$(INSTALL_DATA) spasm.1 $(man1dir)

install-man8: $(man8_MANS)
	$(mkinstalldirs) $(man8dir)
	$(INSTALL_DATA) spasmd.8 $(man8dir)

uninstall: uninstall-man1 uninstall-man8

uninstall-man1:
	rm -f $(man1dir)/spasmdb.1 $(man1dir)/spasm.1

uninstall-man8:
	rm -f $(man8dir)/spasmd.8

DIST_COMMON = Makefile.in
DIST_SOURCES = spasm.1 spasmdb.1 spasmd.8
EXTRA_DIST = blacklists.html filters.html index.html logic.html regex.html whitelists.html
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)

distdir: $(DISTFILES)
	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
	list='$(DISTFILES)'; for file in $$list; do \
	  case $$file in \
	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
	    $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
	  esac; \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
	    dir="/$$dir"; \
	    $(mkinstalldirs) "$(distdir)$$dir"; \
	  else \
	    dir=''; \
	  fi; \
	  if test -d $$d/$$file; then \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
	    fi; \
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
	  else \
	    test -f $(distdir)/$$file \
	    || cp -p $$d/$$file $(distdir)/$$file \
	    || exit 1; \
	  fi; \
	done
check: all

clean:

distclean:
	rm -f Makefile
