From e699d636c315441e5dcd52e0e848ee8ef720c9d8 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sun, 14 Jan 2018 20:44:10 -0600 Subject: [PATCH] script to generate ocaml flags --- qtest/Makefile | 2 +- qtest/jbuild | 2 +- src/bigarray/jbuild | 5 ++--- src/jbuild | 13 ++++++++++--- src/mkflags.ml | 14 ++++++++++++++ 5 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 src/mkflags.ml diff --git a/qtest/Makefile b/qtest/Makefile index 09e30e4..c8a9751 100644 --- a/qtest/Makefile +++ b/qtest/Makefile @@ -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) \ diff --git a/qtest/jbuild b/qtest/jbuild index 3b74acb..0843466 100644 --- a/qtest/jbuild +++ b/qtest/jbuild @@ -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 diff --git a/src/bigarray/jbuild b/src/bigarray/jbuild index e59b07f..f44100a 100644 --- a/src/bigarray/jbuild +++ b/src/bigarray/jbuild @@ -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))) )) diff --git a/src/jbuild b/src/jbuild index 981b07e..c20d7d9 100644 --- a/src/jbuild +++ b/src/jbuild @@ -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)) )) diff --git a/src/mkflags.ml b/src/mkflags.ml new file mode 100644 index 0000000..e6edba0 --- /dev/null +++ b/src/mkflags.ml @@ -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