blob: 7aef44a506ed7f01b87d73b17696b3887f917c78 (
plain)
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
128
129
130
131
132
133
134
135
136
|
#########################################################################
# #
# OCaml #
# #
# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
# #
# Copyright 1999 Institut National de Recherche en Informatique et #
# en Automatique. All rights reserved. This file is distributed #
# under the terms of the GNU Library General Public License, with #
# the special exception on linking described in file ../LICENSE. #
# #
#########################################################################
include ../config/Makefile
CAMLRUN ?= ../boot/ocamlrun
CAMLYACC ?= ../boot/ocamlyacc
CC=$(BYTECC)
COMMONOBJS=\
interp.o misc.o stacks.o fix_code.o startup_aux.o startup.o \
freelist.o major_gc.o minor_gc.o memory.o alloc.o roots.o globroots.o \
fail.o signals.o signals_byt.o printexc.o backtrace_prim.o backtrace.o \
compare.o ints.o floats.o str.o array.o io.o extern.o intern.o \
hash.o sys.o meta.o parsing.o gc_ctrl.o terminfo.o md5.o obj.o \
lexing.o callback.o debugger.o weak.o compact.o finalise.o custom.o \
dynlink.o
PRIMS=\
alloc.c array.c compare.c extern.c floats.c gc_ctrl.c hash.c \
intern.c interp.c ints.c io.c lexing.c md5.c meta.c obj.c parsing.c \
signals.c str.c sys.c terminfo.c callback.c weak.c finalise.c stacks.c \
dynlink.c backtrace_prim.c backtrace.c
PUBLIC_INCLUDES=\
address_class.h alloc.h callback.h config.h custom.h fail.h gc.h \
hash.h intext.h \
memory.h misc.h mlvalues.h printexc.h signals.h compatibility.h \
version.h
all:: ocamlrun$(EXE) ld.conf libcamlrun.$(A) all-$(RUNTIMED)
.PHONY: all
all-noruntimed:
.PHONY: all-noruntimed
all-runtimed: ocamlrund$(EXE) libcamlrund.$(A)
.PHONY: all-runtimed
ld.conf: ../config/Makefile
echo "$(STUBLIBDIR)" > ld.conf
echo "$(LIBDIR)" >> ld.conf
# Installation
INSTALL_BINDIR=$(DESTDIR)$(BINDIR)
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
install::
cp $(CAMLRUN)$(EXE) $(INSTALL_BINDIR)/ocamlrun$(EXE)
cp libcamlrun.$(A) $(INSTALL_LIBDIR)/libcamlrun.$(A)
cd $(INSTALL_LIBDIR); $(RANLIB) libcamlrun.$(A)
if test -d $(INSTALL_LIBDIR)/caml; then : ; \
else mkdir $(INSTALL_LIBDIR)/caml; fi
for i in $(PUBLIC_INCLUDES); do \
sed -f ../tools/cleanup-header caml/$$i > $(INSTALL_LIBDIR)/caml/$$i; \
done
cp ld.conf $(INSTALL_LIBDIR)/ld.conf
.PHONY: install
install:: install-$(RUNTIMED)
install-noruntimed:
.PHONY: install-noruntimed
# TODO: when cross-compiling, do not install ocamlrund
# it doesn't hurt to install it, but it's useless and might be confusing
# because it's an executable for the target machine, while we're installing
# binaries for the host.
install-runtimed:
cp ocamlrund$(EXE) $(INSTALL_BINDIR)/ocamlrund$(EXE)
cp libcamlrund.$(A) $(INSTALL_LIBDIR)/libcamlrund.$(A)
.PHONY: install-runtimed
# If primitives contain duplicated lines (e.g. because the code is defined
# like
# #ifdef X
# CAMLprim value caml_foo() ...
# #else
# CAMLprim value caml_foo() ...
# end), horrible things will happen (duplicated entries in Runtimedef ->
# double registration in Symtable -> empty entry in the PRIM table ->
# the bytecode interpreter is confused).
# We sort the primitive file and remove duplicates to avoid this problem.
# Warning: we use "sort | uniq" instead of "sort -u" because in the MSVC
# port, the "sort" program in the path is Microsoft's and not cygwin's
primitives : $(PRIMS)
sed -n -e "s/CAMLprim value \([a-z0-9_][a-z0-9_]*\).*/\1/p" $(PRIMS) \
| sort | uniq > primitives
prims.c : primitives
(echo '#include "caml/mlvalues.h"'; \
echo '#include "caml/prims.h"'; \
sed -e 's/.*/extern value &();/' primitives; \
echo 'c_primitive caml_builtin_cprim[] = {'; \
sed -e 's/.*/ &,/' primitives; \
echo ' 0 };'; \
echo 'char * caml_names_of_builtin_cprim[] = {'; \
sed -e 's/.*/ "&",/' primitives; \
echo ' 0 };') > prims.c
caml/opnames.h : caml/instruct.h
sed -e '/\/\*/d' \
-e '/^#/d' \
-e 's/enum /char * names_of_/' \
-e 's/{$$/[] = {/' \
-e 's/\([[:upper:]][[:upper:]_0-9]*\)/"\1"/g' caml/instruct.h \
> caml/opnames.h
# caml/jumptbl.h is required only if you have GCC 2.0 or later
caml/jumptbl.h : caml/instruct.h
sed -n -e '/^ /s/ \([A-Z]\)/ \&\&lbl_\1/gp' \
-e '/^}/q' caml/instruct.h > caml/jumptbl.h
caml/version.h : ../VERSION ../tools/make-version-header.sh
../tools/make-version-header.sh ../VERSION > caml/version.h
clean ::
rm -f ocamlrun$(EXE) ocamlrund$(EXE) *.$(O) *.$(A) *.$(SO)
rm -f primitives prims.c caml/opnames.h caml/jumptbl.h ld.conf
rm -f caml/version.h
.PHONY: clean
|