forked from ocaml/v2.ocaml.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.common
127 lines (99 loc) · 4.59 KB
/
Makefile.common
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# -*- mode: Makefile-gmake -*-
LATEST_OCAML_VERSION=$(shell opam switch -s | sort -n | tail -n 1)
MPP_OPTIONS = -so '((!' -sc '!))' -son '{{!' -scn '!}}' -soc '' -scc '' -sec '' -sos '{{<' -scs '>}}' -its -set "LATEST_OCAML_VERSION=$(LATEST_OCAML_VERSION)" $(SET_STAGING)
MPP = mpp ${MPP_OPTIONS}
OMD_OPTIONS = -r ocaml=script/ocamltohtml -r tryocaml=script/ocamlapplet.bash
OMD = omd ${OMD_OPTIONS}
OMD_PP = script/md_preprocess
OCAML_VERSION = $(shell ocamlc -config | grep version | sed -e "s/version: *//")
OCAMLFLAGS = -annot -g
OCAMLOPT = ocamlfind ocamlopt $(OCAMLFLAGS)
OCAMLC = ocamlfind ocamlc $(OCAMLFLAGS)
HAS_SAFE_STRING=$(shell ocaml --help|grep safe-string)
ifneq ($(HAS_SAFE_STRING),)
OCAMLFLAGS := $(OCAMLFLAGS) -safe-string
endif
# Things to create before launching the parallel page build
pre-build: template/main.mpp template/footer.mpp \
template/front_code_snippet.html template/learn_code_snippet.html \
script/breadcrumb script/translations \
script/code_top script/ocamltohtml script/rss2html \
script/lang_of_filename script/translate script/link_of_lang \
opam_update_list $(OMD_PP)
UTILS_DEP = $(addprefix script/utils., cmi cmo cmx)
CODE_TYPE_DEP = $(addprefix script/code_types., cmi cmo cmx)
template/%_code_snippet.html:template/%_code_snippet.md $(OMD_PP)
cat "$<" | $(OMD_PP) | ${OMD} -o $@
opam_update_list: script/generate_opam_update_list
script/generate_opam_update_list
script/generate_opam_update_list: script/generate_opam_update_list.ml
cd script && \
$(OCAMLOPT) -o ../"$@" -package opamfu,opam2web,cow.syntax \
-linkpkg -syntax camlp4o generate_opam_update_list.ml
script/lang_of_filename: script/lang_of_filename.ml $(UTILS_DEP)
cd script && \
$(OCAMLOPT) -o ../"$@" -package str,netstring -linkpkg \
utils.cmx lang_of_filename.ml
script/translate: script/translate.ml $(UTILS_DEP)
cd script && \
$(OCAMLOPT) -o ../"$@" -package str,netstring -linkpkg \
utils.cmx translate.ml
script/link_of_lang: script/link_of_lang.ml $(UTILS_DEP)
cd script && \
$(OCAMLOPT) -o ../"$@" -package str,netstring -linkpkg \
utils.cmx link_of_lang.ml
script/breadcrumb: script/breadcrumb.ml $(UTILS_DEP)
cd script && \
$(OCAMLOPT) -o ../"$@" -package str,netstring -linkpkg \
utils.cmx breadcrumb.ml
script/rss2html: script/rss2html.ml script/http.ml $(UTILS_DEP)
cd script && \
$(OCAMLOPT) -package netstring,nettls-gnutls,netclient,syndic \
-linkpkg utils.cmx http.ml rss2html.ml -o ../"$@"
script/ocamltohtml:script/lexer.ml script/ocamltohtml.ml
cd script && \
$(OCAMLOPT) -o ../$@ lexer.ml ocamltohtml.ml
script/md_preprocess: $(CODE_TYPE_DEP) script/code.ml \
script/md_preprocess.ml $(UTILS_DEP)
cd script && \
$(OCAMLOPT) -o ../"$@" -package omd,str,netstring -linkpkg \
utils.cmx code_types.cmx code.ml md_preprocess.ml
script/code_top: $(CODE_TYPE_DEP) script/code_top.ml $(UTILS_DEP)
cd script && \
$(OCAMLC) -o ../"$@" -package netstring,dynlink,compiler-libs.toplevel \
-linkpkg utils.cmo code_types.cmo code_top.ml
RELATIVE_URLS_DEP=script/urlfun.ml script/urlfun.mli $(UTILS_DEP)
script/relative_urls: script/relative_urls.ml $(RELATIVE_URLS_DEP)
cd script && \
$(OCAMLOPT) -package uri,netstring -linkpkg \
utils.cmx urlfun.mli urlfun.ml relative_urls.ml -o ../"$@"
RELATIVE_URLS_DEP=script/urlfun.ml script/urlfun.mli $(UTILS_DEP)
script/absolute_urls: script/absolute_urls.ml $(RELATIVE_URLS_DEP)
cd script && \
$(OCAMLOPT) -package uri,netstring -linkpkg \
utils.cmx urlfun.mli urlfun.ml absolute_urls.ml -o ../"$@"
htmlescape:htmlescape.ml
$(OCAMLOPT) $< -o $@
script/translations: script/translations.ml $(UTILS_DEP)
cd script && \
$(OCAMLOPT) -o ../"$@" -package str,netstring -linkpkg \
utils.cmx translations.ml
script/%.cmx: script/%.ml script/%.cmi
$(OCAMLOPT) -package netstring,nettls-gnutls,netclient -c $< -o $@
script/%.cmi script/%.cmo: script/%.ml
$(OCAMLC) -package netstring,nettls-gnutls,netclient -c $< -o $@
TRASH += template/front_code_snippet.html opam_update_list \
$(addprefix script/, generate_opam_update_list lang_of_filename translate \
link_of_lang breadcrumb rss2html ocamltohtml md_preprocess \
code_top relative_urls translations )
# Camlp4 tutorials
CAMLP4_TUT_DIR = learn/tutorials/camlp4_3.10
CAMLP4_TUT_SOURCES = \
$(addprefix site/$(CAMLP4_TUT_DIR)/pa_foreach, .ml 2.ml 3.ml)
ocaml.org/$(CAMLP4_TUT_DIR)/foreach_tutorial.html: \
$(CAMLP4_TUT_SOURCES:.ml=.cmo)
site/$(CAMLP4_TUT_DIR)/%.cmo: site/$(CAMLP4_TUT_DIR)/%.ml
$(OCAMLC) -I +camlp4 camlp4lib.cma -pp camlp4orf -c $< -o $@
TRASH += $(CAMLP4_TUT_SOURCES:.ml=.cmi) $(CAMLP4_TUT_SOURCES:.ml=.cmo) \
$(CAMLP4_TUT_SOURCES:.ml=.annot)
.PHONY: pre-build