boring_backup/Makefile

37 lines
1006 B
Makefile
Raw Normal View History

2022-05-14 00:20:02 +03:00
src_dir := ./src
docs_dir := ./docs
tests_dir := ./tests
build_dir := ./build
docs_build_dir := ./build/docs
.PHONY: help tests docs
help:
@echo Usage: make TARGET
@echo
@echo Available targets:
@echo
@echo 'help print this help message'
@echo 'tests run tests from $(tests_dir)'
2022-05-14 20:06:20 +03:00
@echo 'lint run shellcheck'
2022-05-14 00:20:02 +03:00
@echo 'docs build documentation from $(docs_dir)'
@echo
@echo See README.md for more info.
2022-05-14 00:20:02 +03:00
tests:
# See bats(1), https://bats-core.readthedocs.io/en/latest/index.html
2022-05-14 04:56:17 +03:00
for test in $(tests_dir)/*.bats; do bats --verbose-run --print-output-on-failure "$$test"; done
2022-05-14 00:20:02 +03:00
2022-05-14 20:06:20 +03:00
lint:
2022-05-16 22:30:18 +03:00
shellcheck $(src_dir)/boring-backup || true
2022-05-14 20:06:20 +03:00
shellcheck $(src_dir)/lib/* || true
2022-05-14 00:20:02 +03:00
docs: builddir
# See rst2man(1), rst2html(1), https://docutils.sourceforge.io/docs/index.html
2022-05-16 22:30:18 +03:00
rst2man $(docs_dir)/boring-backup.1.rst | gzip -9 > $(docs_build_dir)/boring-backup.1.gz
rst2html $(docs_dir)/boring-backup.1.rst > $(docs_build_dir)/boring-backup.1.html
2022-05-14 00:20:02 +03:00
builddir:
mkdir -p $(build_dir)
mkdir -p $(docs_build_dir)