forked from ocaml/v2.ocaml.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.from_md
30 lines (24 loc) · 867 Bytes
/
Makefile.from_md
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
# -*- mode: Makefile -*-
include Makefile.common
USE_OPAM_UPDATE_LIST = \
ocaml.org/index.html \
ocaml.org/index.fr.html \
ocaml.org/platform/index.html
$(USE_OPAM_UPDATE_LIST): opam_update_list
ocaml.org/%.html: site/%.md
@echo "HTML for $*"
@mkdir -p "$(shell dirname $@)"
@if grep -q '*Table of contents*' "$<" ; then $(MAKE) -f Makefile.from_md "$@.toc" ; fi
@$(MAKE) -f Makefile.from_md "$@.tmp"
@if [ -f "$@.toc" ] ; then \
${MPP} -set "filename=$<" -set "page=$@.tmp" -set "toc=$@.toc" template/main.mpp -o "$@" ; \
else \
${MPP} -set "filename=$<" -set "page=$@.tmp" template/main.mpp -o "$@" ; \
fi
@$(RM) "$@.tmp" "$@.toc"
ocaml.org/%.html.toc:site/%.md
@echo "TOC for $*"
@${OMD} -otoc -ts 0 "$<" -o "$@"
ocaml.org/%.html.tmp:site/%.md
@echo "Preprocess $*"
@sed -e 's|\*Table of contents\*||g' "$<" | $(OMD_PP) | ${OMD} -o "$@"