libge2d: separate build output files for libge2d [2/2]

PD#SWPL-150388

Problem:
build output file *.o/*.so/bin is in the same file as the source code
it cause git error

Solution:
change the makefile and bb, set build output file to build/temp/work...

Verify:
local

Signed-off-by: yuhua.lin <yuhua.lin@amlogic.com>
Change-Id: Ie24a1811068876127acd99d09f5b138e1dab3e0f
diff --git a/Makefile b/Makefile
index 0105d2c..30ddd57 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@
 # export CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
 # CC = $(CROSS_COMPILE)gcc
 
+OUT_DIR ?= .
 CFLAGS += -I./libge2d/include/
 CFLAGS += -I./libge2d/kernel-headers/linux/
 LIBDIR:= ./libge2d
@@ -12,9 +13,9 @@
 
 all:
 	$(MAKE) -C $(LIBDIR)
-	$(CC) $(CFLAGS) -L$(LIBDIR) -lpthread -lge2d $(addsuffix .c,$(FEATURE_TEST)) -o $(FEATURE_TEST)
-	$(CC) $(CFLAGS) -L$(LIBDIR) -lpthread -lge2d $(addsuffix .c,$(CHIP_CHECK)) -o $(CHIP_CHECK)
+	$(CC) $(CFLAGS) -L$(LIBDIR) -L$(OUT_DIR) -lpthread -lge2d $(addsuffix .c,$(FEATURE_TEST)) -o $(OUT_DIR)/$(FEATURE_TEST)
+	$(CC) $(CFLAGS) -L$(LIBDIR) -L$(OUT_DIR) -lpthread -lge2d $(addsuffix .c,$(CHIP_CHECK)) -o $(OUT_DIR)/$(CHIP_CHECK)
 
 clean:
 	rm -f $(LIBDIR)/libge2d.so
-	rm -f $(FEATURE_TEST) $(CHIP_CHECK)
+	rm -f $(OUT_DIR)/$(FEATURE_TEST) $(OUT_DIR)/$(CHIP_CHECK)
diff --git a/libge2d/Makefile b/libge2d/Makefile
index 15957e2..f008638 100644
--- a/libge2d/Makefile
+++ b/libge2d/Makefile
@@ -2,6 +2,7 @@
 # export CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
 # CC = $(CROSS_COMPILE)gcc
 
+OUT_DIR ?= .
 CFLAGS += -I./include/
 SRC  := $(wildcard *.c)
 OBJS := $(SRC:%.c=%.o)
@@ -15,8 +16,8 @@
 	$(CC) -c -fPIC -o $@ $< $(CFLAGS)
 
 $(LIB): $(OBJS)
-	$(CC) $(CFLAGS) -shared -fPIC -lion -o $(LIB) $(OBJS)
+	$(CC) $(CFLAGS) -shared -fPIC -lion -o $(OUT_DIR)/$(LIB) $(OBJS)
 	@rm -f $(OBJS)
 
 clean:
-	rm -f $(LIB)
+	rm -f $(OUT_DIR)/$(LIB)