Fix makefile

Change-Id: I8371cee8f68788329d193bb9e0da052033291c48
diff --git a/mbtk/Make.defines b/mbtk/Make.defines
index fd8ec51..03ca961 100755
--- a/mbtk/Make.defines
+++ b/mbtk/Make.defines
@@ -3,9 +3,9 @@
 # Definitions required in all program directories to compile and link

 # C programs using gcc.

 

-
+

+ROOT = $(BUILD_ROOT)/..

 OUT_DIR = $(ROOT)/out

-BUILD_ROOT = $(ROOT)/mbtk

 LOCAL_PATH=.

 

 ifeq ($(BUILD_PLATFORM), asr1803)

diff --git a/mbtk/Makefile b/mbtk/Makefile
index 44e3043..95ab04c 100755
--- a/mbtk/Makefile
+++ b/mbtk/Makefile
@@ -1,4 +1,4 @@
-ROOT = $(shell pwd)/..
+BUILD_ROOT = $(shell pwd)
 include Make.defines
 
 # Build so file.
diff --git a/mbtk/device_info_generate/Makefile b/mbtk/device_info_generate/Makefile
index e7b18be..e6d4a03 100755
--- a/mbtk/device_info_generate/Makefile
+++ b/mbtk/device_info_generate/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/device_info_generate
 
diff --git a/mbtk/liblynq_lib/Makefile b/mbtk/liblynq_lib/Makefile
index 053fa11..6a5a50a 100755
--- a/mbtk/liblynq_lib/Makefile
+++ b/mbtk/liblynq_lib/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/lynq_lib
 
diff --git a/mbtk/libmbtk_audio/Makefile b/mbtk/libmbtk_audio/Makefile
index b3ede3a..5a5da35 100755
--- a/mbtk/libmbtk_audio/Makefile
+++ b/mbtk/libmbtk_audio/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_audio
 
diff --git a/mbtk/libmbtk_coap/Makefile b/mbtk/libmbtk_coap/Makefile
index 1595ec0..2b0a53b 100755
--- a/mbtk/libmbtk_coap/Makefile
+++ b/mbtk/libmbtk_coap/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_coap
 
diff --git a/mbtk/libmbtk_ecall/Makefile b/mbtk/libmbtk_ecall/Makefile
index 71eeae3..59b1aeb 100755
--- a/mbtk/libmbtk_ecall/Makefile
+++ b/mbtk/libmbtk_ecall/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_ftp
 
diff --git a/mbtk/libmbtk_factory/Makefile b/mbtk/libmbtk_factory/Makefile
index c40b45a..b588670 100755
--- a/mbtk/libmbtk_factory/Makefile
+++ b/mbtk/libmbtk_factory/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_factory
 
diff --git a/mbtk/libmbtk_fota/Makefile b/mbtk/libmbtk_fota/Makefile
index e1c1b09..111186e 100755
--- a/mbtk/libmbtk_fota/Makefile
+++ b/mbtk/libmbtk_fota/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_fota
 
diff --git a/mbtk/libmbtk_ftp/Makefile b/mbtk/libmbtk_ftp/Makefile
index 71eeae3..59b1aeb 100755
--- a/mbtk/libmbtk_ftp/Makefile
+++ b/mbtk/libmbtk_ftp/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_ftp
 
diff --git a/mbtk/libmbtk_gnss/Makefile b/mbtk/libmbtk_gnss/Makefile
index cfb87d4..df4dd33 100755
--- a/mbtk/libmbtk_gnss/Makefile
+++ b/mbtk/libmbtk_gnss/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_gnss
 
diff --git a/mbtk/libmbtk_http/Makefile b/mbtk/libmbtk_http/Makefile
index 417ffe6..5307d5c 100755
--- a/mbtk/libmbtk_http/Makefile
+++ b/mbtk/libmbtk_http/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_http
 
diff --git a/mbtk/libmbtk_lib/Makefile b/mbtk/libmbtk_lib/Makefile
index fe71e7e..bb1bc91 100755
--- a/mbtk/libmbtk_lib/Makefile
+++ b/mbtk/libmbtk_lib/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_lib
 
diff --git a/mbtk/libmbtk_mqtt/Makefile b/mbtk/libmbtk_mqtt/Makefile
index f33a5b6..7cf0ddb 100755
--- a/mbtk/libmbtk_mqtt/Makefile
+++ b/mbtk/libmbtk_mqtt/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_mqtt
 
diff --git a/mbtk/libmbtk_net/Makefile b/mbtk/libmbtk_net/Makefile
index 09f62e5..00212a5 100755
--- a/mbtk/libmbtk_net/Makefile
+++ b/mbtk/libmbtk_net/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_net
 
diff --git a/mbtk/libmbtk_ril/Makefile b/mbtk/libmbtk_ril/Makefile
index 26203d4..d9cb233 100755
--- a/mbtk/libmbtk_ril/Makefile
+++ b/mbtk/libmbtk_ril/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_ril
 
diff --git a/mbtk/libmbtk_tcpip/Makefile b/mbtk/libmbtk_tcpip/Makefile
index 3396400..02b5e71 100755
--- a/mbtk/libmbtk_tcpip/Makefile
+++ b/mbtk/libmbtk_tcpip/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libmbtk_tcpip
 
diff --git a/mbtk/libql_lib/Makefile b/mbtk/libql_lib/Makefile
index cb50bb7..5a34460 100755
--- a/mbtk/libql_lib/Makefile
+++ b/mbtk/libql_lib/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/libql_lib
 
