blob: a6f2296c3def2d47fcd1b12f0882802c25bb4459 [file] [log] [blame]
Carmelo Cascone54fb90e2017-08-31 21:07:25 +02001BMV2_CPU_PORT=255
Carmelo Cascone5db39682017-09-07 16:36:42 +02002MAVERICKS_CPU_PORT=320
3MONTARA_CPU_PORT=192
Carmelo Casconeb7524272017-06-05 16:53:13 -04004
Carmelo Casconef1d0a422017-09-07 17:21:46 +02005ECMP_GROUP_SIZE=2
6
7MAVERICKS_OPTIONS=-DCPU_PORT=$(MAVERICKS_CPU_PORT) -DECMP_GROUP_SIZE=$(ECMP_GROUP_SIZE)
8MONTARA_OPTIONS=-DCPU_PORT=$(MONTARA_CPU_PORT) -DECMP_GROUP_SIZE=$(ECMP_GROUP_SIZE)
9BMV2_OPTIONS=-DDO_BMV2_BUILD -DCPU_PORT=$(BMV2_CPU_PORT) -DECMP_GROUP_SIZE=$(ECMP_GROUP_SIZE)
Carmelo Cascone54fb90e2017-08-31 21:07:25 +020010
11all: bmv2
12
13bmv2: default-bmv2 empty-bmv2 ecmp-bmv2 wcmp-bmv2
14
Carmelo Casconef2ac7202017-09-08 00:57:44 +020015tofino: default-tofino ecmp-tofino
16
Carmelo Cascone54fb90e2017-08-31 21:07:25 +020017default-bmv2: default.p4
18 p4c-bm2-ss $(BMV2_OPTIONS) --p4v 14 -o p4c-out/default.json \
Carmelo Casconeb7524272017-06-05 16:53:13 -040019 --p4runtime-file p4c-out/default.p4info --p4runtime-format text \
20 default.p4
21
Carmelo Cascone5db39682017-09-07 16:36:42 +020022default-tofino: default.p4
23 p4c-tofino --verbose 2 --new_ctx_json -o p4c-out/tofino/default/mavericks $(MAVERICKS_OPTIONS) default.p4
Carmelo Cascone6230a612017-09-13 03:25:41 +020024 sed -i -e 's/hash_action/match_with_no_key/g' p4c-out/tofino/default/mavericks/context/context.json
Carmelo Cascone5db39682017-09-07 16:36:42 +020025 p4c-tofino --verbose 2 --new_ctx_json -o p4c-out/tofino/default/montara $(MONTARA_OPTIONS) default.p4
Carmelo Cascone6230a612017-09-13 03:25:41 +020026 sed -i -e 's/hash_action/match_with_no_key/g' p4c-out/tofino/default/montara/context/context.json
Carmelo Cascone5db39682017-09-07 16:36:42 +020027 cp p4c-out/default.json p4c-out/tofino/default/mavericks
28 cp p4c-out/default.json p4c-out/tofino/default/montara
29 cp p4c-out/default.p4info p4c-out/tofino/default/mavericks
Carmelo Casconef1d0a422017-09-07 17:21:46 +020030 cp p4c-out/default.p4info p4c-out/tofino/default/montara
Carmelo Cascone5db39682017-09-07 16:36:42 +020031 sed -i -e 's/standard_metadata/ig_intr_md/g' p4c-out/tofino/default/mavericks/default.json
32 sed -i -e 's/standard_metadata/ig_intr_md/g' p4c-out/tofino/default/montara/default.json
33 sed -i -e 's/standard_metadata/ig_intr_md/g' p4c-out/tofino/default/mavericks/default.p4info
Carmelo Casconef1d0a422017-09-07 17:21:46 +020034 sed -i -e 's/standard_metadata/ig_intr_md/g' p4c-out/tofino/default/montara/default.p4info
Carmelo Cascone5db39682017-09-07 16:36:42 +020035
Carmelo Cascone54fb90e2017-08-31 21:07:25 +020036empty-bmv2: empty.p4
Carmelo Casconeb7524272017-06-05 16:53:13 -040037 p4c-bm2-ss --p4v 14 -o p4c-out/empty.json \
38 --p4runtime-file p4c-out/empty.p4info --p4runtime-format text \
39 empty.p4
40
Carmelo Cascone54fb90e2017-08-31 21:07:25 +020041ecmp-bmv2: ecmp.p4
42 p4c-bm2-ss $(BMV2_OPTIONS) --p4v 14 -o p4c-out/ecmp.json \
Carmelo Casconefc3776d2017-08-21 23:17:22 +020043 --p4runtime-file p4c-out/ecmp.p4info --p4runtime-format text \
Carmelo Casconeb7524272017-06-05 16:53:13 -040044 ecmp.p4
45
Carmelo Casconef1d0a422017-09-07 17:21:46 +020046ecmp-tofino: ecmp.p4
47 p4c-tofino --verbose 2 --new_ctx_json -o p4c-out/tofino/ecmp/mavericks $(MAVERICKS_OPTIONS) ecmp.p4
Carmelo Cascone6230a612017-09-13 03:25:41 +020048 sed -i -e 's/hash_action/match_with_no_key/g' p4c-out/tofino/ecmp/mavericks/context/context.json
Carmelo Casconef1d0a422017-09-07 17:21:46 +020049 p4c-tofino --verbose 2 --new_ctx_json -o p4c-out/tofino/ecmp/montara $(MONTARA_OPTIONS) ecmp.p4
Carmelo Cascone6230a612017-09-13 03:25:41 +020050 sed -i -e 's/hash_action/match_with_no_key/g' p4c-out/tofino/ecmp/montara/context/context.json
Carmelo Casconef1d0a422017-09-07 17:21:46 +020051 cp p4c-out/ecmp.json p4c-out/tofino/ecmp/mavericks
52 cp p4c-out/ecmp.json p4c-out/tofino/ecmp/montara
53 cp p4c-out/ecmp.p4info p4c-out/tofino/ecmp/mavericks
54 cp p4c-out/ecmp.p4info p4c-out/tofino/ecmp/montara
55 sed -i -e 's/standard_metadata/ig_intr_md/g' p4c-out/tofino/ecmp/mavericks/ecmp.json
56 sed -i -e 's/standard_metadata/ig_intr_md/g' p4c-out/tofino/ecmp/montara/ecmp.json
57 sed -i -e 's/standard_metadata/ig_intr_md/g' p4c-out/tofino/ecmp/mavericks/ecmp.p4info
58 sed -i -e 's/standard_metadata/ig_intr_md/g' p4c-out/tofino/ecmp/montara/ecmp.p4info
59
Carmelo Cascone54fb90e2017-08-31 21:07:25 +020060wcmp-bmv2: wcmp.p4
61 p4c-bm2-ss $(BMV2_OPTIONS) --p4v 14 -o p4c-out/wcmp.json \
Carmelo Cascone16de6db2017-08-22 00:27:57 +020062 --p4runtime-file p4c-out/wcmp.p4info --p4runtime-format text \
Carmelo Casconeb7524272017-06-05 16:53:13 -040063 wcmp.p4
64
65clean:
66 rm -rf p4c-out/*.json
Carmelo Cascone5db39682017-09-07 16:36:42 +020067 rm -rf p4c-out/*.p4info