1999-11-17 10:59:06 -08:00
|
|
|
#########################################################################
|
|
|
|
# #
|
2011-07-27 07:17:02 -07:00
|
|
|
# OCaml #
|
1999-11-17 10:59:06 -08:00
|
|
|
# #
|
|
|
|
# Xavier Leroy, projet Cristal, INRIA Rocquencourt #
|
|
|
|
# #
|
|
|
|
# Copyright 1999 Institut National de Recherche en Informatique et #
|
|
|
|
# en Automatique. All rights reserved. This file is distributed #
|
2001-12-07 05:41:02 -08:00
|
|
|
# under the terms of the GNU Library General Public License, with #
|
|
|
|
# the special exception on linking described in file ../../LICENSE. #
|
1999-11-17 10:59:06 -08:00
|
|
|
# #
|
|
|
|
#########################################################################
|
|
|
|
|
1997-05-14 02:43:45 -07:00
|
|
|
include ../../config/Makefile
|
|
|
|
|
2013-11-29 05:04:38 -08:00
|
|
|
CAMLC=../../ocamlcomp.sh -I ../unix
|
|
|
|
CAMLOPT=../../ocamlcompopt.sh -I ../unix
|
2001-11-08 02:32:24 -08:00
|
|
|
MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
|
2014-03-07 06:47:30 -08:00
|
|
|
COMPFLAGS=-w +33..39 -warn-error A -g -bin-annot
|
1997-05-14 02:43:45 -07:00
|
|
|
|
2010-04-27 00:55:08 -07:00
|
|
|
BYTECODE_C_OBJS=st_stubs_b.o
|
|
|
|
NATIVECODE_C_OBJS=st_stubs_n.o
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1998-08-08 11:42:22 -07:00
|
|
|
THREAD_OBJS= thread.cmo mutex.cmo condition.cmo event.cmo threadUnix.cmo
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1997-08-29 08:37:22 -07:00
|
|
|
all: libthreads.a threads.cma
|
1997-05-14 02:43:45 -07:00
|
|
|
|
2007-11-12 09:19:48 -08:00
|
|
|
allopt: libthreadsnat.a threads.cmxa
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1997-08-29 08:37:22 -07:00
|
|
|
libthreads.a: $(BYTECODE_C_OBJS)
|
2012-06-08 04:36:35 -07:00
|
|
|
$(MKLIB) -o threads $(BYTECODE_C_OBJS) -lpthread
|
1997-05-14 02:43:45 -07:00
|
|
|
|
2010-04-27 00:55:08 -07:00
|
|
|
st_stubs_b.o: st_stubs.c st_posix.h
|
2001-08-28 07:47:48 -07:00
|
|
|
$(BYTECC) -O -I../../byterun $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS) \
|
2010-04-27 00:55:08 -07:00
|
|
|
-c st_stubs.c
|
|
|
|
mv st_stubs.o st_stubs_b.o
|
1997-05-14 02:43:45 -07:00
|
|
|
|
2001-10-24 06:08:53 -07:00
|
|
|
# Dynamic linking with -lpthread is risky on many platforms, so
|
|
|
|
# do not create a shared object for libthreadsnat.
|
1997-08-29 08:37:22 -07:00
|
|
|
libthreadsnat.a: $(NATIVECODE_C_OBJS)
|
2001-10-24 06:08:53 -07:00
|
|
|
$(AR) rc libthreadsnat.a $(NATIVECODE_C_OBJS)
|
1997-05-14 02:43:45 -07:00
|
|
|
|
2010-04-27 00:55:08 -07:00
|
|
|
st_stubs_n.o: st_stubs.c st_posix.h
|
2013-09-04 08:12:37 -07:00
|
|
|
$(NATIVECC) -O -I../../asmrun -I../../byterun $(NATIVECCCOMPOPTS) \
|
|
|
|
$(SHAREDCCCOMPOPTS) -DNATIVE_CODE -DTARGET_$(ARCH) \
|
|
|
|
-DSYS_$(SYSTEM) -c st_stubs.c
|
2010-04-27 00:55:08 -07:00
|
|
|
mv st_stubs.o st_stubs_n.o
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1997-08-29 08:37:22 -07:00
|
|
|
threads.cma: $(THREAD_OBJS)
|
2013-11-29 05:04:38 -08:00
|
|
|
$(MKLIB) -ocamlc '$(CAMLC)' -o threads $(THREAD_OBJS) \
|
2010-01-22 04:48:24 -08:00
|
|
|
-cclib -lunix $(PTHREAD_LINK)
|
1997-05-14 02:43:45 -07:00
|
|
|
|
2001-10-24 06:08:53 -07:00
|
|
|
# See remark above: force static linking of libthreadsnat.a
|
1997-08-29 08:37:22 -07:00
|
|
|
threads.cmxa: $(THREAD_OBJS:.cmo=.cmx)
|
2001-10-24 06:08:53 -07:00
|
|
|
$(CAMLOPT) -a -o threads.cmxa $(THREAD_OBJS:.cmo=.cmx) \
|
2010-01-22 04:48:24 -08:00
|
|
|
-cclib -lthreadsnat $(PTHREAD_LINK)
|
2007-11-06 07:16:56 -08:00
|
|
|
|
2010-01-22 04:48:24 -08:00
|
|
|
# Note: I removed "-cclib -lunix" from the line above.
|
|
|
|
# Indeed, if we link threads.cmxa, then we must also link unix.cmxa,
|
2007-11-06 07:16:56 -08:00
|
|
|
# which itself will pass -lunix to the C linker. It seems more
|
|
|
|
# modular to me this way. -- Alain
|
|
|
|
|
|
|
|
|
1997-12-19 08:04:40 -08:00
|
|
|
$(THREAD_OBJS:.cmo=.cmx): ../../ocamlopt
|
|
|
|
|
1997-05-14 02:43:45 -07:00
|
|
|
partialclean:
|
|
|
|
rm -f *.cm*
|
|
|
|
|
|
|
|
clean: partialclean
|
2003-08-21 06:52:07 -07:00
|
|
|
rm -f *.o *.a *.so
|
1997-05-14 02:43:45 -07:00
|
|
|
|
|
|
|
install:
|
2002-06-27 04:36:02 -07:00
|
|
|
if test -f dllthreads.so; then cp dllthreads.so $(STUBLIBDIR)/dllthreads.so; fi
|
1997-05-14 02:43:45 -07:00
|
|
|
cp libthreads.a $(LIBDIR)/libthreads.a
|
2001-08-28 07:47:48 -07:00
|
|
|
cd $(LIBDIR); $(RANLIB) libthreads.a
|
1997-08-29 08:37:22 -07:00
|
|
|
if test -d $(LIBDIR)/threads; then :; else mkdir $(LIBDIR)/threads; fi
|
1997-11-18 09:16:06 -08:00
|
|
|
cp $(THREAD_OBJS:.cmo=.cmi) threads.cma $(LIBDIR)/threads
|
1997-11-19 02:00:47 -08:00
|
|
|
rm -f $(LIBDIR)/threads/stdlib.cma
|
1999-05-15 08:10:28 -07:00
|
|
|
cp thread.mli mutex.mli condition.mli event.mli threadUnix.mli $(LIBDIR)
|
2010-04-27 00:55:08 -07:00
|
|
|
cp threads.h $(LIBDIR)/caml/threads.h
|
1997-05-14 02:43:45 -07:00
|
|
|
|
|
|
|
installopt:
|
1997-11-18 09:16:06 -08:00
|
|
|
cp libthreadsnat.a $(LIBDIR)/libthreadsnat.a
|
2001-08-28 07:47:48 -07:00
|
|
|
cd $(LIBDIR); $(RANLIB) libthreadsnat.a
|
1997-11-18 09:16:06 -08:00
|
|
|
cp $(THREAD_OBJS:.cmo=.cmx) threads.cmxa threads.a $(LIBDIR)/threads
|
2001-08-28 07:47:48 -07:00
|
|
|
cd $(LIBDIR)/threads; $(RANLIB) threads.a
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1997-11-17 05:04:18 -08:00
|
|
|
.SUFFIXES: .ml .mli .cmo .cmi .cmx
|
1997-05-14 02:43:45 -07:00
|
|
|
|
|
|
|
.mli.cmi:
|
|
|
|
$(CAMLC) -c $(COMPFLAGS) $<
|
|
|
|
|
|
|
|
.ml.cmo:
|
2007-01-29 04:11:18 -08:00
|
|
|
$(CAMLC) -c $(COMPFLAGS) $<
|
1997-05-14 02:43:45 -07:00
|
|
|
|
|
|
|
.ml.cmx:
|
2008-07-15 08:31:32 -07:00
|
|
|
$(CAMLOPT) -c $(COMPFLAGS) $<
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1997-11-17 05:04:18 -08:00
|
|
|
depend: $(GENFILES)
|
2006-09-20 04:14:37 -07:00
|
|
|
-gcc -MM -I../../byterun *.c > .depend
|
1999-02-24 08:01:41 -08:00
|
|
|
../../boot/ocamlrun ../../tools/ocamldep *.mli *.ml >> .depend
|
1997-05-14 02:43:45 -07:00
|
|
|
|
|
|
|
include .depend
|