diff --git a/mbtk/mbtk_adbd/Makefile b/mbtk/mbtk_adbd/Makefile
index 8af5c6c..279b404 100755
--- a/mbtk/mbtk_adbd/Makefile
+++ b/mbtk/mbtk_adbd/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/mbtk_adbd
 
diff --git a/mbtk/mbtk_logd/Makefile b/mbtk/mbtk_logd/Makefile
index 562a644..779766b 100755
--- a/mbtk/mbtk_logd/Makefile
+++ b/mbtk/mbtk_logd/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/mbtk_logd
 
diff --git a/mbtk/mbtk_rild/Makefile b/mbtk/mbtk_rild/Makefile
index 453bb19..56e6534 100755
--- a/mbtk/mbtk_rild/Makefile
+++ b/mbtk/mbtk_rild/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 LOCAL_PATH=$(BUILD_ROOT)/mbtk_rild
 
diff --git a/mbtk/mbtk_utils/Makefile b/mbtk/mbtk_utils/Makefile
index 743f28f..d58f815 100755
--- a/mbtk/mbtk_utils/Makefile
+++ b/mbtk/mbtk_utils/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/Makefile b/mbtk/test/Makefile
index 28cd0b4..d894df5 100755
--- a/mbtk/test/Makefile
+++ b/mbtk/test/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
 
 #exclude_dirs := include bin
 #test_dirs := $(shell find . -maxdepth 1 -type d)
diff --git a/mbtk/test/liblynq_lib/Makefile b/mbtk/test/liblynq_lib/Makefile
index 55e0360..d8eea05 100755
--- a/mbtk/test/liblynq_lib/Makefile
+++ b/mbtk/test/liblynq_lib/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_audio/Makefile b/mbtk/test/libmbtk_audio/Makefile
index 1045e71..241948d 100755
--- a/mbtk/test/libmbtk_audio/Makefile
+++ b/mbtk/test/libmbtk_audio/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_coap/Makefile b/mbtk/test/libmbtk_coap/Makefile
index 28bf46c..8d29a6a 100755
--- a/mbtk/test/libmbtk_coap/Makefile
+++ b/mbtk/test/libmbtk_coap/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_ecall/Makefile b/mbtk/test/libmbtk_ecall/Makefile
index 28bf46c..8d29a6a 100755
--- a/mbtk/test/libmbtk_ecall/Makefile
+++ b/mbtk/test/libmbtk_ecall/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_factory/Makefile b/mbtk/test/libmbtk_factory/Makefile
index d93d8c5..80766f8 100755
--- a/mbtk/test/libmbtk_factory/Makefile
+++ b/mbtk/test/libmbtk_factory/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_fota/Makefile b/mbtk/test/libmbtk_fota/Makefile
index 33a7f43..e972d28 100755
--- a/mbtk/test/libmbtk_fota/Makefile
+++ b/mbtk/test/libmbtk_fota/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_ftp/Makefile b/mbtk/test/libmbtk_ftp/Makefile
index d520ad9..b815c36 100755
--- a/mbtk/test/libmbtk_ftp/Makefile
+++ b/mbtk/test/libmbtk_ftp/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_gnss/Makefile b/mbtk/test/libmbtk_gnss/Makefile
index d520ad9..b815c36 100755
--- a/mbtk/test/libmbtk_gnss/Makefile
+++ b/mbtk/test/libmbtk_gnss/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_http/Makefile b/mbtk/test/libmbtk_http/Makefile
index ad42a13..e33b144 100755
--- a/mbtk/test/libmbtk_http/Makefile
+++ b/mbtk/test/libmbtk_http/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_lib/Makefile b/mbtk/test/libmbtk_lib/Makefile
index 844f199..99172c3 100755
--- a/mbtk/test/libmbtk_lib/Makefile
+++ b/mbtk/test/libmbtk_lib/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_mqtt/Makefile b/mbtk/test/libmbtk_mqtt/Makefile
index 4802389..f60163a 100755
--- a/mbtk/test/libmbtk_mqtt/Makefile
+++ b/mbtk/test/libmbtk_mqtt/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_net/Makefile b/mbtk/test/libmbtk_net/Makefile
index d172606..f113edb 100755
--- a/mbtk/test/libmbtk_net/Makefile
+++ b/mbtk/test/libmbtk_net/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_ril/Makefile b/mbtk/test/libmbtk_ril/Makefile
index 6197845..7acd22f 100755
--- a/mbtk/test/libmbtk_ril/Makefile
+++ b/mbtk/test/libmbtk_ril/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libmbtk_tcpip/Makefile b/mbtk/test/libmbtk_tcpip/Makefile
index 0ee33e7..cc8b84a 100755
--- a/mbtk/test/libmbtk_tcpip/Makefile
+++ b/mbtk/test/libmbtk_tcpip/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/libql_lib/Makefile b/mbtk/test/libql_lib/Makefile
index 3acd13c..736aee1 100755
--- a/mbtk/test/libql_lib/Makefile
+++ b/mbtk/test/libql_lib/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=
 
diff --git a/mbtk/test/others/Makefile b/mbtk/test/others/Makefile
index 7dc5e8b..bac02a3 100755
--- a/mbtk/test/others/Makefile
+++ b/mbtk/test/others/Makefile
@@ -1,5 +1,5 @@
-ROOT = $(shell pwd)/../../..
-include $(ROOT)/mbtk/Make.defines
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
 
 INC_DIR +=