blob: 4bcf40b46257369754bc56494abcfd008af2e7e4 [file] [log] [blame]
Daniele Morof178b0a2020-12-15 14:13:51 +01001#!/usr/bin/env bash
2
3set -e
4
5PROFILE=$1
6OTHER_FLAGS=$2
7
8SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
9
10echo
11echo "## Compiling profile ${PROFILE} in ${SRC_DIR}..."
12
13# Using stable-20210108 because stable doesn't support @p4runtime_translation annotations
14dockerImage=opennetworking/p4c:stable-20210108
15dockerRun="docker run --rm -w ${SRC_DIR} -v ${SRC_DIR}:${SRC_DIR} ${dockerImage}"
16
17
18# Generate BMv2 JSON and P4Info.
19(set -x; ${dockerRun} p4c-bm2-ss --arch v1model \
20 ${OTHER_FLAGS} \
21 --p4runtime-files ${SRC_DIR}/${PROFILE}_p4info.txt ${PROFILE}.p4)