blob: 480ea8a436bcf5cf2953073f98ae07f70176f2ad (
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
|
#########################################################################
# #
# 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
# Compilation options
CAMLC=$(CAMLRUN) ../../ocamlc -I ../../stdlib -I ../win32unix
CAMLOPT=$(CAMLRUN) ../../ocamlopt -I ../../stdlib -I ../win32unix
COMPFLAGS=-w +33 -warn-error A -g
ifeq "$(FLAMBDA)" "true"
OPTCOMPFLAGS=-O3
else
OPTCOMPFLAGS=
endif
MKLIB=$(CAMLRUN) ../../tools/ocamlmklib
CFLAGS=-I../../byterun $(EXTRACFLAGS)
export OCAML_FLEXLINK:=$(if $(wildcard ../../flexdll/Makefile),../../boot/ocamlrun ../../flexdll/flexlink.exe)
CAMLOBJS=thread.cmo mutex.cmo condition.cmo event.cmo threadUnix.cmo
CMIFILES=$(CAMLOBJS:.cmo=.cmi)
COBJS=st_stubs_b.$(O)
COBJS_NAT=st_stubs_n.$(O)
LIBNAME=threads
all: lib$(LIBNAME).$(A) $(LIBNAME).cma $(CMIFILES)
allopt: lib$(LIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).cmxs $(CMIFILES)
$(LIBNAME).cma: $(CAMLOBJS)
$(MKLIB) -o $(LIBNAME) -ocamlc "$(CAMLRUN) ../../ocamlc" \
-linkall $(CAMLOBJS) $(LINKOPTS)
lib$(LIBNAME).$(A): $(COBJS)
$(MKLIB) -o $(LIBNAME) $(COBJS) $(LDOPTS)
st_stubs_b.$(O): st_stubs.c st_win32.h
$(BYTECC) $(BYTECCCOMPOPTS) $(CFLAGS) -c st_stubs.c
mv st_stubs.$(O) st_stubs_b.$(O)
$(LIBNAME).cmxa: $(CAMLOBJS:.cmo=.cmx)
$(MKLIB) -o $(LIBNAME)nat \
-ocamlopt "$(CAMLRUN) ../../ocamlopt" -linkall \
$(CAMLOBJS:.cmo=.cmx) $(LINKOPTS)
mv $(LIBNAME)nat.cmxa $(LIBNAME).cmxa
mv $(LIBNAME)nat.$(A) $(LIBNAME).$(A)
$(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(LIBNAME)nat.$(A)
$(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa -linkall
lib$(LIBNAME)nat.$(A): $(COBJS_NAT)
$(MKLIB) -o $(LIBNAME)nat $(COBJS_NAT) $(LDOPTS)
st_stubs_n.$(O): st_stubs.c st_win32.h
$(NATIVECC) -DNATIVE_CODE -I../../asmrun -I../../byterun \
$(NATIVECCCOMPOPTS) -c st_stubs.c
mv st_stubs.$(O) st_stubs_n.$(O)
$(CAMLOBJS:.cmo=.cmx): ../../ocamlopt
partialclean:
rm -f *.cm*
clean: partialclean
rm -f *.dll *.$(A) *.$(O)
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
INSTALL_STUBLIBDIR=$(DESTDIR)$(STUBLIBDIR)
install:
cp dllthreads.dll "$(INSTALL_STUBLIBDIR)/dllthreads.dll"
cp libthreads.$(A) "$(INSTALL_LIBDIR)/libthreads.$(A)"
mkdir -p "$(INSTALL_LIBDIR)/threads"
cp $(CMIFILES) threads.cma "$(INSTALL_LIBDIR)/threads"
rm -f "$(INSTALL_LIBDIR)/threads/stdlib.cma"
cp threads.h "$(INSTALL_LIBDIR)/caml/threads.h"
installopt:
cp libthreadsnat.$(A) "$(INSTALL_LIBDIR)/libthreadsnat.$(A)"
cp $(THREAD_OBJS:.cmo=.cmx) threads.cmxa threads.$(A) \
"$(INSTALL_LIBDIR)/threads"
cp threads.cmxs "$(INSTALL_LIBDIR)/threads"
.SUFFIXES: .ml .mli .cmo .cmi .cmx
.mli.cmi:
$(CAMLC) -c $(COMPFLAGS) $<
.ml.cmo:
$(CAMLC) -c -g $(COMPFLAGS) $<
.ml.cmx:
$(CAMLOPT) -c $(COMPFLAGS) $(OPTCOMPFLAGS) $<
depend:
include .depend
|