-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.best_binaries
46 lines (39 loc) · 2.16 KB
/
Makefile.best_binaries
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#**************************************************************************
#* *
#* OCaml *
#* *
#* Gabriel Scherer, projet Parsifal, INRIA Saclay *
#* *
#* Copyright 2019 Institut National de Recherche en Informatique et *
#* en Automatique. *
#* *
#* All rights reserved. This file is distributed under the terms of *
#* the GNU Lesser General Public License version 2.1, with the *
#* special exception on linking described in the file LICENSE. *
#* *
#**************************************************************************
# This Makefile should be included.
# It expects:
# - Makefile.common to be included as well
# - a ROOTDIR variable pointing to the repository root
# relative to the including Makefile
# It exports definitions of BEST_OCAML{C,OPT,LEX,DEP} commands that
# run to either the bytecode binary built in the repository or the
# native binary, if available. Note that they never use the boot/
# versions: we assume that ocamlc, ocamlopt, etc. have been run first.
check_not_stale = \
$(if $(shell test $(ROOTDIR)/$1 -nt $(ROOTDIR)/$2 && echo stale), \
$(info Warning: we are not using the native binary $2 \
because it is older than the bytecode binary $1; \
you should silence this warning by either removing $2 \
or rebuilding it (or `touch`-ing it) if you want it used.), \
ok)
choose_best = $(strip $(if \
$(and $(wildcard $(ROOTDIR)/$1.opt),$(strip \
$(call check_not_stale,$1,$1.opt))), \
$(ROOTDIR)/$1.opt, \
$(CAMLRUN) $(ROOTDIR)/$1))
BEST_OCAMLC := $(call choose_best,ocamlc)
BEST_OCAMLOPT := $(call choose_best,ocamlopt)
BEST_OCAMLLEX := $(call choose_best,lex/ocamllex)
BEST_OCAMLDEP := $(BEST_OCAMLC) -depend