forked from raspberrypi/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (40 loc) · 1.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# The top-level Makefile which builds everything
ASCIIDOC_DIR = documentation/asciidoc
HTML_DIR = documentation/html
JEKYLL_ASSETS_DIR = jekyll-assets
SCRIPTS_DIR = scripts
DOCUMENTATION_REDIRECTS_DIR = documentation/redirects
DOCUMENTATION_INDEX = documentation/index.json
SITE_CONFIG = _config.yml
BUILD_DIR = build
ASCIIDOC_BUILD_DIR = $(BUILD_DIR)/jekyll
ASCIIDOC_INCLUDES_DIR = $(BUILD_DIR)/adoc_includes
AUTO_NINJABUILD = $(BUILD_DIR)/autogenerated.ninja
JEKYLL_CMD = bundle exec jekyll
.DEFAULT_GOAL := html
.PHONY: clean run_ninja clean_ninja html serve_html clean_html
$(BUILD_DIR):
@mkdir -p $@
# Delete all autogenerated files
clean: clean_html
rm -rf $(BUILD_DIR)
# AUTO_NINJABUILD contains all the parts of the ninjabuild where the rules themselves depend on other files
$(AUTO_NINJABUILD): $(SCRIPTS_DIR)/create_auto_ninjabuild.py $(DOCUMENTATION_INDEX) $(SITE_CONFIG) | $(BUILD_DIR)
$< $(DOCUMENTATION_INDEX) $(SITE_CONFIG) $(ASCIIDOC_DIR) $(SCRIPTS_DIR) $(ASCIIDOC_BUILD_DIR) $(ASCIIDOC_INCLUDES_DIR) $(JEKYLL_ASSETS_DIR) $(DOCUMENTATION_REDIRECTS_DIR) $@
# This runs ninjabuild to build everything in the ASCIIDOC_BUILD_DIR (and ASCIIDOC_INCLUDES_DIR)
run_ninja: $(AUTO_NINJABUILD)
ninja
# Delete all the files created by the 'run_ninja' target
clean_ninja:
rm -rf $(ASCIIDOC_BUILD_DIR)
rm -rf $(ASCIIDOC_INCLUDES_DIR)
rm -f $(AUTO_NINJABUILD)
# Build the html output files
html: run_ninja
$(JEKYLL_CMD) build
# Build the html output files and additionally run a small webserver for local previews
serve_html: run_ninja
$(JEKYLL_CMD) serve
# Delete all the files created by the 'html' target
clean_html:
rm -rf $(HTML_DIR)