56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
SRC_DIR := ./src
 | 
						|
DOCS_DIR := ./docs
 | 
						|
TESTS_DIR := ./tests
 | 
						|
BUILD_DIR := ./build
 | 
						|
DOCS_BUILD_DIR := ./build/docs
 | 
						|
 | 
						|
.PHONY: help tests docs man install uninstall
 | 
						|
 | 
						|
all: man
 | 
						|
 | 
						|
help:
 | 
						|
	@echo Usage: make TARGET
 | 
						|
	@echo
 | 
						|
	@echo Available targets:
 | 
						|
	@echo
 | 
						|
	@echo 'help	print this help message'
 | 
						|
	@echo 'tests	run tests from $(TESTS_DIR)'
 | 
						|
	@echo 'lint	run shellcheck'
 | 
						|
	@echo 'man	build manual pages from $(DOCS_DIR)'
 | 
						|
	@echo
 | 
						|
	@echo See README.md for more info.
 | 
						|
 | 
						|
tests:
 | 
						|
	# See bats(1), https://bats-core.readthedocs.io/en/latest/index.html
 | 
						|
	for test in $(TESTS_DIR)/*.bats; do \
 | 
						|
		bats --verbose-run --print-output-on-failure "$$test"; \
 | 
						|
	done
 | 
						|
 | 
						|
lint:
 | 
						|
	shellcheck $(SRC_DIR)/boring-backup
 | 
						|
	shellcheck $(SRC_DIR)/lib/*.sh
 | 
						|
	shellcheck $(SRC_DIR)/lib/handlers/sources/*.sh
 | 
						|
	shellcheck $(SRC_DIR)/lib/handlers/targets/*.sh
 | 
						|
 | 
						|
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
 | 
						|
 | 
						|
build_dir:
 | 
						|
	mkdir -p $(BUILD_DIR)
 | 
						|
	mkdir -p $(DOCS_BUILD_DIR)
 | 
						|
 | 
						|
install:
 | 
						|
	# install
 | 
						|
 | 
						|
uninstall:
 | 
						|
	# uninstall
 | 
						|
 |