GENCONFIG=	$(GATED_TOOLS_PATH)/scripts/gen_config
TESTG=		$(GATED_TOOLS_PATH)/scripts/testg
THEHOST=	`hostname | sed -e 's/\([^.]\)\..*/\1/'`

TEST_FLAGS=	-a -q -M -l

AUTO=		auth.auto
CONFIG=		auth.cfg

TESTFILES=gated.conf.auth.wooj.1.1 \
expected.auth.wooj.1.1 \
gated.conf.auth.mrt.1.1 \
expected.auth.mrt.1.1 \
gated.conf.auth.idrp.1.1 \
expected.auth.idrp.1.1 \
gated.conf.auth.obelix.1.1 \
expected.auth.obelix.1.1 \
gated.conf.auth.wooj.2.1 \
expected.auth.wooj.2.1 \
gated.conf.auth.mrt.2.1 \
expected.auth.mrt.2.1 \
gated.conf.auth.idrp.2.1 \
expected.auth.idrp.2.1 \
gated.conf.auth.obelix.2.1 \
expected.auth.obelix.2.1 \
gated.conf.auth.wooj.3.1 \
expected.auth.wooj.3.1 \
gated.conf.auth.mrt.3.1 \
expected.auth.mrt.3.1 \
gated.conf.auth.idrp.3.1 \
expected.auth.idrp.3.1 \
gated.conf.auth.obelix.3.1 \
expected.auth.obelix.3.1 \
gated.conf.auth.wooj.4.1 \
expected.auth.wooj.4.1 \
gated.conf.auth.mrt.4.1 \
expected.auth.mrt.4.1 \
gated.conf.auth.idrp.4.1 \
expected.auth.idrp.4.1 \
gated.conf.auth.obelix.4.1 \
expected.auth.obelix.4.1


$(TESTFILES):	$(CONFIG)
	$(GENCONFIG) $(CONFIG)

config: $(TESTFILES)

test: test_done

test_done: config $(AUTO) 
	@rm -f test_done
	@( THEHOST=$(THEHOST); export THEHOST; \
		if [ "$$THEHOST" = "obelix" \
		    -o "$$THEHOST" = "idrp" \
		    -o "$$THEHOST" = "mrt" \
		    -o "$$THEHOST" = "wooj" ]; \
			then $(TESTG) $(TEST_FLAGS) < $(AUTO); \
		else echo "Skipping, $$THEHOST not a part of test."; \
		fi )
	@touch test_done

clean:
	rm -f expected.* gated.conf.* test_done

cleantest:
	rm -f test_done
