forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathninjaFactory.js
35 lines (31 loc) · 1.09 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
//@ts-check
/**
*
* @param {{ocamlopt : string ; ext : string ; INCL : string, isWin : boolean}} config
*
*/
function libNinja(config){
return `
ocamlopt = ${config.ocamlopt}
ext = ${config.ext}
INCL = ${config.INCL}
flags = -nodynlink -I $INCL -g -w -a ../jscomp/stubs/ext_basic_hash_stubs.c
rule cc
command = $ocamlopt $flags $in -o $out ${config.isWin? '' : '&& strip $out'}
description = Making $out
# -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
build bsppx$ext: cc $INCL/bsppx.mli $INCL/bsppx.ml
# build bspp.exe: cc bspp.mli bspp.ml
build bsb$ext: cc $INCL/bsb.mli $INCL/bsb.ml
flags = $flags unix.cmxa str.cmxa
build bsb_helper$ext: cc $INCL/bsb_helper.mli $INCL/bsb_helper.ml
flags = $flags -w -a
build refmt$ext: cc $INCL/refmt_main3.mli $INCL/refmt_main3.ml
flags = $flags -w -40-30 -no-alias-deps -I +compiler-libs ocamlcommon.cmxa
build bsc$ext: cc $INCL/whole_compiler.mli $INCL/whole_compiler.ml
`
}
exports.libNinja = libNinja