@@ -15,26 +15,26 @@ DOC_SPELLCHECK_MUST_PASS = 1
15
15
INSTALL_DIR = $(TOP_DIR ) /install
16
16
17
17
# All of the Markdown source files (that are not generated during build).
18
- SOURCES = \
19
- modules/compile-time-programming/requires-expressions.md \
20
- modules/functions/defaulted-parameters.md \
21
- modules/functions/user-defined-literals.md \
22
- modules/object-model/copy-semantics.md \
23
- course_examples.md \
24
- disclaimer.md \
25
- glossary.md \
18
+ SOURCES = $(shell find . -mindepth 2 -name '* .md')
19
+
20
+ # Special top-level markdown files
21
+ EXTRA_SOURCES = glossary.md \
26
22
contributing.md \
27
23
introduction.md \
28
- main .md \
24
+ main_raw .md \
29
25
obtaining_document.md \
30
26
references.md \
31
27
32
28
# The Markdown files that are generated during the build process.
33
29
GENERATED_MARKDOWN = \
34
30
knowledge_areas_summary.md \
31
+ main.pre.md \
35
32
main.gen.md \
36
33
contributors.md \
37
34
35
+ # Merge extra sources with detected sources for teaching modules
36
+ SOURCES += $(EXTRA_SOURCES )
37
+
38
38
# ###############################################################################
39
39
# Define primary targets.
40
40
# ###############################################################################
@@ -96,6 +96,7 @@ install: all
96
96
# Some additional configuration.
97
97
# ###############################################################################
98
98
99
+ MAIN_GENERATOR = $(TOP_DIR ) /tools/build/generate_main.py
99
100
MD_PREPROCESSOR = $(TOP_DIR ) /tools/build/preprocessor
100
101
MAKE_MARKDOWN = $(TOP_DIR ) /tools/build/make_markdown
101
102
SPELLCHECK_DIR = $(TOP_DIR ) /config/spellcheck
@@ -104,14 +105,17 @@ SPELLCHECK_DIR = $(TOP_DIR)/config/spellcheck
104
105
# Preprocessing setup.
105
106
# ###############################################################################
106
107
107
- main.gen.md : $(SOURCES ) contributors.md main.md
108
- $(MD_PREPROCESSOR ) -v $(DOC_VERSION ) < main.md > main.gen.md
108
+ main.pre.md : $(SOURCES ) contributors.md main_raw.md
109
+ $(MAIN_GENERATOR ) --raw main_raw.md --out main.pre.md --module-folder modules
110
+
111
+ main.gen.md : $(SOURCES ) contributors.md main.pre.md
112
+ $(MD_PREPROCESSOR ) -v $(DOC_VERSION ) < main.pre.md > main.gen.md
109
113
110
114
knowledge_areas_summary.md : $(SOURCES ) knowledge_areas.dat
111
115
$(MAKE_MARKDOWN ) < knowledge_areas.dat > knowledge_areas_summary.md
112
116
113
117
contributors.md :
114
- git log --all --pretty=" %an " | sort | uniq > contributors.md
118
+ git log --all --pretty=" %aN " | sort | uniq > contributors.md
115
119
116
120
# ###############################################################################
117
121
# Establish Pandoc settings.
@@ -163,21 +167,16 @@ guidelines.tex:
163
167
164
168
spellcheck_result.txt : guidelines.html
165
169
rm -f $@
166
- rm -f spellcheck_expected_sorted.txt
167
- sort $(SPELLCHECK_DIR ) /ignored_words.txt | \
168
- uniq > spellcheck_expected_sorted.txt
169
170
PATH=" $( TOP_DIR) /tools/build:$$ PATH" pandoc --from $(INPUT_FORMAT ) \
170
171
--lua-filter $(TOP_DIR ) /tools/pandoc_filters/spellcheck.lua \
171
172
main.gen.md | sort | uniq > $@
172
- @status=0; \
173
- diff -q spellcheck_expected_sorted.txt $@ || \
174
- status=1; \
175
- if [ $$ status -ne 0 ]; then \
176
- echo " SPELLING ERRORS DETECTED:" ; \
177
- diff -u spellcheck_expected_sorted.txt $@ | \
178
- grep ' ^[+-]' ; \
173
+ if [ -s $@ ]; then \
174
+ echo " DETECTED SPELLING ERRORS:" ; \
175
+ cat $@ | while read line; do echo " Misspelled '$$ line' in:" ; \
176
+ grep -R " $$ line" -n --color=auto --include=' *.md' --exclude=' main.gen.md' ; done ; \
177
+ sync; \
179
178
if [ $( DOC_SPELLCHECK_MUST_PASS) -ne 0 ]; then \
180
- echo " ERROR: spelling errors detected" ; \
179
+ echo " ERROR: spelling errors detected, cannot proceed! " ; \
181
180
exit 1; \
182
181
else \
183
182
echo " WARNING: spelling errors detected" ; \
0 commit comments