@SET_MAKE@

# set install program
INSTALL = @INSTALL@
SHELL	= /bin/sh
CP	= cp
RM	= rm

# set prefix values
prefix      = @prefix@
exec_prefix = @exec_prefix@
bindir      = $(exec_prefix)/bin
etcdir      = $(exec_prefix)/etc

srcdir	    = @srcdir@
VPATH       = @srcdir@

DESTDIR =

RWHOIS_ROOT_DIR = $(DESTDIR)$(etcdir)/rwhoisd/samples

FILES = \
        a.com \
        net-10.0.0.0-8 \
	net-fd00:1234::-32 \
        rwhoisd.allow \
        rwhoisd.auth_area \
        rwhoisd.conf \
        rwhoisd.deny \
        rwhoisd.dir \
        rwhoisd.root \
        rwhoisd.x.dir

all:

install:
	- [ -d $(RWHOIS_ROOT_DIR) ] || mkdir -p $(RWHOIS_ROOT_DIR)
	@for file in $(FILES); do \
	  echo "installing $$file into $(RWHOIS_ROOT_DIR)"; \
	  ($(CP) -pr $(srcdir)/$$file $(RWHOIS_ROOT_DIR)) || exit 1; \
	done
	(sh $(srcdir)/../tools/scripts/setup_rwhois_conf $(RWHOIS_ROOT_DIR) \
	    $(RWHOIS_ROOT_DIR)/rwhoisd.conf)

uninstall:
	@for file in $(FILES); do \
	  echo "removing $$file from $(RWHOIS_ROOT_DIR)"; \
	  ($(RM) -r $(RWHOIS_ROOT_DIR)/$$file) || exit 1; \
	done

clean:

distclean: clean
	@if [ -d $(RWHOIS_ROOT_DIR) ]; then \
		find $(RWHOIS_ROOT_DIR) \
	  	\( -name "local.db" -o -name "index-*.ndx" \) -exec rm {} \;; \
        fi
	rm -f Makefile
