modularize and allow overrides for xos and service branches and url's

Change-Id: I3608eda655fa3af613f4344809e2c133353e0777
diff --git a/common/Makedefs b/common/Makedefs
index 7111b42..d5bbfcb 100644
--- a/common/Makedefs
+++ b/common/Makedefs
@@ -1,2 +1,38 @@
-SERVICE_DIR=../../xos_services
-XOS_DIR=../../xos
+# service-profile/common/Makedefs
+
+SERVICE_DIR ?= ../../xos_services
+XOS_DIR ?= ../../xos
+
+CORD_BASE_GIT_URL ?= https://gerrit.opencord.org/p
+
+DEFAULT_BRANCH ?= master
+
+XOS_BRANCH ?= $(DEFAULT_BRANCH)
+XOS_GIT_URL ?= $(CORD_BASE_GIT_URL)/xos.git
+
+EXAMPLESERVICE_BRANCH ?= $(DEFAULT_BRANCH)
+EXAMPLESERVICE_GIT_URL ?= $(CORD_BASE_GIT_URL)/exampleservice.git
+
+OLT_BRANCH ?= $(DEFAULT_BRANCH)
+OLT_GIT_URL ?= $(CORD_BASE_GIT_URL)/olt.git
+
+VSG_BRANCH ?= $(DEFAULT_BRANCH)
+VSG_GIT_URL ?= $(CORD_BASE_GIT_URL)/vsg.git
+
+VTN_BRANCH ?= $(DEFAULT_BRANCH)
+VTN_GIT_URL ?= $(CORD_BASE_GIT_URL)/vtn.git
+
+VROUTER_BRANCH ?= $(DEFAULT_BRANCH)
+VROUTER_GIT_URL ?= $(CORD_BASE_GIT_URL)/vrouter.git
+
+VTR_BRANCH ?= $(DEFAULT_BRANCH)
+VTR_GIT_URL ?= $(CORD_BASE_GIT_URL)/vtr.git
+
+ONOS_BRANCH ?= $(DEFAULT_BRANCH)
+ONOS_GIT_URL ?= $(CORD_BASE_GIT_URL)/onos-service.git
+
+FABRIC_BRANCH ?= $(DEFAULT_BRANCH)
+FABRIC_GIT_URL ?= $(CORD_BASE_GIT_URL)/fabric.git
+
+MONITORING_BRANCH ?= $(DEFAULT_BRANCH)
+MONITORING_GIT_URL ?= $(CORD_BASE_GIT_URL)/monitoring.git
diff --git a/common/Makedefs.branches b/common/Makedefs.branches
deleted file mode 100644
index 3522ac4..0000000
--- a/common/Makedefs.branches
+++ /dev/null
@@ -1,12 +0,0 @@
-BRANCH=master
-
-XOS_BRANCH=$(BRANCH)
-EXAMPLESERVICE_BRANCH=$(BRANCH)
-OLT_BRANCH=$(BRANCH)
-VSG_BRANCH=$(BRANCH)
-VTN_BRANCH=$(BRANCH)
-VROUTER_BRANCH=$(BRANCH)
-VTR_BRANCH=$(BRANCH)
-ONOS_BRANCH=$(BRANCH)
-FABRIC_BRANCH=$(BRANCH)
-MONITORING_BRANCH=$(BRANCH)
diff --git a/common/Makefile.services b/common/Makefile.services
index b7d92d5..262784b 100644
--- a/common/Makefile.services
+++ b/common/Makefile.services
@@ -1,51 +1,56 @@
 include ../common/Makedefs
-include ../common/Makedefs.branches
 
 GITOPTS=-c advice.detachedHead=false
 
 services: $(SERVICE_DIR) \
           $(SERVICE_DIR)/exampleservice \
           $(SERVICE_DIR)/olt \
-	  $(SERVICE_DIR)/vsg \
+	        $(SERVICE_DIR)/vsg \
           $(SERVICE_DIR)/vtn \
-	  $(SERVICE_DIR)/vrouter \
-	  $(SERVICE_DIR)/vtr \
-	  $(SERVICE_DIR)/onos-service \
-	  $(SERVICE_DIR)/fabric
+	        $(SERVICE_DIR)/vrouter \
+	        $(SERVICE_DIR)/vtr \
+	        $(SERVICE_DIR)/onos-service \
+	        $(SERVICE_DIR)/fabric
 
 monitoring_services: $(SERVICE_DIR)/monitoring
 
 xos_core: $(XOS_DIR)
 
+$(XOS_DIR):
+	git -C ../.. $(GITOPTS) clone -b $(XOS_BRANCH) $(XOS_GIT_URL)
+
+update_xos:
+	git -C $(XOS_DIR) pull
+
 $(SERVICE_DIR):
 	mkdir -p $(SERVICE_DIR)
 
 $(SERVICE_DIR)/exampleservice:
-	git -C $(SERVICE_DIR) $(GITOPTS) clone  -b $(EXAMPLESERVICE_BRANCH) https://gerrit.opencord.org/p/exampleservice.git
+	git -C $(SERVICE_DIR) $(GITOPTS) clone  -b $(EXAMPLESERVICE_BRANCH) $(EXAMPLESERVICE_GIT_URL)
 
 $(SERVICE_DIR)/olt:
-	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(OLT_BRANCH) https://gerrit.opencord.org/p/olt.git
+	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(OLT_BRANCH) $(OLT_GIT_URL)
 
 $(SERVICE_DIR)/vsg:
-	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(VSG_BRANCH) https://gerrit.opencord.org/p/vsg.git
+	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(VSG_BRANCH) $(VSG_GIT_URL)
 
 $(SERVICE_DIR)/vtn:
-	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(VTN_BRANCH) https://gerrit.opencord.org/p/vtn.git
+	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(VTN_BRANCH) $(VTN_GIT_URL)
 
 $(SERVICE_DIR)/vrouter:
-	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(VROUTER_BRANCH) https://gerrit.opencord.org/p/vrouter.git
+	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(VROUTER_BRANCH) $(VROUTER_GIT_URL)
 
 $(SERVICE_DIR)/vtr:
-	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(VTR_BRANCH) https://gerrit.opencord.org/p/vtr.git
+	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(VTR_BRANCH) $(VTR_GIT_URL)
 
 $(SERVICE_DIR)/onos-service:
-	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(ONOS_BRANCH) https://gerrit.opencord.org/p/onos-service.git
+	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(ONOS_BRANCH) $(ONOS_GIT_URL)
 
 $(SERVICE_DIR)/fabric:
-	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(FABRIC_BRANCH) https://gerrit.opencord.org/p/fabric.git
+	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(FABRIC_BRANCH) $(FABRIC_GIT_URL)
 
 $(SERVICE_DIR)/monitoring:
-	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(MONITORING_BRANCH) https://gerrit.opencord.org/p/monitoring.git
+	git -C $(SERVICE_DIR) $(GITOPTS) clone -b $(MONITORING_BRANCH) $(MONITORING_GIT_URL)
 
 cleanup:
 	rm -rf $(SERVICE_DIR)/*
@@ -60,8 +65,3 @@
 	git -C $(SERVICE_DIR)/onos-service pull
 	git -C $(SERVICE_DIR)/fabric pull
 
-$(XOS_DIR):
-	git -C ../.. $(GITOPTS) clone -b $(XOS_BRANCH) https://gerrit.opencord.org/p/xos.git
-
-update_xos:
-	git -C $(XOS_DIR) pull