@@ -39,6 +39,12 @@ REMARK_RELATED_FLAGS ?= \
3939# Define the remark output option:
4040REMARK_RELATED_OUTPUT_FLAG ?= --output
4141
42+ # Define a temporary file for writing a list of files to be processed:
43+ REMARK_RELATED_TMP_FILE_LIST ?= $(TMP_DIR ) /remark_related_tmp_file_list.txt
44+
45+ # Define a temporary file for writing a list of files which have been processed:
46+ REMARK_RELATED_TMP_FILE_LIST_PROGRESS ?= $(TMP_DIR ) /remark_related_tmp_file_list_progress.txt
47+
4248
4349# RULES #
4450
@@ -59,15 +65,16 @@ REMARK_RELATED_OUTPUT_FLAG ?= --output
5965# @example
6066# make markdown-related MARKDOWN_PATTERN='README.md' MARKDOWN_FILTER='.*/math/base/special/.*'
6167# /
62- markdown-related : $(NODE_MODULES )
63- $(QUIET ) $(FIND_MARKDOWN_CMD ) | grep ' ^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
68+ markdown-related : $(NODE_MODULES ) clean-markdown-related markdown-related-init
69+ $(QUIET ) $(FIND_MARKDOWN_CMD ) | tee $( REMARK_RELATED_TMP_FILE_LIST ) | grep ' ^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
6470 echo " " ; \
6571 echo " Processing file: $$ file" ; \
6672 " $( REMARK) " \
6773 $$ file \
6874 $(REMARK_RELATED_FLAGS ) \
6975 $(REMARK_RELATED_PLUGIN_FLAGS ) \
7076 $(REMARK_RELATED_OUTPUT_FLAG ) || exit 1; \
77+ echo " $$ file" >> $(REMARK_RELATED_TMP_FILE_LIST_PROGRESS ) ; \
7178 done
7279
7380.PHONY : markdown-related
@@ -97,3 +104,45 @@ markdown-related-files: $(NODE_MODULES)
97104 done
98105
99106.PHONY : markdown-related-files
107+
108+ # /
109+ # Resumes processing for updating the related packages section of Markdown files.
110+ #
111+ # @example
112+ # make markdown-related-resume
113+ # /
114+ markdown-related-resume : $(NODE_MODULES ) $(REMARK_RELATED_TMP_FILE_LIST ) $(REMARK_RELATED_TMP_FILE_LIST_PROGRESS )
115+ $(QUIET ) $(UNIQUE_LINES ) $(REMARK_RELATED_TMP_FILE_LIST ) $(REMARK_RELATED_TMP_FILE_LIST_PROGRESS ) | grep ' ^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
116+ echo " " ; \
117+ echo " Processing file: $$ file" ; \
118+ " $( REMARK) " \
119+ $$ file \
120+ $(REMARK_RELATED_FLAGS ) \
121+ $(REMARK_RELATED_PLUGIN_FLAGS ) \
122+ $(REMARK_RELATED_OUTPUT_FLAG ) || exit 1; \
123+ echo " $$ file" >> $(REMARK_RELATED_TMP_FILE_LIST_PROGRESS ) ; \
124+ done
125+
126+ # /
127+ # Performs initialization tasks associated with processing Markdown files.
128+ #
129+ # @example
130+ # make markdown-related-init
131+ # /
132+ markdown-related-init :
133+ $(QUIET ) $(MKDIR_RECURSIVE ) $(TMP_DIR )
134+ $(QUIET ) $(TOUCH ) $(REMARK_RELATED_TMP_FILE_LIST )
135+ $(QUIET ) $(TOUCH ) $(REMARK_RELATED_TMP_FILE_LIST_PROGRESS )
136+
137+ .PHONY : markdown-related-init
138+
139+ # /
140+ # Runs clean-up tasks associated with processing Markdown files.
141+ #
142+ # @example
143+ # make clean-markdown-related
144+ # /
145+ clean-markdown-related :
146+ $(QUIET ) $(DELETE ) $(DELETE_FLAGS ) $(REMARK_RELATED_TMP_FILE_LIST_PROGRESS )
147+
148+ .PHONY : clean-markdown-related
0 commit comments