
TARGET	= q.cdb run q rq
RLOCAL	= LOCAL.rule
RTMPL	= q.tcprule.local
CDBSRC	= q.tcprule LOCAL.rule
PREFIX	= `cat ../PREFIX`

all:	${TARGET} ${RLOCAL}

q.cdb:	${CDBSRC}
	cat ${CDBSRC} | tcprules $@ tmp

q.tcprule.local:
	touch $@

${RLOCAL}:
	@ [ -f ${RLOCAL} ] || { \
	  cp ${RTMPL} $@; \
	  echo ">> Create '${RLOCAL}' file for your site."; \
	  echo ">> Edit it for your network and type ${MAKE}"; }

q:	../q
	ln -s ../q .

../q:
	(cd ..; make q)

../PREFIX:
	(cd ..; make PREFIX)

run:	run.src ../PREFIX
	./gensc.sh $@

rq:	rq.src run ../PREFIX
	./gensc.sh $@

install:	all
	cp rrcptchk rq ${PREFIX}/bin

clean:
	rm -f ${TARGET} dummy
