This repository has been archived by the owner on Jul 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
88 lines (78 loc) · 2.59 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
SHELL:=/bin/sh
# Absolute path to the directory of this Makefile
BASE := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
MK := $(BASE)/mk
# define the concrete build directories
EXPORT_DIR := exports
ARTICLE_DIR := articles
MEDIA_DIR := media
SECTION_DIR := sections
DOCS_DIR := docs
ASSET_DIR := assets
TMP_BIN_DIR := .build
REVISION_LOCK_FILE := revisions.json
# name of the dummy book for article exports
ARTICLE_BOOK := articles
ARTICLE_BOOK_REVISION := dummy
# files which might be created (for clean target)
OUTPUT_DIRS := $(ARTICLE_DIR) $(MEDIA_DIR) $(SECTION_DIR) $(EXPORT_DIR) $(DOCS_DIR)
TEMP_FILES := $(REVISION_LOCK_FILE)
.SECONDARY:
.DELETE_ON_ERROR:
.SECONDEXPANSION:
include $(MK)/utils.mk
include $(MK)/macros.mk
include $(MK)/articles.mk
include $(MK)/sections.mk
include $(MK)/media.mk
include $(MK)/dependencies.mk
include $(MK)/article_book.mk
include $(MK)/book.mk
include $(MK)/targets/html.mk
include $(MK)/targets/latex.mk
include $(MK)/targets/pdf.mk
include $(MK)/targets/stats.mk
init:
$(call map,check_dependency,ocamlopt inkscape convert qrencode latex sed jq curl sponge)
$(call map,create_directory,$(TMP_BIN_DIR) $(MK)/bin)
$(call build_rust_dep,mediawiki-peg-rust, \
https://github.com/vroland/mediawiki-peg-rust, \
0c5dbd47ee0fe592313c222c91e160bc52769be5, \
mwtoast)
$(call build_rust_dep,mfnf-export, \
https://github.com/vroland/mfnf-export, \
e5a2b1e, \
mfnf_ex)
$(call build_rust_dep,handlebars-cli-rs, \
https://github.com/vroland/handlebars-cli-rs, \
9f79b96, \
handlebars-cli-rs,mediawiki)
$(call build_rust_dep,mfnf-sitemap-parser, \
https://github.com/vroland/mfnf-sitemap-parser, \
75c551d, \
parse_bookmap)
$(call build_rust_dep,mwlint, \
https://github.com/vroland/mwlint, \
69a4252, \
mwlint)
$(call git_clone,extension-math, \
https://phabricator.wikimedia.org/diffusion/EMAT/extension-math.git)
(cd $(TMP_BIN_DIR)/extension-math \
&& git reset --hard 8879b5b7a1c2a983ad6d191c1b9f2fdf2b40956e \
&& cd texvccheck \
&& make && \
cp texvccheck $(MK)/bin)
(cd .build/ && wget -q https://github.com/KaTeX/KaTeX/releases/download/v0.10.0/katex.tar.gz -O katex.tar.gz)
(cd $(ASSET_DIR)/html/html_book_assets && tar -xf $(BASE)/.build/katex.tar.gz)
# font cache clearing might be necessary after font changes
(luaotfload-tool --cache=erase || echo "could not clear LaTeX font cache!")
doc:
(cd doc \
&& $(MK)/bin/mwlint --dump-docs > src/template_specification.md \
&& mdbook build)
clean:
$(call map,remove_file,$(OUTPUT_DIRS))
$(call map,remove_file,$(TEMP_FILES))
clean_all:
git clean -ffdx
.PHONY: clean clean_all init doc