forked from ocaml/opam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (55 loc) · 1.74 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
-include ../Makefile.config
ifeq ($(DUNE),)
DUNE_EXE = ../src_ext/dune-local/_boot/install/default/bin/dune$(EXE)
ifeq ($(shell command -v cygpath 2>/dev/null),)
DUNE := $(DUNE_EXE)
else
DUNE := $(shell echo "$(DUNE_EXE)" | cygpath -f - -a)
endif
else
DUNE_EXE=
endif
DUNE_PROFILE ?= release
DUNE_ARGS ?=
ifeq ($(DUNE_PROFILE_ARG),release)
# TODO Replace with --release when we require dune >= 2.5
DUNE_PROFILE_ARG = --profile=release
else
DUNE_PROFILE_ARG = --profile=$(DUNE_PROFILE)
endif
.PHONY: man html pages
all: html pages
MANDIR = ../_build/default/doc/man
.PHONY: man-html
man-html:
rm -rf man-html
mkdir -p $@
echo '<!DOCTYPE html>' >$@/index.html
echo '<html><head>' >>$@/index.html
echo ' <title>Opam man-pages index</title>' >>$@/index.html
echo '</head><body>' >>$@/index.html
echo '<h1>Opam $(version) man-pages index</h1>' >>$@/index.html
echo '<ul>' >>$@/index.html
for f in ${MANDIR}/*; do\
man2html -r $$f | sed 1,2d > $@/$$(basename $$f .1).html;\
echo " <li><a href=\"$$(basename $$f .1).html\">$$(basename $$f .1)</a></li>" >>$@/index.html;\
done
echo '</ul>' >>$@/index.html
echo '</body></html>' >>$@/index.html
html:
rm -rf html
cd .. && $(DUNE) build $(DUNE_PROFILE_ARG) --root . $(DUNE_ARGS) @doc
cp -r ../_build/default/_doc/_html html
chmod -R +w html
sed 's/%{OPAMVERSION}%/'$(version)'/g' index.html > html/index.html
# Not to break older links, add manpages to the `ocamldoc` dir
mkdir -p html/ocamldoc
cd html/ocamldoc && for f in ../*/*/index.html; do\
ln -sf $$f $$(basename $$(dirname $$f)).html;\
done
pages/%.html: pages/%.md
omd $^ -o $@
PAGES=$(wildcard pages/*.md)
pages: $(PAGES:.md=.html)
clean:
rm -rf dependencies.dot html/ocamldoc man-html pages/*.html html/index.html