add script to generate jbuilder flags dynamically

This commit is contained in:
Simon Cruanes 2018-01-14 20:38:40 -06:00
parent a307bb09f7
commit d97e1e7231
11 changed files with 40 additions and 25 deletions

View file

@ -3,8 +3,7 @@
((name containers)
(public_name containers)
(wrapped false)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always -nolabels -open CCMonomorphic))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -nolabels -open CCMonomorphic))
(ocamlopt_flags (:standard (:include ../flambda.flags)))
(libraries (bytes result containers.monomorphic))
))

View file

@ -3,8 +3,7 @@
((name containers_data)
(public_name containers.data)
(wrapped false)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string))
(ocamlopt_flags (:standard (:include ../flambda.flags)))
(libraries (bytes result))
))

View file

@ -3,8 +3,7 @@
((name containers_iter)
(public_name containers.iter)
(wrapped false)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string))
(ocamlopt_flags (:standard (:include ../flambda.flags)))
(libraries (bytes result))
))

10
src/jbuild Normal file
View file

@ -0,0 +1,10 @@
(rule
((targets (flambda.flags))
(deps ((file mkflags.ml)))
(fallback)
(action
(run ocaml ./mkflags.ml))
))

13
src/mkflags.ml Normal file
View file

@ -0,0 +1,13 @@
let () =
let major, minor =
Scanf.sscanf Sys.ocaml_version "%u.%u"
(fun major minor -> major, minor)
in
let after_4_3 = (major, minor) >= (4, 3) in
let flags_file = open_out "flambda.flags" in
if after_4_3 then (
output_string flags_file "(-O3 -unbox-closures -unbox-closures-factor 20 -color always)\n";
) else (
output_string flags_file "()\n";
);
close_out flags_file

View file

@ -3,8 +3,7 @@
((name containers_monomorphic)
(public_name containers.monomorphic)
(wrapped false)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string))
(ocamlopt_flags (:standard (:include ../flambda.flags)))
(libraries ())
))

View file

@ -3,9 +3,8 @@
((name containers_sexp)
(public_name containers.sexp)
(wrapped false)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string))
(ocamlopt_flags (:standard (:include ../flambda.flags)))
(libraries (bytes result))
))

View file

@ -4,9 +4,8 @@
(public_name containers.thread)
(wrapped false)
(optional)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string))
(ocamlopt_flags (:standard (:include ../flambda.flags)))
(libraries (containers threads))
))

View file

@ -4,9 +4,8 @@
((name containers_top)
(public_name containers.top)
(wrapped false)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string))
(ocamlopt_flags (:standard (:include ../flambda.flags)))
(libraries (compiler-libs.common containers containers.data
containers.unix containers.sexp containers.iter))
))

View file

@ -1,5 +1,5 @@
B ../../_build/default/src/unix
FLG -w -40 -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always
FLG -w -40 -w +a-4-42-44-48-50-58-32-60@8 -safe-string
PKG bytes
PKG result
PKG unix

View file

@ -4,8 +4,7 @@
(public_name containers.unix)
(wrapped false)
(optional)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string))
(ocamlopt_flags (:standard (:include ../flambda.flags)))
(libraries (bytes result unix))
))