Created
September 1, 2017 09:36
-
-
Save takahisa/371462b8c529c014bdcb36287c42f4e4 to your computer and use it in GitHub Desktop.
ocaml-dumpobj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
OCAML_DIRECTORY=${HOME}/.opt/ocaml/ocaml-4.04.2/ | |
OCAML_BYTERUN=${OCAML_DIRECTORY}/byterun/ocamlrun | |
OCAML_DUMPOBJ=${OCAML_DIRECTORY}/tools/dumpobj | |
if [ $# != 2 ]; then | |
echo "usage: $0 <input> <output>" 1>&2 | |
exit 0 | |
fi | |
SOURCE_FILE="$1" | |
OBJECT_FILE="$(basename $1 ".ml")" | |
RESULT_FILE="$2" | |
ocamlc ${SOURCE_FILE} -o "${OBJECT_FILE}.out" | |
${OCAML_BYTERUN} ${OCAML_DUMPOBJ} "${OBJECT_FILE}.out" &> ${RESULT_FILE} | |
rm ${OBJECT_FILE}{.cmi,.cmo,.out} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment