1#**************************************************************************
2#*                                                                        *
3#*                                 OCaml                                  *
4#*                                                                        *
5#*           Xavier Leroy, projet Cristal, INRIA Rocquencourt             *
6#*                                                                        *
7#*   Copyright 1999 Institut National de Recherche en Informatique et     *
8#*     en Automatique.                                                    *
9#*                                                                        *
10#*   All rights reserved.  This file is distributed under the terms of    *
11#*   the GNU Lesser General Public License version 2.1, with the          *
12#*   special exception on linking described in the file LICENSE.          *
13#*                                                                        *
14#**************************************************************************
15
16# Makefile for Raw_spacetime_lib
17
18ROOTDIR=../..
19include $(ROOTDIR)/config/Makefile
20
21CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun
22CAMLC=$(CAMLRUN) $(ROOTDIR)/ocamlc -nostdlib -I $(ROOTDIR)/stdlib
23CAMLOPT=$(CAMLRUN) $(ROOTDIR)/ocamlopt -nostdlib \
24        -I $(ROOTDIR)/stdlib
25CFLAGS=-I$(ROOTDIR)/byterun $(SHAREDCCCOMPOPTS) $(EXTRACFLAGS)
26
27# The remainder of this file could probably be simplified by including
28# ../Makefile.
29
30LIBNAME=raw_spacetime_lib
31CAMLOBJS=raw_spacetime_lib.cmo
32
33CC=$(BYTECC)
34COMPFLAGS=-w +33..39 -warn-error A -bin-annot -g -safe-string $(EXTRACAMLFLAGS)
35
36CMIFILES=$(CAMLOBJS:.cmo=.cmi)
37CAMLOBJS_NAT=$(CAMLOBJS:.cmo=.cmx)
38
39all: $(LIBNAME).cma $(CMIFILES)
40
41allopt: $(LIBNAME).cmxa $(LIBNAME).$(CMXS) $(CMIFILES)
42
43$(LIBNAME).cma: $(CAMLOBJS)
44	$(CAMLC) -a -o $(LIBNAME).cma -linkall $(CAMLOBJS)
45
46$(LIBNAME).cmxa: $(CAMLOBJS_NAT)
47	$(CAMLOPT) -a -o $(LIBNAME).cmxa -linkall $(CAMLOBJS_NAT)
48
49$(LIBNAME).cmxs: $(LIBNAME).cmxa
50	$(CAMLOPT) -shared -o $(LIBNAME).cmxs -I . $(LIBNAME).cmxa
51
52INSTALL_LIBDIR=$(DESTDIR)$(LIBDIR)
53
54install::
55	cp $(LIBNAME).cma $(CMIFILES) $(CMIFILES:.cmi=.mli) $(INSTALL_LIBDIR)
56
57installopt:
58	cp $(CAMLOBJS_NAT) $(LIBNAME).cmxa $(LIBNAME).$(A) $(INSTALL_LIBDIR)/
59	if test -f $(LIBNAME).cmxs; then \
60	  cp $(LIBNAME).cmxs $(INSTALL_LIBDIR)/; \
61	fi
62
63partialclean:
64	rm -f *.cm*
65
66clean:: partialclean
67	rm -f *.a *.o
68
69.SUFFIXES: .ml .mli .cmi .cmo .cmx
70
71.mli.cmi:
72	$(CAMLC) -c $(COMPFLAGS) $<
73
74.ml.cmo:
75	$(CAMLC) -c $(COMPFLAGS) $<
76
77.ml.cmx:
78	$(CAMLOPT) -c $(COMPFLAGS) $<
79
80depend:
81	$(CAMLRUN) $(ROOTDIR)/tools/ocamldep *.mli *.ml >> .depend
82
83include .depend
84