Revision 203c0d4c48715e17f32365a29bfea45900c273f1 authored by Matthieu Sozeau on 24 September 2019, 19:00:17 UTC, committed by Matthieu Sozeau on 24 September 2019, 19:00:42 UTC
1 parent f800036
Raw File
configure.sh
#!/usr/bin/env bash

# Removes all generated makefiles
make -f Makefile mrproper

# Dependencies for local or global builds.
# When building the packages separately, dependencies are not set as everything
# should already be available in $(COQMF_LIB)/user-contrib/MetaCoq/*
# checker is treated specially: due to code generation, we rebuild the template-coq module locally
# when building the checker package
# For local builds, we set specific dependencies of each subproject in */metacoq-config

# CWD=`pwd`

if command -v coqc >/dev/null 2>&1
then
    COQLIB=`coqc -where`

    if [ "$1" == "local" ]
    then
        echo "Building MetaCoq locally"
        CHECKER_DEPS="-R ../template-coq/theories MetaCoq.Template -I ../template-coq/build"
        PCUIC_MLDEPS="-I ../checker/src"
        PCUIC_VDEPS="-R ../checker/theories MetaCoq.Checker"
        SAFECHECKER_DEPS="${PCUIC_VDEPS} -R ../pcuic/theories MetaCoq.PCUIC"
        ERASURE_DEPS="-R ../safechecker/theories MetaCoq.SafeChecker"
    else
        echo "Building MetaCoq globally (default)"
        # To find the metacoq template plugin
        CHECKER_DEPS="-I ${COQLIB}/user-contrib/MetaCoq/Template"
        # The pcuic plugin depends on the checker plugin
        # The safechecker and erasure plugins are self-contained
        # These dependencies should not be necessary when separate linking of ocaml object
        # files is supported by coq_makefile
        PCUIC_MLDEPS="-I ${COQLIB}/user-contrib/MetaCoq/Checker"
        PCUIC_VDEPS=""
        SAFECHECKER_DEPS=""
        ERASURE_DEPS=""
    fi

    echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > checker/metacoq-config
    echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > pcuic/metacoq-config
    echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > safechecker/metacoq-config
    echo "# DO NOT EDIT THIS FILE: autogenerated from ./configure.sh" > erasure/metacoq-config

    echo ${CHECKER_DEPS} >> checker/metacoq-config
    # echo "OCAMLPATH = \"${CWD}/template-coq\"" >> checker/metacoq-config
    echo ${CHECKER_DEPS} ${PCUIC_MLDEPS} ${PCUIC_VDEPS} >> pcuic/metacoq-config
    echo ${CHECKER_DEPS} ${SAFECHECKER_DEPS} >> safechecker/metacoq-config
    echo ${CHECKER_DEPS} ${SAFECHECKER_DEPS} ${ERASURE_DEPS} >> erasure/metacoq-config
else
    echo "Error: coqc not found in path"
fi
back to top