forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathninjaFactory.js
36 lines (32 loc) · 1.24 KB
/
ninjaFactory.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//@ts-check
// -inline 1000 makes size too large
// # TODO: make sure it can be bootstrapped, at least is a very good
// # test case of our optimizations
// # build bsdep.exe: cc bsdep.mli bsdep.ml
// ../native/4.06.1/bin/ocamlopt.opt -c -O2 -nodynlink -I 4.06.1 -g -w a+32 4.06.1/whole_compiler.mli 4.06.1/whole_compiler.ml &> warning.log
var targetDir = require("./bin_path").dirName;
/**
*
* @param {{ocamlopt : string ; INCL : string, isWin : boolean}} config
*
*/
function libNinja(config) {
return `
ocamlopt = ${config.ocamlopt}${config.isWin ? ".exe" : ""}
ext = .exe
INCL = ${config.INCL}
flags = -nodynlink -I $INCL -g -w -a ../jscomp/stubs/ext_basic_hash_stubs.c
rule cc
command = $ocamlopt -O2 $flags $in -o $out ${
config.isWin ? "" : "&& strip $out"
}
description = Making $out
build ../${targetDir}/rescript$ext: cc $INCL/rescript.mli $INCL/rescript.ml
flags = $flags -unboxed-types unix.cmxa str.cmxa
build ../${targetDir}/bsb_helper$ext: cc $INCL/bsb_helper.mli $INCL/bsb_helper.ml
flags = $flags -unboxed-types -w -a
build ../${targetDir}/bsc$ext: cc $INCL/whole_compiler.mli $INCL/whole_compiler.ml
flags = $flags -w A-4-9-48-40-45-41-44-50-21-30-32-34-37-27-60-42
`;
}
exports.libNinja = libNinja;