forked from ocaml/ocamlbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.make
91 lines (81 loc) · 3.08 KB
/
configure.make
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
# This file serve as a ./configure file, written as a GNU Makefile.
# It generates a local Makefile.config file that will be included by
# the main Makefile.
# Note: we initially included `ocamlc -where`/Makefile.config directly
# from the main Makefile, but this made it not robust to addition of
# new variables to this ocaml/Makefile.config that we do not control.
include $(shell ocamlc -where)/Makefile.config
OCAML_PREFIX = $(PREFIX)
OCAML_BINDIR = $(BINDIR)
OCAML_LIBDIR = $(LIBDIR)
# If you want to affect ocamlbuild's configuration by passing variable
# assignments to this Makefile, you probably want to define those
# OCAMLBUILD_* variables.
OCAMLBUILD_PREFIX ?= $(PREFIX)
OCAMLBUILD_BINDIR ?= \
$(or $(shell opam config var bin 2>/dev/null),\
$(PREFIX)/bin)
OCAMLBUILD_LIBDIR ?= \
$(or $(shell opam config var lib 2>/dev/null),\
$(shell ocamlfind printconf destdir 2>/dev/null),\
$(LIBDIR))
# It is important to distinguish OCAML_LIBDIR, which points to the
# directory of the ocaml compiler distribution, and OCAMLBUILD_LIBDIR,
# which should be the general library directory of OCaml projects on
# the user machine.
#
# When ocamlbuild was distributed as part of the OCaml compiler
# distribution, there was only one LIBDIR variable, which now
# corresponds to OCAML_LIBDIR.
#
# In particular, plugin compilation would link
# LIBDIR/ocamlbuild/ocamlbuild.cma. For an ocamlbuild distributed as
# part of the compiler distribution, this LIBDIR occurence must be
# interpreted as OCAML_LIBDIR; but with a separate ocamlbuild, it must
# be interpreted as OCAMLBUILD_LIBDIR, as this is where ocamlbuild
# libraries will be installed.
#
# In the generated configuration files, we export
# OCAMLBUILD_{PREFIX,BINDIR,LIBDIR}, which are the ones that should
# generally be used, as the shorted names {PREFIX,BINDIR,LIBDIR}.
ifeq ($(ARCH), none)
OCAML_NATIVE ?= false
else
OCAML_NATIVE ?= true
endif
OCAML_NATIVE_TOOLS ?= $(OCAML_NATIVE)
Makefile.config:
(echo "# This file was generated from configure.make"; \
echo ;\
echo "OCAML_PREFIX=$(OCAML_PREFIX)"; \
echo "OCAML_BINDIR=$(OCAML_BINDIR)"; \
echo "OCAML_LIBDIR=$(OCAML_LIBDIR)"; \
echo ;\
echo "EXT_OBJ=$(EXT_OBJ)"; \
echo "EXT_ASM=$(EXT_ASM)"; \
echo "EXT_LIB=$(EXT_LIB)"; \
echo "EXT_DLL=$(EXT_DLL)"; \
echo "EXE=$(EXE)"; \
echo ;\
echo "OCAML_NATIVE=$(OCAML_NATIVE)"; \
echo "OCAML_NATIVE_TOOLS=$(OCAML_NATIVE_TOOLS)"; \
echo "NATDYNLINK=$(NATDYNLINK)"; \
echo "SUPPORT_SHARED_LIBRARIES=$(SUPPORTS_SHARED_LIBRARIES)"; \
echo ;\
echo "PREFIX=$(OCAMLBUILD_PREFIX)"; \
echo "BINDIR=$(OCAMLBUILD_BINDIR)"; \
echo "LIBDIR=$(OCAMLBUILD_LIBDIR)"; \
) > $@
src/ocamlbuild_config.ml:
(echo "(* This file was generated from ../configure.make *)"; \
echo ;\
echo 'let bindir = "$(OCAMLBUILD_BINDIR)"'; \
echo 'let libdir = "$(OCAMLBUILD_LIBDIR)"'; \
echo 'let supports_shared_libraries = $(SUPPORTS_SHARED_LIBRARIES)';\
echo 'let a = "$(A)"'; \
echo 'let o = "$(O)"'; \
echo 'let so = "$(SO)"'; \
echo 'let ext_dll = "$(EXT_DLL)"'; \
echo 'let exe = "$(EXE)"'; \
echo 'let version = "$(shell ocaml scripts/cat.ml VERSION)"'; \
) > $@