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 ## clean : clean up junk files.
34 @rm -rf bin/__pycache__
35 @find . -name .DS_Store -exec rm {} \;
36 @find . -name '*~' -exec rm {} \;
37 @find . -name '*.pyc' -exec rm {} \;
41 ## ----------------------------------------
42 ## Commands specific to workshop websites.
44 .PHONY : workshop-check
46 ## workshop-check : check workshop homepage.
48 @bin/workshop_check.py .
50 ## ----------------------------------------
51 ## Commands specific to lesson websites.
53 .PHONY : lesson-check lesson-rmd lesson-files lesson-fixme
56 RMD_SRC = $(wildcard _episodes_rmd/??-*.Rmd)
57 RMD_DST = $(patsubst _episodes_rmd/%.Rmd,_episodes/%.md,$(RMD_SRC))
59 # Lesson source files in the order they appear in the navigation menu.
64 $(wildcard _episodes/*.md) \
66 $(wildcard _extras/*.md) \
69 # Generated lesson files in the order they appear in the navigation menu.
72 ${DST}/conduct/index.html \
73 ${DST}/setup/index.html \
74 $(patsubst _episodes/%.md,${DST}/%/index.html,$(wildcard _episodes/*.md)) \
75 ${DST}/reference/index.html \
76 $(patsubst _extras/%.md,${DST}/%/index.html,$(wildcard _extras/*.md)) \
77 ${DST}/license/index.html
79 ## lesson-rmd: : convert Rmarkdown files to markdown
80 lesson-rmd: $(RMD_SRC)
83 ## lesson-check : validate lesson Markdown.
85 @bin/lesson_check.py -s . -p ${PARSER}
88 python bin/test_lesson_check.py
90 ## lesson-files : show expected names of generated files for debugging.
92 @echo 'RMD_SRC:' ${RMD_SRC}
93 @echo 'RMD_DST:' ${RMD_DST}
94 @echo 'MARKDOWN_SRC:' ${MARKDOWN_SRC}
95 @echo 'HTML_DST:' ${HTML_DST}
97 ## lesson-fixme : show FIXME markers embedded in source files.
99 @fgrep -i -n FIXME ${MARKDOWN_SRC} || true
101 #-------------------------------------------------------------------------------
102 # Include extra commands if available.
103 #-------------------------------------------------------------------------------