2007-11-06 07:16:56 -08:00
|
|
|
#########################################################################
|
|
|
|
# #
|
2011-07-27 07:17:02 -07:00
|
|
|
# OCaml #
|
2007-11-06 07:16:56 -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 #
|
|
|
|
# under the terms of the GNU Library General Public License, with #
|
|
|
|
# the special exception on linking described in file ../../LICENSE. #
|
|
|
|
# #
|
|
|
|
#########################################################################
|
|
|
|
|
|
|
|
# Common Makefile for otherlibs
|
|
|
|
|
2013-11-29 05:04:38 -08:00
|
|
|
ROOTDIR=../..
|
|
|
|
include $(ROOTDIR)/config/Makefile
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
# Compilation options
|
|
|
|
CC=$(BYTECC)
|
2013-11-29 05:04:38 -08:00
|
|
|
CAMLRUN=$(ROOTDIR)/boot/ocamlrun
|
2014-04-29 04:56:17 -07:00
|
|
|
COMPFLAGS=-w +33..39 -warn-error A -bin-annot -g -safe-string $(EXTRACAMLFLAGS)
|
2013-11-29 05:04:38 -08:00
|
|
|
MKLIB=$(CAMLRUN) $(ROOTDIR)/tools/ocamlmklib
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
# Variables to be defined by individual libraries:
|
|
|
|
#LIBNAME=
|
|
|
|
#CLIBNAME=
|
|
|
|
#CMIFILES=
|
|
|
|
#CAMLOBJS=
|
|
|
|
#COBJS=
|
|
|
|
#EXTRACFLAGS=
|
|
|
|
#EXTRACAMLFLAGS=
|
|
|
|
#LINKOPTS=
|
|
|
|
#LDOPTS=
|
|
|
|
#HEADERS=
|
|
|
|
|
|
|
|
CMIFILES ?= $(CAMLOBJS:.cmo=.cmi)
|
|
|
|
CAMLOBJS_NAT ?= $(CAMLOBJS:.cmo=.cmx)
|
|
|
|
CLIBNAME ?= $(LIBNAME)
|
|
|
|
|
|
|
|
all: lib$(CLIBNAME).$(A) $(LIBNAME).cma $(CMIFILES)
|
|
|
|
|
|
|
|
allopt: lib$(CLIBNAME).$(A) $(LIBNAME).cmxa $(LIBNAME).$(CMXS) $(CMIFILES)
|
|
|
|
|
|
|
|
$(LIBNAME).cma: $(CAMLOBJS)
|
2013-11-29 05:04:38 -08:00
|
|
|
$(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlc '$(CAMLC)' -linkall \
|
|
|
|
$(CAMLOBJS) $(LINKOPTS)
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
$(LIBNAME).cmxa: $(CAMLOBJS_NAT)
|
2013-11-29 05:04:38 -08:00
|
|
|
$(MKLIB) -o $(LIBNAME) -oc $(CLIBNAME) -ocamlopt '$(CAMLOPT)' -linkall \
|
|
|
|
$(CAMLOBJS_NAT) $(LINKOPTS)
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
$(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A)
|
|
|
|
$(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa
|
|
|
|
|
|
|
|
lib$(CLIBNAME).$(A): $(COBJS)
|
|
|
|
$(MKLIB) -oc $(CLIBNAME) $(COBJS) $(LDOPTS)
|
|
|
|
|
2014-04-07 00:06:17 -07:00
|
|
|
INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
|
|
|
|
INSTALL_STUBLIBDIR=$(DESTDIR)$(STUBLIBDIR)
|
|
|
|
|
2007-11-06 07:16:56 -08:00
|
|
|
install::
|
|
|
|
if test -f dll$(CLIBNAME)$(EXT_DLL); then \
|
2014-04-07 00:06:17 -07:00
|
|
|
cp dll$(CLIBNAME)$(EXT_DLL) $(INSTALL_STUBLIBDIR)/; fi
|
|
|
|
cp lib$(CLIBNAME).$(A) $(INSTALL_LIBDIR)/
|
|
|
|
cd $(INSTALL_LIBDIR); $(RANLIB) lib$(CLIBNAME).$(A)
|
|
|
|
cp $(LIBNAME).cma $(CMIFILES) $(CMIFILES:.cmi=.mli) $(INSTALL_LIBDIR)/
|
|
|
|
if test -n "$(HEADERS)"; then cp $(HEADERS) $(INSTALL_LIBDIR)/caml/; fi
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
installopt:
|
2014-04-07 00:06:17 -07:00
|
|
|
cp $(CAMLOBJS_NAT) $(LIBNAME).cmxa $(LIBNAME).$(A) $(INSTALL_LIBDIR)/
|
|
|
|
cd $(INSTALL_LIBDIR); $(RANLIB) $(LIBNAME).a
|
|
|
|
if test -f $(LIBNAME).cmxs; then cp $(LIBNAME).cmxs $(INSTALL_LIBDIR)/; fi
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
partialclean:
|
|
|
|
rm -f *.cm*
|
|
|
|
|
|
|
|
clean:: partialclean
|
|
|
|
rm -f *.dll *.so *.a *.lib *.o *.obj
|
|
|
|
|
|
|
|
.SUFFIXES: .ml .mli .cmi .cmo .cmx .$(O)
|
|
|
|
|
|
|
|
.mli.cmi:
|
|
|
|
$(CAMLC) -c $(COMPFLAGS) $<
|
|
|
|
|
|
|
|
.ml.cmo:
|
|
|
|
$(CAMLC) -c $(COMPFLAGS) $<
|
|
|
|
|
|
|
|
.ml.cmx:
|
2008-07-15 08:31:32 -07:00
|
|
|
$(CAMLOPT) -c $(COMPFLAGS) $<
|
2007-11-06 07:16:56 -08:00
|
|
|
|
|
|
|
.c.$(O):
|
|
|
|
$(BYTECC) $(BYTECCCOMPOPTS) $(CFLAGS) -c $<
|