Skip to content

Instantly share code, notes, and snippets.

@pdonadeo
Last active May 20, 2018 21:42
Show Gist options
  • Save pdonadeo/4674587919e875165721afb1d19a96e9 to your computer and use it in GitHub Desktop.
Save pdonadeo/4674587919e875165721afb1d19a96e9 to your computer and use it in GitHub Desktop.
Bash script
#!/bin/bash
STD_LIB=`ocamlc -config | grep 'standard_library:' | gawk '{print $2}'`
LIBS=`dirname ${STD_LIB}`
INCLUDE_DIRS="-I ${LIBS}/result -I ${LIBS}/ppx_deriving -I ${LIBS}/lens"
PPX="${LIBS}/ppx_deriving/ppx_deriving ${LIBS}/lens/lens_ppx_deriving.cma"
ocamlc -c -g -annot -bin-annot -o hello_lens.cmi \
${INCLUDE_DIRS} \
-ppx "${PPX}" \
hello_lens.mli
ocamlopt -c -g -annot -bin-annot -o hello_lens.cmx \
${INCLUDE_DIRS} \
-ppx "${PPX}" \
hello_lens.ml
ocamlopt -g -o hello_lens.native \
${INCLUDE_DIRS} \
-ppx "${PPX}" \
${LIBS}/result/result.cmxa \
${LIBS}/ppx_deriving/ppx_deriving_runtime.cmxa \
${LIBS}/lens/lens.cmxa \
hello_lens.cmx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment