2024-08-16 17:11:27 +00:00
|
|
|
# Copyright (C) 2018, 2024 Luke Shumaker
|
2024-01-04 22:16:23 +00:00
|
|
|
# Copyright (C) 2023-2024 Umorpha Systems
|
2018-08-18 18:42:42 +00:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2024-01-04 22:25:03 +00:00
|
|
|
shell_programs += bin/osi-mk
|
|
|
|
shell_programs += bin/osi-shell
|
|
|
|
shell_programs += bin/osi-mount
|
|
|
|
shell_programs += bin/osi-extract
|
2023-10-25 18:22:37 +00:00
|
|
|
|
2024-01-04 22:25:03 +00:00
|
|
|
python_programs += lib/pacman-choices
|
|
|
|
|
|
|
|
perl_programs += lib/indent
|
2023-10-25 18:22:37 +00:00
|
|
|
|
2024-01-29 20:33:10 +00:00
|
|
|
MAKEFLAGS += --no-builtin-rules
|
|
|
|
|
2024-01-05 02:13:25 +00:00
|
|
|
# Lint #########################################################################
|
|
|
|
|
2024-08-16 17:12:45 +00:00
|
|
|
lint: bin/osi-mk.bash
|
2024-01-04 22:25:03 +00:00
|
|
|
@PS4=; r=0; set -x; { \
|
2024-08-16 17:12:45 +00:00
|
|
|
shellcheck -- lib/*.sh lib/mk/*.sh $(patsubst bin/osi-mk,bin/osi-mk.bash,$(shell_programs)) test/*.bats || r=$$?; \
|
2024-01-04 22:25:03 +00:00
|
|
|
MYPYPATH=$$PWD/mypy-stubs mypy --strict $(python_programs) || r=$$?; \
|
|
|
|
black --check $(python_programs) mypy-stubs || r=$$?; \
|
|
|
|
isort --check $(python_programs) mypy-stubs || r=$$?; \
|
2024-01-05 18:42:15 +00:00
|
|
|
diff -u /dev/null <(git grep -L SPDX-License-Identifier: -- $(addprefix :!,$(generate/files))) || r=$$?; \
|
2024-01-04 22:25:03 +00:00
|
|
|
}; exit $$r
|
2023-10-25 07:14:54 +00:00
|
|
|
.PHONY: lint
|
2023-12-13 03:23:30 +00:00
|
|
|
|
2024-08-16 17:11:27 +00:00
|
|
|
# The `end_indent` alias is osi-mk confuses ShellCheck. The alias
|
|
|
|
# makes programming nicer-enough that I want to keep it. So,
|
|
|
|
# preprocess osi-mk to expand the alias before feeding it to
|
|
|
|
# ShellCheck.
|
2024-01-29 20:33:10 +00:00
|
|
|
bin/osi-mk.bash: bin/osi-mk
|
2024-05-13 21:00:37 +00:00
|
|
|
end_indent=$$(sed -En "s/^alias end_indent='(.*)'/\1/p" <$<) && sed -e '/^alias /d' -e "s,end_indent,$${end_indent}," <$< >$@
|
2024-01-29 20:33:10 +00:00
|
|
|
|
2024-01-05 02:13:25 +00:00
|
|
|
# Check ########################################################################
|
|
|
|
|
2024-02-14 15:22:53 +00:00
|
|
|
bats_parallel = $(patsubst -j%,-j %,$(patsubst -j,-j$$(nproc),$(filter-out -j1,$(filter -j%,$(MAKEFLAGS)))))
|
2024-01-05 02:13:25 +00:00
|
|
|
check:
|
2024-02-14 15:22:53 +00:00
|
|
|
PATH=$(CURDIR)/bin:$$PATH && cd test && sudo true && bats $(bats_parallel) .
|
2024-01-05 02:13:25 +00:00
|
|
|
.PHONY: check
|
2024-02-14 15:22:53 +00:00
|
|
|
.NOTPARALLEL: check
|
2024-01-05 02:13:25 +00:00
|
|
|
|
|
|
|
# Generate #####################################################################
|
|
|
|
|
2023-12-13 03:23:30 +00:00
|
|
|
generate/files = COPYING.txt
|
|
|
|
COPYING.txt:
|
|
|
|
curl https://www.gnu.org/licenses/agpl-3.0.txt >$@
|
|
|
|
|
|
|
|
generate: $(generate/files)
|
|
|
|
generate-clean:
|
|
|
|
rm -f -- $(generate/files)
|
|
|
|
.PHONY: generate generate-clean
|