
EXTRA_DIST = gen-nutupsconf-aug.py.in nutupsconf.aug.tpl \
	README tests/test_nut.aug

PYTHON = @PYTHON@

# only call the script to generate Augeas ups.conf lens upon "make dist",
# and if Python is present; the distributed gen-nutupsconf-aug.py.in template
# is assumed to only differ from a generated gen-nutupsconf-aug.py by the
# @PYTHON@ shebang.
dist-hook:
	@if [ -n "$(PYTHON)" ] && $(PYTHON) -c "import re,glob,codecs"; then \
		echo "Regenerating Augeas ups.conf lens with '$(PYTHON)'."; \
		$(PYTHON) $(distdir)/gen-nutupsconf-aug.py.in $(distdir)/; \
	else \
		echo "----------------------------------------------------------------------"; \
		echo "Warning: Python is not available."; \
		echo "Skipping regeneration of Augeas lens for ups.conf parsing." ; \
		echo "----------------------------------------------------------------------"; \
	fi

# This needs augparse from augeas-tools
if HAVE_AUGPARSE
check-local:
	@echo "augparse proceeding to lenses verification job..."; \
	echo "DISABLED for now due to https://github.com/networkupstools/nut/issues/657"
endif
# FIXME
#	augparse -I $(srcdir)/ $(srcdir)/tests/test_nut.aug

if WITH_AUGLENS
# Now "make install" should cover delivery of Augeas lenses...
# The "auglensdir" value should be set up by configure
# The *.aug files are generated by rule above or by autogen.sh and/or configure
 auglens_DATA = \
    nuthostsconf.aug  nutupsconf.aug   nutupsdusers.aug   nutupsschedconf.aug \
    nutnutconf.aug    nutupsdconf.aug  nutupsmonconf.aug  nutupssetconf.aug
endif

MAINTAINERCLEANFILES = Makefile.in .dirstamp
CLEANFILES = *-spellchecked

# Can be re-generated by configure script and/or make:
DISTCLEANFILES = gen-nutupsconf-aug.py

# Generated by autogen.sh and needed to run the configure script:
MAINTAINERCLEANFILES += nutupsconf.aug.in

DISTCLEANFILES += *.aug
