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
|
|
|
|
|
2022-08-13 19:35:11 +03:00
|
|
|
all: man
|
|
|
|
|
2022-05-14 00:20:02 +03:00
|
|
|
help:
|
|
|
|
@echo Usage: make TARGET
|
|
|
|
@echo
|
|
|
|
@echo Available targets:
|
|
|
|
@echo
|
|
|
|
@echo 'help print this help message'
|
2022-08-13 19:35:11 +03:00
|
|
|
@echo 'test run tests from $(tests_dir)'
|
2022-05-14 20:06:20 +03:00
|
|
|
@echo 'lint run shellcheck'
|
2022-08-13 19:35:11 +03:00
|
|
|
@echo 'man build manual pages from $(docs_dir)'
|
2022-05-14 00:20:02 +03:00
|
|
|
@echo
|
2022-06-07 21:34:35 +03:00
|
|
|
@echo See README.md for more info.
|
2022-05-14 00:20:02 +03:00
|
|
|
|
2022-08-13 19:35:11 +03:00
|
|
|
test:
|
2022-05-14 00:20:02 +03:00
|
|
|
# See bats(1), https://bats-core.readthedocs.io/en/latest/index.html
|
2022-08-13 19:35:11 +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-06-29 21:27:35 +03:00
|
|
|
shellcheck $(src_dir)/boring-backup
|
|
|
|
shellcheck $(src_dir)/lib/*.sh
|
|
|
|
shellcheck $(src_dir)/lib/handlers/sources/*.sh
|
|
|
|
shellcheck $(src_dir)/lib/handlers/targets/*.sh
|
2022-05-14 20:06:20 +03:00
|
|
|
|
2022-08-13 19:35:11 +03:00
|
|
|
man: build_dir
|
|
|
|
# See rst2man(1), rst2html(1),
|
|
|
|
# https://docutils.sourceforge.io/docs/index.html
|
|
|
|
rst2man $(docs_dir)/boring-backup.ru.1.rst \
|
|
|
|
> $(docs_build_dir)/boring-backup.ru.1
|
|
|
|
sed -e 's/.SH NAME/.SH ИМЯ/' \
|
|
|
|
-e 's/.SH AUTHOR/.SH АВТОРЫ/' \
|
|
|
|
-e 's/.SH COPYRIGHT/.SH АВТОРСКИЕ ПРАВА/' \
|
|
|
|
-i $(docs_build_dir)/boring-backup.ru.1
|
|
|
|
gzip -9 $(docs_build_dir)/boring-backup.ru.1
|
2022-05-14 00:20:02 +03:00
|
|
|
|
2022-08-13 19:35:11 +03:00
|
|
|
build_dir:
|
2022-05-14 00:20:02 +03:00
|
|
|
mkdir -p $(build_dir)
|
|
|
|
mkdir -p $(docs_build_dir)
|