Browse code

proper handling of chk files

Nat! authored on 11-10-2015 21:10:14
Showing 1 changed files
... ...
@@ -20,13 +20,15 @@ SHELLFLAGS=-x -e SC2164,SC2166,SC2006 -s sh
20 20
 .PHONY: clean
21 21
 .PHONY: shellcheck_check
22 22
 
23
-%.chk:	%.sh shellcheck_check
24
-		- ( shellcheck $(SHELLFLAGS) $< || touch $@ )
23
+%.chk:	%.sh
24
+		- shellcheck $(SHELLFLAGS) $<
25
+		(shellcheck -f json $(SHELLFLAGS) $< | jq '.[].level' | grep error > /dev/null ) && exit 1 || touch $@
25 26
 
26
-all:	$(CHECKSTAMPS) mulle-bootstrap.chk
27
+all:	$(CHECKSTAMPS) mulle-bootstrap.chk shellcheck_check jq_check
27 28
 
28
-mulle-bootstrap.chk:	mulle-bootstrap shellcheck_check
29
-		- ( shellcheck $(SHELLFLAGS) $< || touch $@ )
29
+mulle-bootstrap.chk:	mulle-bootstrap
30
+		- shellcheck $(SHELLFLAGS) $<
31
+		(shellcheck -f json $(SHELLFLAGS) $< | jq '.[].level' | grep error > /dev/null ) && exit 1 || touch $@
30 32
 
31 33
 install:
32 34
 	@ ./install.sh
... ...
@@ -37,3 +39,5 @@ clean:
37 39
 shellcheck_check:
38 40
 	which shellcheck || brew install shellcheck
39 41
 
42
+jq_check:
43
+		which shellcheck || brew install shellcheck