summaryrefslogtreecommitdiff
path: root/myocamlbuild.ml
diff options
context:
space:
mode:
Diffstat (limited to 'myocamlbuild.ml')
-rw-r--r--myocamlbuild.ml24
1 files changed, 22 insertions, 2 deletions
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index f062b50b..1994efac 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -64,8 +64,10 @@ let w32pref = "i586-mingw32msvc"
let w32ocamlc = w32pref^"-ocamlc"
let w32ocamlopt = w32pref^"-ocamlopt"
let w32ocamlmklib = w32pref^"-ocamlmklib"
+let w32res = w32pref^"-windres"
let w32lib = "/usr/"^w32pref^"/lib/"
let w32bin = "/usr/"^w32pref^"/bin/"
+let w32ico = "ide/coq_icon.o"
let _ = if w32 then begin
Options.ocamlopt := A w32ocamlopt;
@@ -167,6 +169,7 @@ let coqmktop = "scripts/coqmktop"
type links = Both | Best | BestInPlace | Ide
let all_binaries =
+ (if w32 then [ "mkwinapp", "tools/mkwinapp", Best ] else []) @
[ "coqtop", coqtop, Both;
"coqide", coqide, Ide;
"coqmktop", coqmktop, Both;
@@ -365,18 +368,35 @@ let extra_rules () = begin
"let ide = \""^ide_mods^"\"\n"],
tolink));
+(** For windows, building coff object file from a .rc (for the icon) *)
+
+ if w32 then rule ".rc.o" ~deps:["%.rc";"ide/coq.ico"] ~prod:"%.o"
+ (fun env _ ->
+ let rc = env "%.rc" and o = env "%.o" in
+ Cmd (S [P w32res;A "--input-format";A "rc";A "--input";P rc;
+ A "--output-format";A "coff";A "--output"; Px o]));
+
(** Coqtop and coqide *)
let mktop_rule f is_ide =
let fo = f^".native" and fb = f^".byte" in
let ideflag = if is_ide then A"-ide" else N in
let depsall = [coqmktopbest;libcoqrun] in
+ let depsall = if w32 then w32ico::depsall else depsall in
let depso = "coq_config.cmx" :: core_cmxa in
let depsb = "coq_config.cmo" :: core_cma in
let depideo = if is_ide then [ide_cmxa] else [] in
let depideb = if is_ide then [ide_cma] else [] in
- let w32ideflag = (*if is_ide then [A"-ccopt";A"\"-link -mwindows\""] else*) [] in
- let w32flag = if not w32 then N else S ([A"-camlbin";A w32bin]@w32ideflag) in
+ let w32ideflag =
+ (* Uncomment the following line to make coqide a console-free win32 app.
+ For the moment we don't, some issue remain to be investigated.
+ In the meantime, coqide can be made console-free a posteriori via
+ the mkwinapp tool. *)
+ (*if is_ide then [A"-ccopt";A"\"-link -Wl,-subsystem,windows\""] else*) [] in
+ let w32flag =
+ if not w32 then N
+ else S ([A"-camlbin";A w32bin;A "-ccopt";P w32ico]@w32ideflag)
+ in
if opt then rule fo ~prod:fo ~deps:(depsall@depso@depideo) ~insert:`top
(cmd [P coqmktopbest;w32flag;A"-boot";A"-opt";ideflag;incl fo;A"-o";Px fo]);
rule fb ~prod:fb ~deps:(depsall@depsb@depideb) ~insert:`top