Made CPU_PORT configurable at compile time for P4_14 programs

Change-Id: I9bd619b8f6af80bead89440265ede64f60f0dfa6
TODO: add commands to build for tofino
diff --git a/tools/test/p4src/p4-14/Makefile b/tools/test/p4src/p4-14/Makefile
index 623b5d3..ca73869 100644
--- a/tools/test/p4src/p4-14/Makefile
+++ b/tools/test/p4src/p4-14/Makefile
@@ -1,22 +1,28 @@
-all: default.json empty.json ecmp.json wcmp.json
+BMV2_CPU_PORT=255
 
-default.json: default.p4
-	p4c-bm2-ss -D DO_BMV2_BUILD --p4v 14 -o p4c-out/default.json \
+BMV2_OPTIONS=-DDO_BMV2_BUILD -DCPU_PORT=$(BMV2_CPU_PORT)
+
+all: bmv2
+
+bmv2: default-bmv2 empty-bmv2 ecmp-bmv2 wcmp-bmv2
+
+default-bmv2: default.p4
+	p4c-bm2-ss $(BMV2_OPTIONS) --p4v 14 -o p4c-out/default.json \
 	--p4runtime-file p4c-out/default.p4info --p4runtime-format text \
 	default.p4
 
-empty.json: empty.p4
+empty-bmv2: empty.p4
 	p4c-bm2-ss --p4v 14 -o p4c-out/empty.json \
 	--p4runtime-file p4c-out/empty.p4info --p4runtime-format text \
 	empty.p4
 
-ecmp.json: ecmp.p4
-	p4c-bm2-ss -D DO_BMV2_BUILD --p4v 14 -o p4c-out/ecmp.json \
+ecmp-bmv2: ecmp.p4
+	p4c-bm2-ss $(BMV2_OPTIONS) --p4v 14 -o p4c-out/ecmp.json \
 	--p4runtime-file p4c-out/ecmp.p4info --p4runtime-format text \
 	ecmp.p4
 
-wcmp.json: wcmp.p4
-	p4c-bm2-ss -D DO_BMV2_BUILD --p4v 14 -o p4c-out/wcmp.json \
+wcmp-bmv2: wcmp.p4
+	p4c-bm2-ss  $(BMV2_OPTIONS) --p4v 14 -o p4c-out/wcmp.json \
 	--p4runtime-file p4c-out/wcmp.p4info --p4runtime-format text \
 	wcmp.p4
 
diff --git a/tools/test/p4src/p4-14/include/defines.p4 b/tools/test/p4src/p4-14/include/defines.p4
index b47a74a..35baa4f 100644
--- a/tools/test/p4src/p4-14/include/defines.p4
+++ b/tools/test/p4src/p4-14/include/defines.p4
@@ -1,6 +1,5 @@
 // Logic ports as defined in the simple_switch target
 #define MAX_PORTS 254
-#define CPU_PORT 255
 #define DROP_PORT 511
 
 #define NULL_ETH_TYPE 0x00