package / ocaml-base-compiler.4.10.0 / Makefile.common.in
1 # @configure_input@
2
3 #**************************************************************************
4 #* *
5 #* OCaml *
6 #* *
7 #* Gabriel Scherer, projet Parsifal, INRIA Saclay *
8 #* *
9 #* Copyright 2018 Institut National de Recherche en Informatique et *
10 #* en Automatique. *
11 #* *
12 #* All rights reserved. This file is distributed under the terms of *
13 #* the GNU Lesser General Public License version 2.1, with the *
14 #* special exception on linking described in the file LICENSE. *
15 #* *
16 #**************************************************************************
17
18 # This makefile contains common definitions and rules shared by
19 # other Makefiles
20 # We assume that Makefile.config has already been included
21
22 INSTALL ?= @INSTALL@
23 INSTALL_DATA ?= $(INSTALL) -m u=rw,g=rw,o=r
24 INSTALL_PROG ?= $(INSTALL) -m u=rwx,g=rwx,o=rx
25
26 # note: these are defined by lazy expansions
27 # as some parts of the makefiles change BINDIR, etc.
28 # and expect INSTALL_BINDIR, etc. to stay in synch
29 # (see `shellquote` in tools/Makefile)
30 DESTDIR ?=
31 INSTALL_BINDIR = $(DESTDIR)$(BINDIR)
32 INSTALL_LIBDIR = $(DESTDIR)$(LIBDIR)
33 INSTALL_STUBLIBDIR = $(DESTDIR)$(STUBLIBDIR)
34 INSTALL_MANDIR = $(DESTDIR)$(MANDIR)
35
36 ifeq "$(UNIX_OR_WIN32)" "win32"
37 FLEXDLL_SUBMODULE_PRESENT := $(wildcard $(ROOTDIR)/flexdll/Makefile)
38 else
39 FLEXDLL_SUBMODULE_PRESENT =
40 endif
41
42 # Use boot/ocamlc.opt if available
43 CAMLRUN ?= $(ROOTDIR)/boot/ocamlrun
44 ifeq (0,$(shell \
45 test $(ROOTDIR)/boot/ocamlc.opt -nt $(ROOTDIR)/boot/ocamlc; \
46 echo $$?))
47 BOOT_OCAMLC = $(ROOTDIR)/boot/ocamlc.opt
48 else
49 BOOT_OCAMLC = $(CAMLRUN) $(ROOTDIR)/boot/ocamlc
50 endif
51
52 ifeq "$(FLEXDLL_SUBMODULE_PRESENT)" ""
53 FLEXLINK_ENV =
54 CAMLOPT_CMD = $(CAMLOPT)
55 OCAMLOPT_CMD = $(OCAMLOPT)
56 MKLIB_CMD = $(MKLIB)
57 ocamlc_cmd = $(ocamlc)
58 ocamlopt_cmd = $(ocamlopt)
59 else
60 FLEXLINK_ENV = \
61 OCAML_FLEXLINK="$(ROOTDIR)/boot/ocamlrun $(ROOTDIR)/flexdll/flexlink.exe"
62 CAMLOPT_CMD = $(FLEXLINK_ENV) $(CAMLOPT)
63 OCAMLOPT_CMD = $(FLEXLINK_ENV) $(OCAMLOPT)
64 MKLIB_CMD = $(FLEXLINK_ENV) $(MKLIB)
65 ocamlc_cmd = $(FLEXLINK_ENV) $(ocamlc)
66 ocamlopt_cmd = $(FLEXLINK_ENV) $(ocamlopt)
67 endif
68
69 # By default, request ocamllex to be quiet
70 OCAMLLEX_FLAGS ?= -q
71
72 # The rule to compile C files
73
74 # This rule is similar to GNU make's implicit rule, except that it is more
75 # general (it supports both .o and .obj)
76
77 %.$(O): %.c
78 $(CC) -c $(OC_CFLAGS) $(OC_CPPFLAGS) $(OUTPUTOBJ)$@ $<
79