-
Notifications
You must be signed in to change notification settings - Fork 1
/
check.mk
45 lines (34 loc) · 1 KB
/
check.mk
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
SHELL := /bin/bash
.PHONY: test_and_lint_dont_abort_after_err
test_and_lint_dont_abort_after_err:
@$(MAKE) -f check.mk -k test_and_lint
.PHONY: test_and_lint
test_and_lint: test lint
.PHONY: autofix
autofix: autofmt shellcheck_autofix
.PHONY: autofmt
autofmt:
clang-format-14 -i source/*.cpp source/*.hpp
.PHONY: test
test:
@$(MAKE) -C tests
.PHONY: lint
lint: fmt_check shellcheck
.PHONY: fmt_check
fmt_check:
FMT_FAILED=0; \
for i in source/*.cpp source/*.hpp; do \
diff "$$i" <(clang-format-14 "$$i") --label "original $$i" --label "formatted $$i" --color=always -u || FMT_FAILED=1; \
done; \
exit "$$FMT_FAILED"
@echo # blank line for consistency
SCRIPTS=scripts/* tests/*.sh tests/run_test \
examples/caliptra_vcd/sv-bugpoint-check.sh \
examples/caliptra_verilation_err/sv-bugpoint-check.sh
.PHONY: shellcheck
shellcheck:
shellcheck $(SCRIPTS) --color
.PHONY: shellcheck
shellcheck_autofix:
shellcheck $(SCRIPTS) -f diff --color || exit 0
shellcheck $(SCRIPTS) -f diff | git apply --allow-empty