Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ocamlbuild包含额外的包_Ocaml_Ocamlbuild - Fatal编程技术网

ocamlbuild包含额外的包

ocamlbuild包含额外的包,ocaml,ocamlbuild,Ocaml,Ocamlbuild,我正在处理,并使用以下命令行进行编译: ocamlbuild -cflags -g,-I,+llvm-3.4 -lflags -I,+llvm-3.4 toy.byte 有没有办法将这些额外的cflag和lflag移到_标记或myocamlbuild.ml文件中,这样我就不需要键入它们/可以将它们存储在源代码管理/生成可复制的构建中 以下是_标记文件: <{lexer,parser}.ml>: use_camlp4, pp(camlp4of) <*.{byte,native}

我正在处理,并使用以下命令行进行编译:

ocamlbuild -cflags -g,-I,+llvm-3.4 -lflags -I,+llvm-3.4 toy.byte
有没有办法将这些额外的cflag和lflag移到_标记或myocamlbuild.ml文件中,这样我就不需要键入它们/可以将它们存储在源代码管理/生成可复制的构建中

以下是_标记文件:

<{lexer,parser}.ml>: use_camlp4, pp(camlp4of)
<*.{byte,native}>: g++, use_llvm, use_llvm_analysis
<*.{byte,native}>: use_llvm_executionengine, use_llvm_target
<*.{byte,native}>: use_llvm_scalar_opts, use_bindings
我做了一些像

let mlflags = []
and cflags = []
and clibs = []

let rec arg_weave p = function
  | x::xs -> (A p) :: (A x) :: arg_weave p xs
  | []    -> []
and arg x = A x
...
let () = dispatch begin function
  | After_rules ->
    flag ["ocaml"; "compile"] (S (List.map arg mlflags));
    flag ["c"; "compile"]     (S (arg_weave "-ccopt" cflags));
    flag ["c"; "link"]        (S (arg_weave "-cclib" clibs));
    ...
  end
另一个选项是标记其他选项。例如,在ocaml_specific.ml文件中,它们有一个调试设置和所有与选项相关的标志选项组合

flag ["ocaml"; "debug"; "compile"; "byte"] (A "-g");;
flag ["ocaml"; "debug"; "link"; "byte"; "program"] (A "-g");;
flag ["ocaml"; "debug"; "pack"; "byte"] (A "-g");;
flag ["ocaml"; "debug"; "compile"; "native"] (A "-g");;
flag ["ocaml"; "debug"; "link"; "native"; "program"] (A "-g");;
flag ["ocaml"; "debug"; "pack"; "native"] (A "-g");;

然后,在
\u标记
文件中,您可以使用
true:debug
为所有文件启用它,或者可以用限制选项的模式替换
true
。因此,如果一个选项还不存在,您可以创建自己的选项,您将看到它与fully-myocamlbuild.ml解决方案类似,但是每个标记都有附加标志,而不是一次包含所有标记。

-g
\u标记中的
true:debug
替换

-I
选项理想情况下应该由相应的ocamlfind包替换,例如调用
ocamlbuild-使用ocamlfind
并在
\u标记中指定
true:package(llvm,llvm\u分析)
和/或调用的任何其他包(并删除
ocaml\u lib
调用
myocamlbuild.ml


在旁注中,只需使用所需的
ocamlbuild
调用创建一个
Makefile
,然后运行
make
进行构建。

查看github和其他地方的其他“myocamlbuild.ml”文件。这个——还有你的另一个问题——很容易从这些样本中确定。你对“容易确定”的定义肯定与我不同。很抱歉,我不太理解你答案的前两部分。你能举一个例子来说明你所说的重用:-使用ocamlfind吗?makefile技巧就是我现在所拥有的。在_标记文件中,可以有行
true:debug
true:dtypes
true:profile
true:rectypes
true:bin\u annot
true:output\u obj
。。。打开这些特定选项。您还可以将
true
替换为特定文件的模式。这些是
ocaml/ocamlbuild/ocaml_specific.ml
文件中的内置标志。
flag ["ocaml"; "debug"; "compile"; "byte"] (A "-g");;
flag ["ocaml"; "debug"; "link"; "byte"; "program"] (A "-g");;
flag ["ocaml"; "debug"; "pack"; "byte"] (A "-g");;
flag ["ocaml"; "debug"; "compile"; "native"] (A "-g");;
flag ["ocaml"; "debug"; "link"; "native"; "program"] (A "-g");;
flag ["ocaml"; "debug"; "pack"; "native"] (A "-g");;