From 5a413714ae4dc63265f0d24663402d5dde1194a1 Mon Sep 17 00:00:00 2001 From: letouzey Date: Fri, 8 Apr 2011 18:14:36 +0000 Subject: ocamlbuild: support again camlp5 in addition to camlp4 git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@13984 85f007b7-540e-0410-9357-904b9bb8a0f7 --- _tags | 8 ++++---- myocamlbuild.ml | 18 +++++++++++------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/_tags b/_tags index e6ac5e6d0a..66b40d02df 100644 --- a/_tags +++ b/_tags @@ -1,15 +1,15 @@ ## tags for binaries - : use_str, use_unix, use_dynlink, use_camlp4 - : use_unix, use_dynlink, use_camlp4 + : use_str, use_unix, use_dynlink, use_camlpX + : use_unix, use_dynlink, use_camlpX : use_unix - : use_unix, use_dynlink, use_camlp4 + : use_unix, use_dynlink, use_camlpX : use_str : use_str : use_str : use_str, use_unix, thread, ide - : use_str, use_unix, use_dynlink, use_camlp4 + : use_str, use_unix, use_dynlink, use_camlpX : use_nums, use_unix ## tags for ide diff --git a/myocamlbuild.ml b/myocamlbuild.ml index 8565c1482b..acaac12e13 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -72,15 +72,14 @@ let _ = if w32 then begin Options.ocamlmklib := A w32ocamlmklib; end -let _ = - if Coq_config.camlp4 = "camlp5" then begin - printf "Camlp5 is not supported by this ocamlbuild plugin\n"; - printf "Use camlp4, or make, or both\n"; - exit 1 - end +let use_camlp5 = (Coq_config.camlp4 = "camlp5") + +let camlp4args = + if use_camlp5 then [A "pa_extend.cmo";A "q_MLast.cmo";A "pa_macro.cmo"] + else [] let ocaml = A Coq_config.ocaml -let camlp4o = A Coq_config.camlp4o +let camlp4o = S ((A Coq_config.camlp4o) :: camlp4args) let camlp4incl = S[A"-I"; A Coq_config.camlp4lib] let camlp4compat = Sh Coq_config.camlp4compat let opt = (Coq_config.best = "opt") @@ -286,6 +285,7 @@ let extra_rules () = begin flag_and_dep ["p4mod"; "use_compat5"] (P "tools/compat5.cmo"); flag_and_dep ["p4mod"; "use_compat5b"] (P "tools/compat5b.cmo"); + if not use_camlp5 then begin let mlp_cmo s = let src=s^".mlp" and dst=s^".cmo" in rule (src^".cmo") ~dep:src ~prod:dst ~insert:`top @@ -295,6 +295,10 @@ let extra_rules () = begin in mlp_cmo "tools/compat5"; mlp_cmo "tools/compat5b"; + end; + + ocaml_lib ~extern:true ~dir:Coq_config.camlp4lib ~tag_name:"use_camlpX" + ~byte:true ~native:true (if use_camlp5 then "gramlib" else "camlp4lib"); (** Special case of toplevel/mltop.ml4: - mltop.ml will be the old mltop.optml and be used to obtain mltop.cmx -- cgit v1.2.3