Skip to content

Commit 176f2a3

Browse files
committed
[IPMPROG-1781] Add a Makefile target to check-json (that generated markup is valid)
1 parent ef4d004 commit 176f2a3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
latest.json
22
*.spellchecked
3+
*.checkedvalid
34
*.bak

Makefile

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
OUTFILE = latest.json
44
PRODUCT = ipm
55
CONVERT = ./tools/convert.sh
6+
JSONSH = ./JSON.sh/JSON.sh
67
INPUTS = $(shell ls -1 "$(PRODUCT)"/*.md)
78

89
EGREP = grep -E
@@ -15,20 +16,28 @@ ASPELL_OUT_NOTERRORS = (^[ \t]*[\*\@]|^$$)
1516

1617
all: $(OUTFILE)
1718

18-
check: spellcheck
19+
check: spellcheck check-json
1920

2021
clean:
21-
rm -f $(OUTFILE) $(addsuffix .spellchecked, $(INPUTS))
22+
rm -f $(OUTFILE) $(addsuffix .spellchecked, $(INPUTS)) $(OUTFILE).checkedvalid
2223
# Interactive aspell leaves older copies of checked files; with Git we do not need them:
2324
rm -f $(addsuffix .bak, $(INPUTS))
2425

2526
$(OUTFILE): $(INPUTS)
2627
$(CONVERT) "$(PRODUCT)" "$(OUTFILE)"
2728

29+
check-json: $(OUTFILE).checkedvalid
30+
31+
$(OUTFILE).checkedvalid: $(OUTFILE)
32+
rm -f "$@"
33+
$(JSONSH) -N -P < "$<" >/dev/null && echo " JSON-OK $<" >&2 || { echo " JSON-FAIL $<" >&2 ; exit 1; }
34+
touch "$@"
35+
2836
spellcheck: $(addsuffix .spellchecked, $(INPUTS))
2937

3038
# Ported from NUT
3139
%.spellchecked: %
40+
@rm -f "$@"
3241
@test -s "$<"
3342
@echo " SPELLCHECK $<" ; \
3443
OUT="`(sed 's,^\(.*\)$$, \1,' | \

0 commit comments

Comments
 (0)