1999-11-17 10:59:06 -08:00
|
|
|
#########################################################################
|
|
|
|
# #
|
|
|
|
# Objective Caml #
|
|
|
|
# #
|
|
|
|
# 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
|
|
|
# #
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
1997-05-14 02:43:45 -07:00
|
|
|
include ../../config/Makefile
|
|
|
|
|
2002-04-27 07:45:33 -07:00
|
|
|
CAMLC=../../ocamlcomp.sh -I ../unix
|
|
|
|
CAMLOPT=../../ocamlcompopt.sh -I ../unix
|
2001-11-08 02:32:24 -08:00
|
|
|
MKLIB=../../boot/ocamlrun ../../tools/ocamlmklib
|
2002-01-20 07:12:32 -08:00
|
|
|
COMPFLAGS=-warn-error A
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1997-08-29 08:37:22 -07:00
|
|
|
BYTECODE_C_OBJS=posix_b.o
|
|
|
|
NATIVECODE_C_OBJS=posix_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-09-01 07:26:16 -07:00
|
|
|
GENFILES=thread.ml
|
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
|
|
|
|
1997-08-29 08:37:22 -07: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)
|
2001-10-24 06:08:53 -07:00
|
|
|
$(MKLIB) -o threads $(BYTECODE_C_OBJS)
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1997-08-29 08:37:22 -07:00
|
|
|
posix_b.o: posix.c
|
2001-08-28 07:47:48 -07:00
|
|
|
$(BYTECC) -O -I../../byterun $(BYTECCCOMPOPTS) $(SHAREDCCCOMPOPTS) \
|
|
|
|
-c posix.c
|
1997-08-29 08:37:22 -07:00
|
|
|
mv posix.o posix_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
|
|
|
|
1997-08-29 08:37:22 -07:00
|
|
|
posix_n.o: posix.c
|
2001-09-05 04:56:46 -07:00
|
|
|
$(NATIVECC) -O -I../../asmrun -I../../byterun $(NATIVECCCOMPOPTS) $(SHAREDCCCOMPOPTS) -DNATIVE_CODE -DTARGET_$(ARCH) -DSYS_$(SYSTEM) -c posix.c
|
1997-08-29 08:37:22 -07:00
|
|
|
mv posix.o posix_n.o
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1997-08-29 08:37:22 -07:00
|
|
|
threads.cma: $(THREAD_OBJS)
|
2001-08-28 07:47:48 -07:00
|
|
|
$(MKLIB) -ocamlc '$(CAMLC)' -o threads $(THREAD_OBJS) \
|
|
|
|
-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) \
|
|
|
|
-cclib -lthreadsnat -cclib -lunix -cclib "$(PTHREAD_LINK)"
|
1997-05-14 02:43:45 -07:00
|
|
|
|
1997-12-19 08:04:40 -08:00
|
|
|
$(THREAD_OBJS:.cmo=.cmx): ../../ocamlopt
|
|
|
|
|
1997-11-17 05:04:18 -08:00
|
|
|
thread.ml: thread_posix.ml
|
|
|
|
ln -s thread_posix.ml thread.ml
|
|
|
|
|
1997-05-14 02:43:45 -07:00
|
|
|
partialclean:
|
|
|
|
rm -f *.cm*
|
|
|
|
|
|
|
|
clean: partialclean
|
2001-03-30 04:21:13 -08:00
|
|
|
rm -f libthreads*.a *.o threads.a
|
1997-05-14 02:43:45 -07:00
|
|
|
rm -f $(GENFILES)
|
|
|
|
|
|
|
|
install:
|
2001-10-30 01:32:32 -08:00
|
|
|
if test -f dllthreads.so; then cp dllthreads.so $(LIBDIR)/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)
|
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:
|
2001-06-15 07:23:20 -07:00
|
|
|
$(CAMLC) -c -g $(COMPFLAGS) $<
|
1997-05-14 02:43:45 -07:00
|
|
|
|
|
|
|
.ml.cmx:
|
|
|
|
$(CAMLOPT) -c $(COMPFLAGS) $<
|
|
|
|
|
1997-11-17 05:04:18 -08:00
|
|
|
depend: $(GENFILES)
|
1997-05-14 02:43:45 -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
|