From 70adde7ff5f0d58efbf92c838a0db0e14a5b6c6c Mon Sep 17 00:00:00 2001 From: Gabriel Scherer Date: Sun, 28 Jul 2019 20:50:45 +0200 Subject: [PATCH] Makefile.best_binaries: best-effort commands for OCAML{C,OPT,DEP,LEX} --- Makefile.best_binaries | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Makefile.best_binaries diff --git a/Makefile.best_binaries b/Makefile.best_binaries new file mode 100644 index 000000000..f673aed5e --- /dev/null +++ b/Makefile.best_binaries @@ -0,0 +1,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. + +ifeq "$(wildcard $(ROOTDIR)/ocamlc.opt)" "" +BEST_OCAMLC = $(CAMLRUN) $(ROOTDIR)/ocamlc +else +BEST_OCAMLC = $(ROOTDIR)/ocamlc.opt +endif + +BEST_OCAMLDEP = $(BEST_OCAMLC) -depend + +ifeq "$(wildcard $(ROOTDIR)/ocamlopt.opt)" "" +BEST_OCAMLOPT = $(CAMLRUN) $(ROOTDIR)/ocamlopt +else +BEST_OCAMLOPT = $(ROOTDIR)/ocamlopt.opt +endif + +ifeq "$(wildcard $(ROOTDIR)/lex/ocamllex.opt)" "" +BEST_OCAMLLEX = $(CAMLRUN) $(ROOTDIR)/lex/ocamllex +else +BEST_OCAMLLEX = $(ROOTDIR)/lex/ocamllex.opt +endif