-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
66 lines (49 loc) · 2.91 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
ifneq (,)
.error This Makefile requires GNU Make.
endif
# -------------------------------------------------------------------------------------------------
# Default configuration
# -------------------------------------------------------------------------------------------------
.PHONY: help install uninstall lint lint-file lint-bash
FL_VERSION = 0.3
FL_IGNORE_PATHS = .git/,.github/
# -------------------------------------------------------------------------------------------------
# Default Target
# -------------------------------------------------------------------------------------------------
help:
@echo "lint Lint source code"
@echo "install Install (required root or sudo)"
@echo "Uninstall Uninstall (required root or sudo)"
# -------------------------------------------------------------------------------------------------
# System targets
# -------------------------------------------------------------------------------------------------
install: header-fuzz
install -d /usr/local/bin
install -m 755 header-fuzz /usr/local/bin/header-fuzz
uninstall:
rm /usr/local/bin/header-fuzz
# -------------------------------------------------------------------------------------------------
# Lint Targets
# -------------------------------------------------------------------------------------------------
lint: lint-file lint-bash
lint-file:
@echo "# -------------------------------------------------------------------- #"
@echo "# Lint files #"
@echo "# -------------------------------------------------------------------- #"
@docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-crlf --text --ignore '$(FL_IGNORE_PATHS)' --path .
@docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-trailing-single-newline --text --ignore '$(FL_IGNORE_PATHS)' --path .
@docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-trailing-space --text --ignore '$(FL_IGNORE_PATHS)' --path .
@docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-utf8 --text --ignore '$(FL_IGNORE_PATHS)' --path .
@docker run --rm -v $(PWD):/data cytopia/file-lint:$(FL_VERSION) file-utf8-bom --text --ignore '$(FL_IGNORE_PATHS)' --path .
lint-bash:
@echo "# -------------------------------------------------------------------- #"
@echo "# Lint shellcheck #"
@echo "# -------------------------------------------------------------------- #"
@docker run --rm -v $(PWD):/mnt koalaman/shellcheck:stable --shell=bash header-fuzz
# -------------------------------------------------------------------------------------------------
# Helper targets
# -------------------------------------------------------------------------------------------------
pull-docker-lint-file:
docker pull cytopia/file-lint:$(FL_VERSION)
pull-docker-lint-bash:
docker pull koalaman/shellcheck:stable