Created
February 24, 2017 20:30
-
-
Save tekknolagi/1d0c58396db2fb1971e819d2ee86b469 to your computer and use it in GitHub Desktop.
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
open Ocamlbuild_pack | |
open Ocamlbuild_plugin | |
let astgen = "./astgen.native" | |
let compile_c ~impl ~native tags arg out = | |
let tags = | |
tags ++ "ocaml" ++ (if native then "native" else "byte") ++ "compile" | |
in | |
let specs = | |
[ if native then !Options.ocamlopt else !Options.ocamlc; | |
A "-c"; | |
T tags; | |
Ocaml_utils.ocaml_ppflags tags; | |
Ocaml_utils.ocaml_include_flags arg; | |
A "-pp"; P astgen; | |
A "-o"; Px out; | |
A "-impl"; P arg ] | |
in | |
Cmd (S specs);; | |
let byte_compile_scm_implem ?tag scm cmo env build = | |
let scm = env scm and cmo = env cmo in | |
Ocaml_compiler.prepare_compile build scm; | |
compile_c ~impl:true | |
~native:false | |
(Tags.union (tags_of_pathname scm) (tags_of_pathname cmo)++"implem"+++tag) | |
scm | |
cmo;; | |
rule "scm -> cmo" | |
~prod:"%.cmo" | |
~deps:["%.scm"] | |
(byte_compile_scm_implem ~tag:"debug" "%.scm" "%.cmo") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment