#!/bin/bash

T4P4S_ROOT=/root/t4p4s

export P4PI="${T4P4S_ROOT}/third_party/PI"
export GRPCPP="${T4P4S_ROOT}/third_party/P4Runtime_GRPCPP"
export GRPC="${T4P4S_ROOT}/third_party/grpc"

P4_PROG=l2switch
T4P4S_PROG_FILE=/root/t4p4s-switch
if [ -f "${T4P4S_PROG_FILE}" ]; then
    P4_PROG=$(cat "${T4P4S_PROG_FILE}")
else
    echo "${P4_PROG}" > "${T4P4S_PROG_FILE}"
fi

PYTHON3="${T4P4S_ROOT}/.venv/bin/python" T4P4S_CC=gcc /root/t4p4s/t4p4s.sh :"${P4_PROG}" p4rt
