-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (37 loc) · 1.88 KB
/
Makefile
File metadata and controls
47 lines (37 loc) · 1.88 KB
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
.PHONY : all
SRC_DIR := doc
TMP_DIR := $(SRC_DIR)/build
PSP_DIR := $(SRC_DIR)/example
PSP_FILES := $(shell find $(PSP_DIR) -type f -name '*.psp')
DOC_DIR := docs
SCRIPTS_DIR := scripts
DOCKER_DIR := docker
DOCKER_IMAGE := webdyne-mkdocs:latest
DOCKER_STAMP := $(DOCKER_DIR)/.built
all : $(SRC_DIR)/webdyne.md gh-deploy
webdyne.md0 : webdyne.xml0
xmllint --xinclude --noent webdyne.xml -o webdyne-db5-expanded.xml
pandoc -f docbook -t markdown -o webdyne.md webdyne-db5-expanded.xml
perl -pi -e 's/\\</</g' $@
$(SRC_DIR)/webdyne.md : $(SRC_DIR)/webdyne.xml
mkdir -p $(TMP_DIR)
xmllint --xinclude --noent $< -o $(TMP_DIR)/$(notdir $<)
xsltproc $(SCRIPTS_DIR)/promote-title-ids.xsl $(TMP_DIR)/$(notdir $<) | sponge $(TMP_DIR)/$(notdir $<)
#pandoc -f docbook -t markdown-smart --lua-filter=$(SCRIPTS_DIR)/admonition-advanced.lua --lua-filter=$(SCRIPTS_DIR)/fix-images.lua --extract-media=$(DOC_DIR)/images -o $(TMP_DIR)/$(notdir $@) $(TMP_DIR)/$(notdir $<)
pandoc -f docbook -t markdown-smart --lua-filter=$(SCRIPTS_DIR)/admonition-advanced.lua --resource-path=$(SRC_DIR) --extract-media=$(DOC_DIR) -o $(TMP_DIR)/$(notdir $@) $(TMP_DIR)/$(notdir $<)
perl -pi -e 's/\\</</g' $(TMP_DIR)/$(notdir $@)
# Fix image placeholders from pandoc
#perl -pi -e 's/\[\]\{.*original-image-src="([^"]+)"[^\}]*\}//s' $(TMP_DIR)/$(notdir $@)
perl -pi -e 's{\Qdocs/images\E}{images}g' $(TMP_DIR)/$(notdir $@)
rm -f $(DOC_DIR)/*.md
perl $(SCRIPTS_DIR)/mdsplit.pl $(TMP_DIR)/$(notdir $@) $(DOC_DIR)
gh-deploy : $(SRC_DIR)/webdyne.md
mkdocs gh-deploy -f mkdocs.gh.yml
serve : $(SRC_DIR)/webdyne.md docker
docker rm -f webdyne-mkdocs || true
docker run -d --name webdyne-mkdocs -e PORT=5000 -p 5000:5000 webdyne-mkdocs
mkdocs serve -f mkdocs.local.yml
docker: $(DOCKER_STAMP)
$(DOCKER_STAMP) : $(PSP_FILES) docker/Dockerfile.alpine
docker build -t $(DOCKER_IMAGE) -f docker/Dockerfile.alpine .
touch $(DOCKER_STAMP)