@@ -15,26 +15,26 @@ DOC_SPELLCHECK_MUST_PASS = 1
1515INSTALL_DIR = $(TOP_DIR ) /install
1616
1717# 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 \
2622 contributing.md \
2723 introduction.md \
28- main .md \
24+ main_raw .md \
2925 obtaining_document.md \
3026 references.md \
3127
3228# The Markdown files that are generated during the build process.
3329GENERATED_MARKDOWN = \
3430 knowledge_areas_summary.md \
31+ main.pre.md \
3532 main.gen.md \
3633 contributors.md \
3734
35+ # Merge extra sources with detected sources for teaching modules
36+ SOURCES += $(EXTRA_SOURCES )
37+
3838# ###############################################################################
3939# Define primary targets.
4040# ###############################################################################
@@ -96,6 +96,7 @@ install: all
9696# Some additional configuration.
9797# ###############################################################################
9898
99+ MAIN_GENERATOR = $(TOP_DIR ) /tools/build/generate_main.py
99100MD_PREPROCESSOR = $(TOP_DIR ) /tools/build/preprocessor
100101MAKE_MARKDOWN = $(TOP_DIR ) /tools/build/make_markdown
101102SPELLCHECK_DIR = $(TOP_DIR ) /config/spellcheck
@@ -104,14 +105,17 @@ SPELLCHECK_DIR = $(TOP_DIR)/config/spellcheck
104105# Preprocessing setup.
105106# ###############################################################################
106107
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
109113
110114knowledge_areas_summary.md : $(SOURCES ) knowledge_areas.dat
111115 $(MAKE_MARKDOWN ) < knowledge_areas.dat > knowledge_areas_summary.md
112116
113117contributors.md :
114- git log --all --pretty=" %an " | sort | uniq > contributors.md
118+ git log --all --pretty=" %aN " | sort | uniq > contributors.md
115119
116120# ###############################################################################
117121# Establish Pandoc settings.
@@ -163,21 +167,16 @@ guidelines.tex:
163167
164168spellcheck_result.txt : guidelines.html
165169 rm -f $@
166- rm -f spellcheck_expected_sorted.txt
167- sort $(SPELLCHECK_DIR ) /ignored_words.txt | \
168- uniq > spellcheck_expected_sorted.txt
169170 PATH=" $( TOP_DIR) /tools/build:$$ PATH" pandoc --from $(INPUT_FORMAT ) \
170171 --lua-filter $(TOP_DIR ) /tools/pandoc_filters/spellcheck.lua \
171172 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; \
179178 if [ $( DOC_SPELLCHECK_MUST_PASS) -ne 0 ]; then \
180- echo " ERROR: spelling errors detected" ; \
179+ echo " ERROR: spelling errors detected, cannot proceed! " ; \
181180 exit 1; \
182181 else \
183182 echo " WARNING: spelling errors detected" ; \
0 commit comments