Explicitly include Android.mk for only OpenGL

Replace all-makefiles-under makefile-macro with explicitly including
Android.mk(s) from subdirectories that are related to OpenGL and are
only needed by Android builds.

The change are mainly made to the top-level Android.mk and the
src/Android.mk. The other three sub-Android.mk(s) are deprecated and
deleted. Soong compile-time is expected to shorten with no use of
all-makefiles-under macros.

Since the project co-existed with both Android.bp and Android.mk.
The test was performed in absence of Android.bp on oc-mr1-dev branch
against aosp_arm-eng and aosp_arm64-eng targets.

NOTE: Android Pie uses Android.bp only.

Bug: b/29023322
Test: oc-mr1-dev branch, aosp_arm-eng (LLVM3) & aosp_arm64-eng (LLVM7) targets
Change-Id: I05ac46213f849747621c7084bca2549a22513881
Reviewed-on: https://swiftshader-review.googlesource.com/21068
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Merck Hung <merckhung@google.com>
diff --git a/Android.mk b/Android.mk
index 4eef358..09141b3 100644
--- a/Android.mk
+++ b/Android.mk
@@ -15,6 +15,7 @@
 #
 
 LOCAL_PATH := $(call my-dir)
+swiftshader_root := $(LOCAL_PATH)
 
 # LLVM version for SwiftShader
 SWIFTSHADER_LLVM_VERSION ?= 3
@@ -60,6 +61,12 @@
 endif
 
 
-ifndef swiftshader_unsupported_build
-include $(call all-makefiles-under,$(LOCAL_PATH))
+ifneq ($(swiftshader_unsupported_build),true)
+include $(swiftshader_root)/src/Android.mk
+include $(swiftshader_root)/tests/unittests/Android.mk
+ifeq ($(SWIFTSHADER_LLVM_VERSION),3)
+include $(swiftshader_root)/third_party/LLVM/Android.mk
+else
+include $(swiftshader_root)/third_party/llvm-7.0/Android.mk
+endif
 endif
diff --git a/src/Android.mk b/src/Android.mk
index 3695926..b25ef91 100644
--- a/src/Android.mk
+++ b/src/Android.mk
@@ -1,4 +1,5 @@
-LOCAL_PATH:= $(call my-dir)
+LOCAL_PATH := $(call my-dir)
+swiftshader_src_root := $(LOCAL_PATH)
 
 COMMON_C_INCLUDES += \
 	bionic \
@@ -186,4 +187,8 @@
 LOCAL_STATIC_LIBRARIES := $(COMMON_STATIC_LIBRARIES)
 include $(BUILD_STATIC_LIBRARY)
 
-include $(call all-makefiles-under,$(LOCAL_PATH))
+include $(swiftshader_src_root)/Reactor/Android.mk
+include $(swiftshader_src_root)/OpenGL/libGLESv2/Android.mk
+include $(swiftshader_src_root)/OpenGL/libGLES_CM/Android.mk
+include $(swiftshader_src_root)/OpenGL/libEGL/Android.mk
+include $(swiftshader_src_root)/OpenGL/compiler/Android.mk
diff --git a/src/OpenGL/Android.mk b/src/OpenGL/Android.mk
deleted file mode 100644
index 3daa3a0..0000000
--- a/src/OpenGL/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright 2015 The Android Open-Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/Android.mk b/tests/Android.mk
deleted file mode 100644
index 90af88e..0000000
--- a/tests/Android.mk
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Copyright 2018 The Android Open-Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/third_party/Android.mk b/third_party/Android.mk
deleted file mode 100644
index c774af3..0000000
--- a/third_party/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright 2015 The Android Open-Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(SWIFTSHADER_LLVM_VERSION),3)
-include $(LOCAL_PATH)/LLVM/Android.mk
-else
-include $(LOCAL_PATH)/llvm-7.0/Android.mk
-endif