script to generate ocaml flags

This commit is contained in:
Simon Cruanes 2018-01-14 20:44:10 -06:00
parent 020b583940
commit e699d636c3
5 changed files with 28 additions and 8 deletions

View file

@ -1,6 +1,6 @@
QTEST_PREAMBLE=''
DONTTEST=../src/sequenceLabels.ml
DONTTEST=../src/sequenceLabels.ml ../src/mkflags.ml
QTESTABLE=$(filter-out $(DONTTEST), \
$(wildcard ../src/*.ml) \
$(wildcard ../src/*.mli) \

View file

@ -1,7 +1,7 @@
(rule
((targets (run_qtest.ml))
(deps ((file Makefile)))
(deps ((file Makefile) )) ; (glob_files ../src/**/*.ml{,i})))
(fallback)
;(libraries (qtest qcheck))
(action

View file

@ -5,7 +5,6 @@
(libraries (sequence bigarray))
(wrapped false)
(optional)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -w -33 -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)))
))

View file

@ -1,11 +1,18 @@
(rule
((targets (flambda.flags))
(deps ((file mkflags.ml)))
(fallback)
(action
(run ocaml ./mkflags.ml))
))
(library
((name sequence)
(public_name sequence)
(wrapped false)
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -color always -nolabels))
(ocamlopt_flags (:standard -O3 -color always
-unbox-closures -unbox-closures-factor 20))
(modules (Sequence SequenceLabels))
(flags (:standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -nolabels))
(ocamlopt_flags (:standard (:include flambda.flags)))
(libraries (bytes result))
))

14
src/mkflags.ml Normal file
View file

@ -0,0 +1,14 @@
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