Skip to content
This repository
Newer
Older
100644 254 lines (201 sloc) 8.878 kb
fccc6851 » MLstate
2011-06-21 Initial open-source release
1 #!/usr/bin/make
2
3 # [ Warning ] don't use make to solve dependencies !!
4 #
5 # we rely on ocamlbuild which already handles them ; every rule should
6 # call it only once (no recursion)
7 #
8 # More info in build/Makefile.bld
9
10 include config.make
11
12 INSTALL ?= cp -u -L
1321ba91 » Frédéric Perrin
2011-09-21 On FreeBSD check and use gmake, use make elsewhere
13 MAKE ?= $_
14 export MAKE
fccc6851 » MLstate
2011-06-21 Initial open-source release
15
e7282e73 » Louis Gesbert
2011-07-06 [enhance] make: do not rebuild opa packages if the variable is set
16 ifndef NO_REBUILD_OPA_PACKAGES
8a40e707 » Louis Gesbert
2011-06-24 [feature] build: support for optional libraries, enabled libnattraver…
17 OPAOPT += "--rebuild"
e7282e73 » Louis Gesbert
2011-07-06 [enhance] make: do not rebuild opa packages if the variable is set
18 endif
8a40e707 » Louis Gesbert
2011-06-24 [feature] build: support for optional libraries, enabled libnattraver…
19
20 ifneq ($(HAS_CAMLIDL)$(HAS_LIBNATPMP)$(HAS_MINIUPNPC),111)
21 export DISABLED_LIBS = libnattraversal
22 endif
23
fccc6851 » MLstate
2011-06-21 Initial open-source release
24 .PHONY: default
25 default: all
26
27 include build/Makefile.bld
28
29 export
30
31 ##
32 ## STANDARD TARGETS
33 ##
34
35 .PHONY: all
a54a2d4e » OpaOnWindowsNow
2012-03-14 [enhance] Makefile: manpages should be the first thing we build
36 all: $(MYOCAMLBUILD)
fccc6851 » MLstate
2011-06-21 Initial open-source release
37 $(OCAMLBUILD) $(call target-tools,$(ALL_TOOLS)) opa-packages.stamp
38 @$(call copy-tools,$(ALL_TOOLS))
7c0c2fec » Aqua-Ye
2012-04-26 [feature] build: added a variable check to prevent generating manpage…
39 ifndef NO_MANPAGES
3e3c2e6a » jlmess77
2012-03-29 [fix] Makefile: Use $(MAKE) instead of hardcore "make".
40 $(MAKE) manpages
7c0c2fec » Aqua-Ye
2012-04-26 [feature] build: added a variable check to prevent generating manpage…
41 endif
fcef2313 » cedricss
2012-06-11 [enhance] Compile: Makefile improved for opa tools. Built them before…
42 $(MAKE) $(OPA_TOOLS)
fccc6851 » MLstate
2011-06-21 Initial open-source release
43
44 .PHONY: build
45 build: all
46
47 .PHONY: runtime-libs
48 runtime-libs: $(MYOCAMLBUILD)
49 $(OCAMLBUILD) runtime-libs.stamp
50
37c04ece » Louis Gesbert
2011-06-28 [cleanup] Makefile,comments: tiny cleanup & fixes
51 .PHONY: $(BUILD_DIR)/bin/opa
fccc6851 » MLstate
2011-06-21 Initial open-source release
52 $(BUILD_DIR)/bin/opa: $(MYOCAMLBUILD)
53 $(OCAMLBUILD) opa-packages.stamp $(target-tool-opa-bin)
54 @$(copy-tool-opa-bin)
01242f2b » Mathieu Baudet
2012-01-05 [cleanup] Makefile: replaced calls to 'pwd' with make builtin command…
55 @utils/install.sh --quiet --dir $(realpath $(BUILD_DIR)) --ocaml-prefix $(OCAMLLIB)/../..
fccc6851 » MLstate
2011-06-21 Initial open-source release
56
57 .PHONY: opa
58 opa: $(BUILD_DIR)/bin/opa
59
60 .PHONY: opa-packages
61 opa-packages: $(MYOCAMLBUILD)
62 $(OCAMLBUILD) opa-packages.stamp
63
64 .PHONY: stdlib
65 stdlib: opa-packages
66
af6c538d » cedricss
2012-06-07 [fix] Compile: fix release compilation
67 DISTRIB_TOOLS = opa-bin opa-plugin-builder-bin opa-plugin-browser-bin bslServerLib.ml opa-db-server opa-db-tool opa-cloud opatop opa-translate
fccc6851 » MLstate
2011-06-21 Initial open-source release
68
fcef2313 » cedricss
2012-06-11 [enhance] Compile: Makefile improved for opa tools. Built them before…
69 OPA_TOOLS = opa-create
70
fccc6851 » MLstate
2011-06-21 Initial open-source release
71 .PHONY: distrib
72 distrib: $(MYOCAMLBUILD)
73 $(OCAMLBUILD) $(call target-tools,$(DISTRIB_TOOLS)) opa-packages.stamp
74 @$(call copy-tools,$(DISTRIB_TOOLS))
98bbeeb6 » cedricss
2012-06-12 [fix] Compile: build opa-create for distrib
75 $(MAKE) $(OPA_TOOLS)
fccc6851 » MLstate
2011-06-21 Initial open-source release
76
8c3019bb » Mathieu Baudet
2012-01-05 [enhance] manpages: added target install-man to install manpages by d…
77 .PHONY: manpages
5baea24c » Mathieu Baudet
2012-01-05 [fix] manpages: when called from the main Makefile, do not assume 'in…
78 manpages: $(MYOCAMLBUILD)
ead3206e » jlmess77
2012-01-25 [fix] Makefile: Use $(MAKE) instead of hardcore "make" to allow FreeB…
79 $(MAKE) -C manpages OCAMLBUILD="$(OCAMLBUILD)" BLDDIR=../$(BUILD_DIR)
8c3019bb » Mathieu Baudet
2012-01-05 [enhance] manpages: added target install-man to install manpages by d…
80
2b398098 » cedricss
2012-06-06 [feature] opa-create: new tool to generate application skeletons
81 .PHONY: opa-create
82 opa-create: $(MYOCAMLBUILD)
83 $(OCAMLBUILD) tools/opa-create/src/opa-create.exe
84 @$(copy-tool-opa-create)
85 .PHONY: install-opa-create
86 install-opa-create:
87 @$(install-opa-create)
88 target-tool-opa-create = tools/opa-create/src/opa-create.exe
89 copy-tool-opa-create = mkdir -p $(BUILD_DIR)/bin && $(INSTALL) $(BUILD_DIR)/tools/opa-create/src/opa-create.exe $(BUILD_DIR)/bin/opa-create
90 install-opa-create = mkdir -p $(PREFIX)/bin && $(INSTALL) $(BUILD_DIR)/bin/opa-create $(INSTALL_DIR)/bin/opa-create
91
92
fccc6851 » MLstate
2011-06-21 Initial open-source release
93 ##
94 ## INSTALLATION
95 ##
96
97 .PHONY: install*
98
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
99 STDLIB_DIR = $(INSTALL_DIR)/lib/opa/stdlib
fccc6851 » MLstate
2011-06-21 Initial open-source release
100 define install-package
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
101 @printf "Installing into $(STDLIB_DIR)/$*.opx\r"
fccc6851 » MLstate
2011-06-21 Initial open-source release
102 @mkdir -p "$(STDLIB_DIR)/$*.opx/_build"
103 @find "$(BUILD_DIR)/$*.opx" -maxdepth 1 ! -type d -exec $(INSTALL) {} "$(STDLIB_DIR)/$*.opx/" \;
104 @$(INSTALL) $(BUILD_DIR)/$*.opx/_build/*.a "$(STDLIB_DIR)/$*.opx/_build/"
105 @$(INSTALL) $(BUILD_DIR)/$*.opx/_build/*.cmi "$(STDLIB_DIR)/$*.opx/_build/"
106 @$(INSTALL) $(BUILD_DIR)/$*.opx/_build/*.cmxa "$(STDLIB_DIR)/$*.opx/_build/"
107 endef
108
2f550855 » OpaOnWindowsNow
2011-10-21 [fix] Makefile: install plugins
109 define install-plugin
110 @printf "Installing into $(STDLIB_DIR)/$*.opp^[[K\r"
111 @mkdir -p "$(STDLIB_DIR)/$*.opp"
83717169 » BourgerieQuentin
2011-10-28 [fix] plugins: Install and searching
112 @$(INSTALL) $(BUILD_DIR)/$*.opp/*.bypass "$(STDLIB_DIR)/$*.opp/";
113 @$(INSTALL) $(BUILD_DIR)/$*.opp/*MLRuntime.* "$(STDLIB_DIR)/$*.opp/";
2f550855 » OpaOnWindowsNow
2011-10-21 [fix] Makefile: install plugins
114 endef
115
116
117
fccc6851 » MLstate
2011-06-21 Initial open-source release
118 OPA_PACKAGES := $(shell cd stdlib && ./all_packages.sh)
2f550855 » OpaOnWindowsNow
2011-10-21 [fix] Makefile: install plugins
119 OPA_PLUGINS := $(shell cd stdlib && ./all_plugins.sh)
fccc6851 » MLstate
2011-06-21 Initial open-source release
120
121 # Rules installing everything that has been compiled
122 #
123 # This doesn't rely on install rules generated by Makefile.bld ;
124 # instead it assumes that what you want to install has been properly
8c3019bb » Mathieu Baudet
2012-01-05 [enhance] manpages: added target install-man to install manpages by d…
125 # put in $(BUILD_DIR)/{bin,lib/opa,share/opa,share/man}.
fccc6851 » MLstate
2011-06-21 Initial open-source release
126 #
127 # This is the case of tools (because of Makefile.bld),
128 # and of opa runtime libs (because build rules copy them
129 # to $(BUILD_DIR)/lib/opa/static).
130 # This doesn't install the other libs though, use target install-libs
131 # for that
132
133 install-packageopt-%:
134 $(if $(wildcard $(BUILD_DIR)/$*.opx/_build/*),$(install-package))
135
136 install-package-%:
137 $(install-package)
138
139 install-packages: $(addprefix install-packageopt-,$(OPA_PACKAGES))
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
140 @printf "Installation to $(STDLIB_DIR) done.\n"
fccc6851 » MLstate
2011-06-21 Initial open-source release
141
142 install-all-packages: $(addprefix install-package-,$(OPA_PACKAGES))
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
143 @printf "Installation to $(STDLIB_DIR) done.\n"
fccc6851 » MLstate
2011-06-21 Initial open-source release
144
2f550855 » OpaOnWindowsNow
2011-10-21 [fix] Makefile: install plugins
145 install-pluginopt-%:
146 $(if $(wildcard $(BUILD_DIR)/$*.opp/),$(install-plugin))
147
148 install-plugin-%:
149 $(install-plugin)
150
151 install-plugins: $(addprefix install-pluginopt-,$(OPA_PLUGINS))
152 @printf "Installation to $(STDLIB_DIR) done.\n"
153
154 install-all-plugins: $(addprefix install-plugin-,$(OPA_PLUGINS))
155 @printf "Installation to $(STDLIB_DIR) done.\n"
156
157
158
fcef2313 » cedricss
2012-06-11 [enhance] Compile: Makefile improved for opa tools. Built them before…
159 install-bin:
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
160 @printf "Installing into $(INSTALL_DIR)/bin\r"
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
161 @mkdir -p $(INSTALL_DIR)/bin
162 @$(if $(wildcard $(BUILD_DIR)/bin/*),$(INSTALL) -r $(BUILD_DIR)/bin/* $(INSTALL_DIR)/bin)
163 @utils/install.sh --quiet --dir $(INSTALL_DIR) --ocamllib $(OCAMLLIB) --ocamlopt $(OCAMLOPT)
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
164 @printf "Installation to $(INSTALL_DIR)/bin done.\n"
fccc6851 » MLstate
2011-06-21 Initial open-source release
165
166 install-lib:
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
167 @printf "Installing into $(INSTALL_DIR)/lib/opa\r"
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
168 @mkdir -p $(INSTALL_DIR)/lib/opa
169 @$(if $(wildcard $(BUILD_DIR)/lib/opa/*),$(INSTALL) -r $(BUILD_DIR)/lib/opa/* $(INSTALL_DIR)/lib/opa/)
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
170 @printf "Installation to $(INSTALL_DIR)/lib/opa done.\n"
fccc6851 » MLstate
2011-06-21 Initial open-source release
171
172 install-share:
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
173 @printf "Installing into $(INSTALL_DIR)/share/opa\r"
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
174 @mkdir -p $(INSTALL_DIR)/share/opa
175 @$(if $(wildcard $(BUILD_DIR)/share/opa/*),$(INSTALL) -r $(BUILD_DIR)/share/opa/* $(INSTALL_DIR)/share/opa/)
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
176 @printf "Installation to $(INSTALL_DIR)/share/opa done.\n"
fccc6851 » MLstate
2011-06-21 Initial open-source release
177
8c3019bb » Mathieu Baudet
2012-01-05 [enhance] manpages: added target install-man to install manpages by d…
178 install-man:
179 @printf "Installing into $(INSTALL_DIR)/share/man\r"
180 @if [ -d $(BUILD_DIR)/man/man1 ]; then \
181 mkdir -p $(INSTALL_DIR)/share/man/man1; \
182 $(INSTALL) -r $(BUILD_DIR)/man/man1/*.1 $(INSTALL_DIR)/share/man/man1; \
183 fi
184 @printf "Installation to $(INSTALL_DIR)/share/man done.\n"
185
d4f157d6 » BourgerieQuentin
2012-03-07 [fix] build: No more install-doc
186 install: install-bin install-lib install-share install-plugins install-packages install-man
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
187 @printf "Installation into $(INSTALL_DIR) done.\n"
fccc6851 » MLstate
2011-06-21 Initial open-source release
188
189 .PHONY: uninstall
190 uninstall:
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
191 rm -rf $(INSTALL_DIR)/lib/opa
192 @[ ! -d $(INSTALL_DIR)/lib ] || [ -n "`ls -A $(INSTALL_DIR)/lib`" ] || rmdir $(INSTALL_DIR)/lib
193 rm -rf $(INSTALL_DIR)/share/opa
194 rm -rf $(INSTALL_DIR)/share/doc/opa
195 @[ ! -d $(INSTALL_DIR)/share ] || [ -n "`ls -A $(INSTALL_DIR)/share`" ] || rmdir $(INSTALL_DIR)/share
1b2772b4 » Louis Gesbert
2011-07-08 [fix] Makefile: zealous uninstall
196 $(foreach file,$(wildcard $(BUILD_DIR)/bin/*),rm -f $(INSTALL_DIR)/bin/$(notdir $(file));)
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
197 @utils/install.sh --uninstall --dir $(INSTALL_DIR)
198 @[ ! -d $(INSTALL_DIR)/bin ] || [ -n "`ls -A $(INSTALL_DIR)/bin`" ] || rmdir $(INSTALL_DIR)/bin
8037018e » Louis Gesbert
2011-06-23 [fix] Makefiles: using a more portable printf instead of echo
199 @printf "Uninstall done.\n"
fccc6851 » MLstate
2011-06-21 Initial open-source release
200
201 # Install our ocamlbuild-generation engine
202 install-bld:
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
203 @mkdir -p $(INSTALL_DIR)/bin
22b433a3 » Frédéric Perrin
2011-08-29 Don't assume that bash is in /bin
204 @echo "#!/usr/bin/env bash" > $(INSTALL_DIR)/bin/bld
205 @echo "set -e" >> $(INSTALL_DIR)/bin/bld
206 @echo "set -u" >> $(INSTALL_DIR)/bin/bld
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
207 @chmod 755 $(INSTALL_DIR)/bin/bld
208 @echo "BLDDIR=$(PREFIX)/share/opa/bld $(PREFIX)/share/opa/bld/gen_myocamlbuild.sh" >> $(INSTALL_DIR)/bin/bld
209 @echo "_build/myocamlbuild -no-plugin -j 6 \"\$$@\"" >> $(INSTALL_DIR)/bin/bld
210 @mkdir -p $(INSTALL_DIR)/share/opa/bld
fccc6851 » MLstate
2011-06-21 Initial open-source release
211 @$(INSTALL) build/gen_myocamlbuild.sh build/myocamlbuild_*fix.ml config.sh config.mli config.ml\
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
212 $(INSTALL_DIR)/share/opa/bld
fccc6851 » MLstate
2011-06-21 Initial open-source release
213
214 # Install an opa wrapper with different stdlib and options (for some backwards-compatibility)
215 install-qmlflat: # depends on opabsl_for_compiler, but we don't want to run ocamlbuild twice
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
216 @mkdir -p $(INSTALL_DIR)/bin $(INSTALL_DIR)/share/opa/mlstatebsl
217 @$(INSTALL) $(BUILD_DIR)/opabsl/mlstatebsl/opabslgen_*.opa $(INSTALL_DIR)/share/opa/mlstatebsl
22b433a3 » Frédéric Perrin
2011-08-29 Don't assume that bash is in /bin
218 @echo "#!/usr/bin/env bash" > $(INSTALL_DIR)/bin/qmlflat
219 @echo "set -e" >> $(INSTALL_DIR)/bin/qmlflat
220 @echo "set -u" >> $(INSTALL_DIR)/bin/qmlflat
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
221 @chmod 755 $(INSTALL_DIR)/bin/qmlflat
84c2f7f2 » BourgerieQuentin
2012-02-07 [fix] compilers: derived compiler should also handle syntax options.
222 @echo 'exec opa --parser classic --no-stdlib --no-server --no-cps --no-closure --no-ei --no-constant-sharing --no-undot --separated off --value-restriction disabled --no-warn duplicateL0 --no-warn typer.warncoerce --no-warn unused --no-discard-of-unused-stdlib --no-warn pattern $$(if ! grep -qE "(^| )--no-stdlib( |$$)" <<<"$$*"; then echo $(shell sed "s%^[^# ]\+%$(PREFIX)/share/opa/mlstatebsl/opabslgen_&%; t OK; d; :OK" opabsl/mlstatebsl/bsl-sources); fi) "$$@"' \
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
223 >> $(INSTALL_DIR)/bin/qmlflat
fccc6851 » MLstate
2011-06-21 Initial open-source release
224
225 # installs some dev tools on top of the normal install; these should not change often
c2f0a5d6 » Louis Gesbert
2011-06-22 [feature] make: installing more dev tools in the install-all target
226 install-all: install install-bld install-qmlflat utils/maxmem
894a7513 » delroth
2011-06-21 Support make DESTDIR=... install for easier packaging
227 @$(INSTALL) platform_helper.sh $(INSTALL_DIR)/bin/
776f9815 » François-Régis Sinot
2011-06-23 [contrib] pull request #1 from git://github.com/delroth/opalang
228 @$(INSTALL) utils/maxmem $(INSTALL_DIR)/bin/
c2f0a5d6 » Louis Gesbert
2011-06-22 [feature] make: installing more dev tools in the install-all target
229 @rm utils/maxmem
776f9815 » François-Régis Sinot
2011-06-23 [contrib] pull request #1 from git://github.com/delroth/opalang
230 @$(INSTALL) utils/plotmem $(INSTALL_DIR)/bin/
fccc6851 » MLstate
2011-06-21 Initial open-source release
231
232 ##
233 ## DOCUMENTATION
234 ##
235 # (in this section, multiple calls to ocamlbuild are tolerated)
236
237 .PHONY: doc.jsbsl
238 doc.jsbsl: $(MYOCAMLBUILD)
239 $(OCAMLBUILD) $@/index.html
240
241 # this rules provides the doc.html target (from Makefile.bld)
242 # the sed are just there to help sorting by filename-within-directory
243 .PHONY: doc.odocl
244 doc.odocl:
245 echo $(foreach lib,$(ALL_LIBS),$(lib-cmi-$(lib):%.cmi=%)) \
246 | sed 's# \+#\n#g' \
247 | sed 's#\(.*\)/\([^/]*\)#\1 \2#' \
248 | sort -k 2 -u \
249 | sed 's#\(.*\) \([^ ]*\)#\1/\2#' \
250 >$@
251
252 .PHONY: packages-api
253 packages-api: $(MYOCAMLBUILD)
5e9da00e » BourgerieQuentin
2012-02-02 [enhance] compiler, syntax: Default syntax is now js-like
254 OPAOPT="$(OPAOPT) --rebuild --api --parser classic" $(OCAMLBUILD) opa-packages.stamp
Something went wrong with that request. Please try again.