1 ## ========================================
2 ## Commands for both workshop and lesson websites.
5 MAKEFILES=Makefile $(wildcard *.mk)
7 PARSER=bin/markdown_ast.rb
11 .PHONY : commands clean files
14 ## commands : show all commands.
16 @grep -h -E '^##' ${MAKEFILES} | sed -e 's/## //g'
18 ## serve : run a local server.
20 ${JEKYLL} serve --config _config.yml,_config_dev.yml
22 ## site : build files but do not run a server.
24 ${JEKYLL} build --config _config.yml,_config_dev.yml
26 ## figures : re-generate inclusion displaying all figures.
28 @bin/extract_figures.py -s _episodes -p ${PARSER} > _includes/all_figures.html
30 # repo-check : check repository settings.
32 @bin/repo_check.py -s .
35 ## clean : clean up junk files.
39 @rm -rf bin/__pycache__
40 @find . -name .DS_Store -exec rm {} \;
41 @find . -name '*~' -exec rm {} \;
42 @find . -name '*.pyc' -exec rm {} \;
44 ## clean-rmd : clean intermediate R files (that need to be committed to the repo).
49 ## ----------------------------------------
50 ## Commands specific to workshop websites.
52 .PHONY : workshop-check
54 ## workshop-check : check workshop homepage.
56 @bin/workshop_check.py .
58 ## ----------------------------------------
59 ## Commands specific to lesson websites.
61 .PHONY : lesson-check lesson-rmd lesson-files lesson-fixme
64 RMD_SRC = $(wildcard _episodes_rmd/??-*.Rmd)
65 RMD_DST = $(patsubst _episodes_rmd/%.Rmd,_episodes/%.md,$(RMD_SRC))
67 # Lesson source files in the order they appear in the navigation menu.
72 $(wildcard _episodes/*.md) \
74 $(wildcard _extras/*.md) \
77 # Generated lesson files in the order they appear in the navigation menu.
80 ${DST}/conduct/index.html \
81 ${DST}/setup/index.html \
82 $(patsubst _episodes/%.md,${DST}/%/index.html,$(wildcard _episodes/*.md)) \
83 ${DST}/reference/index.html \
84 $(patsubst _extras/%.md,${DST}/%/index.html,$(wildcard _extras/*.md)) \
85 ${DST}/license/index.html
87 ## lesson-rmd : convert Rmarkdown files to markdown
88 lesson-rmd: $(RMD_SRC)
89 @bin/knit_lessons.sh $(RMD_SRC)
91 ## lesson-check : validate lesson Markdown.
93 @bin/lesson_check.py -s . -p ${PARSER}
95 ## lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace.
97 @bin/lesson_check.py -s . -p ${PARSER} -l -w
99 ## unittest : run unit tests on checking tools.
101 python bin/test_lesson_check.py
103 ## lesson-files : show expected names of generated files for debugging.
105 @echo 'RMD_SRC:' ${RMD_SRC}
106 @echo 'RMD_DST:' ${RMD_DST}
107 @echo 'MARKDOWN_SRC:' ${MARKDOWN_SRC}
108 @echo 'HTML_DST:' ${HTML_DST}
110 ## lesson-fixme : show FIXME markers embedded in source files.
112 @fgrep -i -n FIXME ${MARKDOWN_SRC} || true
114 #-------------------------------------------------------------------------------
115 # Include extra commands if available.
116 #-------------------------------------------------------------------------------