1 ## ========================================
2 ## Commands for both workshop and lesson websites.
5 MAKEFILES=Makefile $(wildcard *.mk)
8 PARSER=bin/markdown_ast.rb
13 .PHONY : commands clean files
17 ## commands : show all commands.
19 @grep -h -E '^##' ${MAKEFILES} | sed -e 's/## //g'
21 ## docker-serve : use docker to build the site
23 docker run --rm -it -v ${PWD}:/srv/jekyll -p 127.0.0.1:4000:4000 jekyll/jekyll:${JEKYLL_VERSION} make serve
25 ## serve : run a local server.
29 ## site : build files but do not run a server.
33 # repo-check : check repository settings.
35 @bin/repo_check.py -s .
37 ## clean : clean up junk files.
41 @rm -rf bin/__pycache__
42 @find . -name .DS_Store -exec rm {} \;
43 @find . -name '*~' -exec rm {} \;
44 @find . -name '*.pyc' -exec rm {} \;
46 ## clean-rmd : clean intermediate R files (that need to be committed to the repo).
51 ## ----------------------------------------
52 ## Commands specific to workshop websites.
54 .PHONY : workshop-check
56 ## workshop-check : check workshop homepage.
58 ${PYTHON} bin/workshop_check.py .
60 ## ----------------------------------------
61 ## Commands specific to lesson websites.
63 .PHONY : lesson-check lesson-md lesson-files lesson-fixme
66 RMD_SRC = $(wildcard _episodes_rmd/??-*.Rmd)
67 RMD_DST = $(patsubst _episodes_rmd/%.Rmd,_episodes/%.md,$(RMD_SRC))
69 # Lesson source files in the order they appear in the navigation menu.
74 $(sort $(wildcard _episodes/*.md)) \
76 $(sort $(wildcard _extras/*.md)) \
79 # Generated lesson files in the order they appear in the navigation menu.
82 ${DST}/conduct/index.html \
83 ${DST}/setup/index.html \
84 $(patsubst _episodes/%.md,${DST}/%/index.html,$(sort $(wildcard _episodes/*.md))) \
85 ${DST}/reference/index.html \
86 $(patsubst _extras/%.md,${DST}/%/index.html,$(sort $(wildcard _extras/*.md))) \
87 ${DST}/license/index.html
89 ## lesson-md : convert Rmarkdown files to markdown
90 lesson-md : ${RMD_DST}
92 _episodes/%.md: _episodes_rmd/%.Rmd
93 @bin/knit_lessons.sh $< $@
95 ## lesson-check : validate lesson Markdown.
96 lesson-check : lesson-fixme
97 ${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md
99 ## lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace.
101 ${PYTHON} bin/lesson_check.py -s . -p ${PARSER} -r _includes/links.md -l -w --permissive
103 ## unittest : run unit tests on checking tools.
105 ${PYTHON} bin/test_lesson_check.py
107 ## lesson-files : show expected names of generated files for debugging.
109 @echo 'RMD_SRC:' ${RMD_SRC}
110 @echo 'RMD_DST:' ${RMD_DST}
111 @echo 'MARKDOWN_SRC:' ${MARKDOWN_SRC}
112 @echo 'HTML_DST:' ${HTML_DST}
114 ## lesson-fixme : show FIXME markers embedded in source files.
116 @fgrep -i -n FIXME ${MARKDOWN_SRC} || true
118 #-------------------------------------------------------------------------------
119 # Include extra commands if available.
120 #-------------------------------------------------------------------------------