File: gen-compiler_specifics

package info (click to toggle)
ppxlib 0.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 1,284 kB
  • sloc: ml: 17,184; sh: 149; makefile: 36; python: 36
file content (17 lines) | stat: -rw-r--r-- 546 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(* -*- tuareg -*- *)

open Printf

let () =
  let ver = Scanf.sscanf Sys.argv.(1) "%u.%u" (fun a b -> a, b) in
  let oc = open_out_bin Sys.argv.(2) in
  let pr fmt = fprintf oc (fmt ^^ "\n") in
  pr "module O = Ocaml_common";
  if ver < (4, 08) then (
    pr "let get_load_path () = !Ocaml_common.Config.load_path";
    pr "let read_clflags_from_env () = ()"
  ) else (
    pr "let get_load_path () = Ocaml_common.Load_path.get_paths ()";
    pr "let read_clflags_from_env () = Ocaml_common.Compmisc.read_clflags_from_env ()"
  );
  close_out oc