Skip to content
Snippets Groups Projects
configure 1.43 KiB
Newer Older
LEX_HAND="true"
ALPAGA_PARSER="true"

while [[ $# -gt 0 ]]
do
    key="$1"

    case $key in
        -l|--lex-hand)
            LEX_HAND="true"
            shift
            ;;
        -L|--lex-ocamllex)
            LEX_HAND="false"
            shift
            ;;
        -a|--alpaga-parser)
            ALPAGA_PARSER="true"
            shift
            ;;
        -m|--menhir-parser)
            ALPAGA_PARSER="false"
            shift
            ;;
        *)    # unknown option
            shift # past argument
            ;;
    esac
done

RUNTIME=$(pwd)/runtime

Wilke Pierre's avatar
Wilke Pierre committed
RVAS=$(which -a riscv64-unknown-linux-gnu-as riscv64-unknown-elf-as riscv64-linux-gnu-as 2>/dev/null | grep -v "not found" | head -n1)
RVLD=$(which -a riscv64-unknown-linux-gnu-ld riscv64-unknown-elf-ld riscv64-linux-gnu-ld 2>/dev/null | grep -v "not found" | head -n1)
QEMU32=$(which -a qemu-riscv32 qemu-riscv32-static 2>/dev/null | grep -v "not found" | head -n1)
QEMU64=$(which -a qemu-riscv64 qemu-riscv64-static 2>/dev/null | grep -v "not found" | head -n1)
echo "let runtime_dir = \"${RUNTIME}\"" > src/config.ml
Wilke Pierre's avatar
Wilke Pierre committed
echo "let qemu32 = \"${QEMU32}\"" >> src/config.ml
echo "let qemu64 = \"${QEMU64}\"" >> src/config.ml
echo "let rv_as = \"${RVAS}\"" >> src/config.ml
echo "let rv_ld = \"${RVLD}\"" >> src/config.ml
echo "let os_target = \"linux\"" >> src/config.ml
echo "let lex_hand = $LEX_HAND" >> src/config.ml
echo "let alpaga_parser = $ALPAGA_PARSER" >> src/config.ml