SHELL := /bin/bash
PYTHON ?= python3

.PHONY: help lint validate index index-check package import-test new clean

help:
	@echo "make lint          YAML lint and manifest validation"
	@echo "make index         Update the template list in README.md"
	@echo "make index-check   Check whether the template list is up to date"
	@echo "make package       Create distribution zips in dist/"
	@echo "make import-test   Import templates into a disposable Zabbix instance"
	@echo "make new CATEGORY=app PRODUCT=apache NAME='Apache by HTTP' METHOD=http"
	@echo "make clean         Remove dist/"

lint:
	yamllint .
	$(PYTHON) scripts/validate.py

validate: lint

index:
	$(PYTHON) scripts/gen_index.py

index-check:
	$(PYTHON) scripts/gen_index.py --check

package:
	./scripts/package.sh

import-test:
	./scripts/import_test.sh

new:
	./scripts/new_template.sh "$(CATEGORY)" "$(PRODUCT)" "$(NAME)" "$(METHOD)"

clean:
	rm -rf dist
