Release new version 2.13.0
[grml-scripts.git] / Makefile
1 .DEFAULT_GOAL:=help
2
3 help:  ## Display this help
4         @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf "  \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
5
6 allcheck: codecheck spellcheck ## Run codecheck and spellcheck
7
8 codecheck: shellcheck pythoncheck ## Run shellcheck and pythoncheck
9
10 .ONESHELL:
11 shellcheck: ## Run shellcheck
12         @RETURN=0
13         @for shellfile in $$(ls usr_bin/* usr_sbin/* usr_share/*); do
14         @       [ "$${shellfile}" = "usr_bin/iimage" ] && continue
15         @       [ "$${shellfile}" = "usr_sbin/make_chroot_jail" ] && continue
16         @       file "$${shellfile}" | grep -q shell && (shellcheck -x "$${shellfile}" || RETURN=1)
17         @done
18         @exit $${RETURN}
19
20 .ONESHELL:
21 pythoncheck: ## Run pythoncheck (flakecheck, isortcheck + blackcheck)
22         @RETURN=0
23         @for pythonfile in usr_bin/* usr_sbin/* usr_share/*; do
24         @       if head -1 "$${pythonfile}" | grep -q "python"; then
25         @               flake8 --max-line-length 88 "$${pythonfile}" || RETURN=1
26         @               isort --check "$${pythonfile}" || RETURN=1
27         @               black --check "$${pythonfile}" || RETURN=1
28         @       fi
29         @done
30         @exit $${RETURN}
31
32 .ONESHELL:
33 flakecheck: ## Run flake8 only
34         @RETURN=0
35         @for pythonfile in usr_bin/* usr_sbin/* usr_share/*; do
36         @       if head -1 "$${pythonfile}" | grep -q "python"; then
37         @               flake8 --max-line-length 88 "$${pythonfile}" || RETURN=1
38         @       fi
39         @done
40         @exit $${RETURN}
41
42 .ONESHELL:
43 isortcheck: ## Run isort --check only
44         @RETURN=0
45         @for pythonfile in usr_bin/* usr_sbin/* usr_share/*; do
46         @       if head -1 "$${pythonfile}" | grep -q "python"; then
47         @               isort --check "$${pythonfile}" || RETURN=1
48         @       fi
49         @done
50         @exit $${RETURN}
51
52 .ONESHELL:
53 blackcheck: ## Run black --check only
54         @RETURN=0
55         @for pythonfile in usr_bin/* usr_sbin/* usr_share/*; do
56         @       if head -1 "$${pythonfile}" | grep -q "python"; then
57         @               black --check "$${pythonfile}" || RETURN=1
58         @       fi
59         @done
60         @exit $${RETURN}
61
62 .ONESHELL:
63 spellcheck: ## Run spellcheck
64         @OUTPUT="$$(spellintian manpages/*)"
65         @echo $$OUTPUT
66         @if [ -n "$$OUTPUT" ]; then
67         @       false
68         @fi