libhardware: add separate makefile for modules subdir

Change-Id: I787c444ee1c3a687ee6f8f551c359e5e908ed7f5
Signed-off-by: Dima Zavin <dima@android.com>
diff --git a/Android.mk b/Android.mk
index 967a096..30b3337 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,6 +1,7 @@
 # Copyright 2006 The Android Open Source Project
 
 # Setting LOCAL_PATH will mess up all-subdir-makefiles, so do it beforehand.
+SUBDIR_MAKEFILES := $(call all-named-subdir-makefiles,modules tests)
 
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
@@ -31,8 +32,4 @@
 
 include $(BUILD_SHARED_LIBRARY)
 
-include $(addsuffix /Android.mk, $(addprefix $(LOCAL_PATH)/, \
-			modules/gralloc \
-			tests \
-		))
-		
\ No newline at end of file
+include $(SUBDIR_MAKEFILES)
diff --git a/modules/Android.mk b/modules/Android.mk
new file mode 100644
index 0000000..a7278bb
--- /dev/null
+++ b/modules/Android.mk
@@ -0,0 +1,2 @@
+hardware_modules := gralloc hwcomposer
+include $(call all-named-subdir-makefiles,$(hardware_modules))
diff --git a/modules/hwcomposer/Android.mk b/modules/hwcomposer/Android.mk
index da2b234..f1e819b 100644
--- a/modules/hwcomposer/Android.mk
+++ b/modules/hwcomposer/Android.mk
@@ -24,4 +24,5 @@
 LOCAL_SRC_FILES := hwcomposer.cpp
 LOCAL_MODULE := hwcomposer.default
 LOCAL_CFLAGS:= -DLOG_TAG=\"hwcomposer\"
+LOCAL_MODULE_TAGS := optional
 include $(BUILD_SHARED_LIBRARY)