TOPDIR = ../../../../..

OUTPUT = test-out.txt
REFERENCE = test-expected.txt

# Relative topdir keeps the rendered project paths relocatable; dropping the
# log position keeps the error output free of volatile line numbers. The
# fixture tree under ./proj provides the topdir and the projects root; the
# last -t wins over the global one.
TEST_CMD_ARGS = --topdir-format relative --log-flags prio,stderr \
	-t ./proj/excl-never -p ./proj

include $(TOPDIR)/make/proj.mk
include $(TOPDIR)/make/test-jw-pkg.mk

all:

$(OUTPUT): Makefile test.sh \
	$(wildcard proj/*) $(wildcard proj/*/make/project.conf) \
	$(wildcard proj/*/VERSION)
	bash ./test.sh $(TEST_CMD_LINE) > $(OUTPUT).tmp 2>&1
	diff $(REFERENCE) $(OUTPUT).tmp
	mv $(OUTPUT).tmp $(OUTPUT)

test: $(OUTPUT)
clean: test.integration.in-tree.clean
test.integration.in-tree.clean:
	rm -f $(OUTPUT) $(OUTPUT).tmp
