-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (40 loc) · 1.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
.DEFAULT_GOAL := help
SHELLCHECK_OPTS := -e SC1090 -e SC1091 -e SC1003
.PHONY: check
check: ## Check shell scripts using ShellCheck
@echo "==> Check shell scripts using ShellCheck"
shellcheck $(SHELLCHECK_OPTS) \
bin/hello.sh \
bin/install.sh \
bin/symlink-tasks \
monty/install.sh \
packages/brew.sh \
packages/apt.sh \
packages/npm.sh \
win/wslconfig.sh \
bootstrap \
dotfiles.sh
# Define a Makefile rule to check the formatting of shell script files using shfmt
SHELL_SCRIPTS := $(wildcard *.sh)
BASH_SH := bash/.aliases bash/.bash_profile bash/.exports bash/.functions
shfmt: ## Check with shfmt
@echo "Checking shell script formatting with shfmt..."
@echo "These files need formatting:"
@shfmt -i 2 -l \
$(SHELL_SCRIPTS) \
$(BASH_SH) \
bin/symlink-tasks \
|| (echo "Shell script formatting errors detected." \
&& exit 1)
.PHONY: lint
lint: ## Lint shell scripts with ShellCheck and shfmt
lint: check shfmt
.PHONY: cleancr
cleancr: ## Clean shell scripts for \cr carriage return from dos
files := bash/.aliases bash/.bash_profile bash/.exports bash/.functions bash/.inputrc
cleancr:
@echo "Clean shell scripts for \cr carriage return from dos..."
dos2unix $(files)
.PHONY: help
help: ## Show this help message and exit
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-16s\033[0m %s\n", $$1, $$2}'