Tidying up based on first contact with R maintainers.
[rnaseq-cwl-training.git] / Makefile
1 ## ========================================
2 ## Commands for both workshop and lesson websites.
3
4 # Settings
5 MAKEFILES=Makefile $(wildcard *.mk)
6 JEKYLL=jekyll
7 PARSER=bin/markdown_ast.rb
8 DST=_site
9
10 # Controls
11 .PHONY : commands clean files
12 all : commands
13
14 ## commands       : show all commands.
15 commands :
16         @grep -h -E '^##' ${MAKEFILES} | sed -e 's/## //g'
17
18 ## serve          : run a local server.
19 serve :
20         ${JEKYLL} serve --config _config.yml,_config_dev.yml
21
22 ## site           : build files but do not run a server.
23 site :
24         ${JEKYLL} build --config _config.yml,_config_dev.yml
25
26 ## figures        : re-generate inclusion displaying all figures.
27 figures :
28         @bin/extract_figures.py -s _episodes -p ${PARSER} > _includes/all_figures.html
29
30 ## clean          : clean up junk files.
31 clean :
32         @rm -rf ${DST}
33         @rm -rf .sass-cache
34         @rm -rf bin/__pycache__
35         @find . -name .DS_Store -exec rm {} \;
36         @find . -name '*~' -exec rm {} \;
37         @find . -name '*.pyc' -exec rm {} \;
38
39 ## ----------------------------------------
40 ## Commands specific to workshop websites.
41
42 .PHONY : workshop-check
43
44 ## workshop-check : check workshop homepage.
45 workshop-check :
46         @bin/workshop_check.py .
47
48 ## ----------------------------------------
49 ## Commands specific to lesson websites.
50
51 .PHONY : lesson-check lesson-files lesson-fixme lesson-single
52
53 # Lesson source files in the order they appear in the navigation menu.
54 SRC_FILES = \
55   index.md \
56   CONDUCT.md \
57   setup.md \
58   $(wildcard _episodes/*.md) \
59   reference.md \
60   $(wildcard _extras/*.md) \
61   LICENSE.md
62
63 # Generated lesson files in the order they appear in the navigation menu.
64 HTML_FILES = \
65   ${DST}/index.html \
66   ${DST}/conduct/index.html \
67   ${DST}/setup/index.html \
68   $(patsubst _episodes/%.md,${DST}/%/index.html,$(wildcard _episodes/*.md)) \
69   ${DST}/reference/index.html \
70   $(patsubst _extras/%.md,${DST}/%/index.html,$(wildcard _extras/*.md)) \
71   ${DST}/license/index.html
72
73 ## lesson-check   : validate lesson Markdown.
74 lesson-check :
75         @bin/lesson_check.py -s . -p ${PARSER}
76
77 unittest :
78         python bin/test_lesson_check.py
79
80 ## lesson-files   : show expected names of generated files for debugging.
81 lesson-files :
82         @echo 'source:' ${SRC_FILES}
83         @echo 'generated:' ${HTML_FILES}
84
85 ## lesson-fixme   : show FIXME markers embedded in source files.
86 lesson-fixme :
87         @fgrep -i -n FIXME ${SRC_FILES} || true
88
89 #-------------------------------------------------------------------------------
90 # Include extra commands if available.
91 #-------------------------------------------------------------------------------
92
93 -include commands.mk