Skip to content

Commit e986d1a

Browse files
maxim-belkinfmichonneau
authored andcommitted
Makefile: improve commands target and commands categories (#450)
* Makefile: improve commands target and commands categories * replace 'files' with 'website'
1 parent a435fcd commit e986d1a

File tree

1 file changed

+39
-28
lines changed

1 file changed

+39
-28
lines changed

Makefile

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,34 @@ endif
3737

3838
# Controls
3939
.PHONY : commands clean files
40-
.NOTPARALLEL:
41-
all : commands
4240

43-
## commands : show all commands.
44-
commands :
45-
@grep -h -E '^##' ${MAKEFILES} | sed -e "s/## //g"
41+
# Default target
42+
.DEFAULT_GOAL := commands
4643

47-
## docker-serve : use docker to build the site
48-
docker-serve :
49-
docker run --rm -it --volume ${PWD}:/srv/jekyll \
50-
--volume=${PWD}/.docker-vendor/bundle:/usr/local/bundle \
51-
-p 127.0.0.1:4000:4000 \
52-
jekyll/jekyll:${JEKYLL_VERSION} \
53-
bin/run-make-docker-serve.sh
44+
## I. Commands for both workshop and lesson websites
45+
## =================================================
5446

55-
## serve : run a local server.
47+
## * serve : render website and run a local server
5648
serve : lesson-md
5749
${JEKYLL} serve
5850

59-
## site : build files but do not run a server.
51+
## * site : build website but do not run a server
6052
site : lesson-md
6153
${JEKYLL} build
6254

63-
# repo-check : check repository settings.
55+
## * docker-serve : use Docker to serve the site
56+
docker-serve :
57+
docker run --rm -it --volume ${PWD}:/srv/jekyll \
58+
--volume=${PWD}/.docker-vendor/bundle:/usr/local/bundle \
59+
-p 127.0.0.1:4000:4000 \
60+
jekyll/jekyll:${JEKYLL_VERSION} \
61+
bin/run-make-docker-serve.sh
62+
63+
## * repo-check : check repository settings
6464
repo-check :
6565
@${PYTHON} bin/repo_check.py -s .
6666

67-
## clean : clean up junk files.
67+
## * clean : clean up junk files
6868
clean :
6969
@rm -rf ${DST}
7070
@rm -rf .sass-cache
@@ -73,22 +73,26 @@ clean :
7373
@find . -name '*~' -exec rm {} \;
7474
@find . -name '*.pyc' -exec rm {} \;
7575

76-
## clean-rmd : clean intermediate R files (that need to be committed to the repo).
76+
## * clean-rmd : clean intermediate R files (that need to be committed to the repo)
7777
clean-rmd :
7878
@rm -rf ${RMD_DST}
7979
@rm -rf fig/rmd-*
8080

81-
## ----------------------------------------
82-
## Commands specific to workshop websites.
81+
82+
##
83+
## II. Commands specific to workshop websites
84+
## =================================================
8385

8486
.PHONY : workshop-check
8587

86-
## workshop-check : check workshop homepage.
88+
## * workshop-check : check workshop homepage
8789
workshop-check :
8890
@${PYTHON} bin/workshop_check.py .
8991

90-
## ----------------------------------------
91-
## Commands specific to lesson websites.
92+
93+
##
94+
## III. Commands specific to lesson websites
95+
## =================================================
9296

9397
.PHONY : lesson-check lesson-md lesson-files lesson-fixme
9498

@@ -116,32 +120,39 @@ HTML_DST = \
116120
$(patsubst _extras/%.md,${DST}/%/index.html,$(sort $(wildcard _extras/*.md))) \
117121
${DST}/license/index.html
118122

119-
## lesson-md : convert Rmarkdown files to markdown
123+
## * lesson-md : convert Rmarkdown files to markdown
120124
lesson-md : ${RMD_DST}
121125

122126
_episodes/%.md: _episodes_rmd/%.Rmd
123127
@bin/knit_lessons.sh $< $@
124128

125-
## lesson-check : validate lesson Markdown.
129+
# * lesson-check : validate lesson Markdown
126130
lesson-check : lesson-fixme
127131
@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md
128132

129-
## lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace.
133+
## * lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace
130134
lesson-check-all :
131135
@${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md -l -w --permissive
132136

133-
## unittest : run unit tests on checking tools.
137+
## * unittest : run unit tests on checking tools
134138
unittest :
135139
@${PYTHON} bin/test_lesson_check.py
136140

137-
## lesson-files : show expected names of generated files for debugging.
141+
## * lesson-files : show expected names of generated files for debugging
138142
lesson-files :
139143
@echo 'RMD_SRC:' ${RMD_SRC}
140144
@echo 'RMD_DST:' ${RMD_DST}
141145
@echo 'MARKDOWN_SRC:' ${MARKDOWN_SRC}
142146
@echo 'HTML_DST:' ${HTML_DST}
143147

144-
## lesson-fixme : show FIXME markers embedded in source files.
148+
## * lesson-fixme : show FIXME markers embedded in source files
145149
lesson-fixme :
146150
@fgrep -i -n FIXME ${MARKDOWN_SRC} || true
147151

152+
##
153+
## IV. Auxililary (plumbing) commands
154+
## =================================================
155+
156+
## * commands : show all commands.
157+
commands :
158+
@sed -n -e '/^##/s|^##[[:space:]]*||p' $(MAKEFILE_LIST)

0 commit comments

Comments
 (0)