boring_backup/Makefile

56 lines
1.3 KiB
Makefile
Raw Normal View History

2022-08-21 21:11:07 +03:00
SRC_DIR := ./src
DOCS_DIR := ./docs
TESTS_DIR := ./tests
BUILD_DIR := ./build
DOCS_BUILD_DIR := ./build/docs
2022-05-14 00:20:02 +03:00
2022-08-21 21:11:07 +03:00
.PHONY: help tests docs man install uninstall
2022-05-14 00:20:02 +03:00
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-21 21:11:07 +03:00
@echo 'tests run tests from $(TESTS_DIR)'
2022-05-14 20:06:20 +03:00
@echo 'lint run shellcheck'
2022-08-21 21:11:07 +03:00
@echo 'man build manual pages from $(DOCS_DIR)'
2022-05-14 00:20:02 +03:00
@echo
@echo See README.md for more info.
2022-05-14 00:20:02 +03:00
2022-08-21 21:11:07 +03:00
tests:
2022-05-14 00:20:02 +03:00
# See bats(1), https://bats-core.readthedocs.io/en/latest/index.html
2022-08-21 21:11:07 +03:00
for test in $(TESTS_DIR)/*.bats; do \
2022-08-13 19:35:11 +03:00
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-08-21 21:11:07 +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
2022-08-21 21:11:07 +03:00
rst2man $(DOCS_DIR)/boring-backup.ru.1.rst \
> $(DOCS_BUILD_DIR)/boring-backup.ru.1
2022-08-13 19:35:11 +03:00
sed -e 's/.SH NAME/.SH ИМЯ/' \
-e 's/.SH AUTHOR/.SH АВТОРЫ/' \
-e 's/.SH COPYRIGHT/.SH АВТОРСКИЕ ПРАВА/' \
2022-08-21 21:11:07 +03:00
-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-08-21 21:11:07 +03:00
mkdir -p $(BUILD_DIR)
mkdir -p $(DOCS_BUILD_DIR)
install:
# install
uninstall:
# uninstall