forked from ocaml/opam
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
75 lines (60 loc) · 1.71 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
-include ../Makefile.config
ifndef OPAM
OPAM = ../src/opam
endif
BINDIR = $(dir $(OPAM))
SRCDIR = $(sort $(foreach x,$(wildcard ../src/*/*),$(dir $x)))
TOPICS = $(shell $(OPAM) help topics)
ifndef OPAM_ADMIN
OPAM_ADMIN = $(BINDIR)/opam-admin
endif
TOPICS_ADMIN = check depexts make rename stats
HELPFMT = --help=groff
ifndef OPAM_INSTALLER
OPAM_INSTALLER = $(BINDIR)/opam-installer
endif
SRCEXTDIR = ../src_ext/lib
ifneq ($(wildcard $(SRCEXTDIR)),)
OCAMLDOC = ocamldoc $(patsubst %,-I %,$(SRCDIR) $(SRCEXTDIR))
else
OCAMLDOC = ocamlfind ocamldoc $(patsubst %,-package %,$(PACKS)) $(patsubst %,-I %,$(SRCDIR))
endif
.PHONY: man html dev-manual pages
all: man dev html pages
man:
rm -rf man
mkdir -p man
$(OPAM) $(HELPFMT) > man/opam.1
for i in $(TOPICS); do\
$(OPAM) $$i $(HELPFMT) > man/opam-$$i.1;\
done
$(OPAM_ADMIN) $(HELPFMT) > man/opam-admin.1
for i in $(TOPICS_ADMIN); do\
$(OPAM_ADMIN) $$i $(HELPFMT) > man/opam-admin-$$i.1;\
done
$(OPAM_INSTALLER) $(HELPFMT) > man/opam-installer.1
man-html: man
rm -rf $@
mkdir -p $@
for f in $(wildcard man/*); do\
man2html -r $$f > man-html/$$(basename $$f .1).html;\
done
dev:
$(MAKE) -C dev-manual
html:
rm -rf html/ocamldoc
mkdir -p html/ocamldoc
sed 's/%{OPAMVERSION}%/'$(version)'/g' index.html > html/index.html
$(OCAMLDOC) $(wildcard ../src/*/*.mli) $(wildcard ../src/*/*.ml) -html -d html/ocamldoc || true
$(OCAMLDOC) $(wildcard ../src/*/*.mli) $(wildcard ../src/*/*.ml) -dot -o /dev/stdout | \
tred | \
dot -Tsvg > \
html/ocamldoc/dependencies.svg \
|| true
pages/%.html: pages/%.md
omd $^ -o $@
PAGES=$(wildcard pages/*.md)
pages: $(PAGES:.md=.html)
clean:
rm -rf man html/ocamldoc man-html pages/*.html
$(MAKE) -C dev-manual clean