Created
May 27, 2011 07:09
-
-
Save joelreymont/994781 to your computer and use it in GitHub Desktop.
Avoid copying and invoke ocamlbuild once for all targets where executable name matches MainIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 618b4efb183fcd49256b43e04ef9e07fa67dcce6 Mon Sep 17 00:00:00 2001 | |
From: Joel Reymont <joelr1@gmail.com> | |
Date: Fri, 27 May 2011 09:07:29 +0200 | |
Subject: [PATCH] fast-track the case where executable name matches main, avoid copying | |
--- | |
src/base/BaseBuilt.ml | 9 ++++++++- | |
src/plugins/ocamlbuild/OCamlbuildPlugin.ml | 2 +- | |
2 files changed, 9 insertions(+), 2 deletions(-) | |
diff --git a/src/base/BaseBuilt.ml b/src/base/BaseBuilt.ml | |
index a9f2a15..c2a8ee6 100644 | |
--- a/src/base/BaseBuilt.ml | |
+++ b/src/base/BaseBuilt.ml | |
@@ -129,8 +129,15 @@ let of_executable ffn (cs, bs, exec) = | |
ext_dll | |
ext_program | |
in | |
+ let ext = match bs.bs_compiled_object with | |
+ | Native -> | |
+ ".native" | |
+ | Best when bool_of_string (is_native ()) -> | |
+ ".native" | |
+ | Byte | Best -> | |
+ ".byte" in | |
let evs = | |
- (BExec, cs.cs_name, [[ffn unix_exec_is]]) | |
+ (BExec, cs.cs_name, [[(ffn unix_exec_is)^ext]]) | |
:: | |
(match unix_dll_opt with | |
| Some fn -> | |
diff --git a/src/plugins/ocamlbuild/OCamlbuildPlugin.ml b/src/plugins/ocamlbuild/OCamlbuildPlugin.ml | |
index 6ae1767..59f34b7 100644 | |
--- a/src/plugins/ocamlbuild/OCamlbuildPlugin.ml | |
+++ b/src/plugins/ocamlbuild/OCamlbuildPlugin.ml | |
@@ -125,7 +125,7 @@ let build pkg argv = | |
in | |
evs, | |
- (if unix_tgt = unix_exec_is then | |
+ (if unix_tgt = unix_exec_is^ext then | |
Std [unix_tgt] | |
else | |
StdRename (unix_tgt, host_exec_is)) | |
-- | |
1.7.3.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment