Base all image paths on the project ROOT_DIR

Calculate the ROOT_DIR of the project by looking for the Makefile.common
in the whole list of Makefiles included and get its absolute path name.

Then reuse this variables, instead of relative paths, for assuring that all
images are calculating their positions and SHA1s in a consistent way.

Change-Id: I527fc5d42bd7d27f90c8b7eca70793e687d2048e
diff --git a/Makefile.common b/Makefile.common
index 4f31260..37ae390 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -1,4 +1,5 @@
-include $(dir $(realpath $(lastword $(MAKEFILE_LIST))))common.env
+ROOT_DIR=$(dir $(realpath $(filter %Makefile.common,$(MAKEFILE_LIST))))
+include $(ROOT_DIR)common.env
 
 
 cluster-keys:
diff --git a/common.env b/common.env
index a780818..6567028 100644
--- a/common.env
+++ b/common.env
@@ -13,9 +13,9 @@
 LAST_BUILD=lastSuccessfulBuild/artifact/bazel-bin/plugins
 
 # Image directories
-IMAGE_DIR:=$(shell pwd)/../gerrit
-HAPROXY_IMAGE_DIR=$(shell pwd)/haproxy
-SYSLOG_IMAGE_DIR=$(shell pwd)/syslog-sidecar
+IMAGE_DIR:=$(ROOT_DIR)/gerrit
+HAPROXY_IMAGE_DIR=$(ROOT_DIR)/dual-master/haproxy
+SYSLOG_IMAGE_DIR=$(ROOT_DIR)/dual-master/syslog-sidecar
 
 # Image SHA1 versions
 HEAD_SHA1=$(shell find $(IMAGE_DIR) -type f -exec cat {} \; | shasum | cut -c 1-20)