new file mode 100644
@@ -0,0 +1,6 @@
+LOCAL_CFLAGS += \
+ -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+
+# Quiet down the build system and remove any .h files from the sources
+LOCAL_SRC_FILES := $(patsubst %.h, , $(LOCAL_SRC_FILES))
+LOCAL_EXPORT_C_INCLUDE_DIRS += $(LOCAL_PATH)
@@ -21,6 +21,8 @@
# IN THE SOFTWARE.
#
+LIBDRM_COMMON_MK := $(call my-dir)/Android.common.mk
+
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
@@ -31,7 +33,7 @@ include $(LOCAL_PATH)/Makefile.sources
include $(CLEAR_VARS)
LOCAL_MODULE := libdrm
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_FILES))
+LOCAL_SRC_FILES := $(LIBDRM_FILES)
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/include/drm
@@ -40,25 +42,26 @@ LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include/drm
LOCAL_CFLAGS := \
- -DHAVE_VISIBILITY=1 \
- -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+ -DHAVE_VISIBILITY=1
+
+include $(LIBDRM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
# Shared library for the device
include $(CLEAR_VARS)
LOCAL_MODULE := libdrm
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_FILES))
+LOCAL_SRC_FILES := $(LIBDRM_FILES)
LOCAL_EXPORT_C_INCLUDE_DIRS := \
- $(LOCAL_PATH) \
$(LOCAL_PATH)/include/drm
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include/drm
LOCAL_CFLAGS := \
- -DHAVE_VISIBILITY=1 \
- -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+ -DHAVE_VISIBILITY=1
+
+include $(LIBDRM_COMMON_MK)
include $(BUILD_SHARED_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))
@@ -8,10 +8,7 @@ LOCAL_MODULE := libdrm_amdgpu
LOCAL_SHARED_LIBRARIES := libdrm
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_AMDGPU_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
- -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_AMDGPU_FILES)
+include $(LIBDRM_COMMON_MK)
include $(BUILD_SHARED_LIBRARY)
@@ -8,10 +8,7 @@ LOCAL_MODULE := libdrm_etnaviv
LOCAL_SHARED_LIBRARIES := libdrm
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_ETNAVIV_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
- -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_ETNAVIV_FILES)
+include $(LIBDRM_COMMON_MK)
include $(BUILD_SHARED_LIBRARY)
@@ -8,10 +8,7 @@ LOCAL_MODULE := libdrm_freedreno
LOCAL_SHARED_LIBRARIES := libdrm
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_FREEDRENO_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
- -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_FREEDRENO_FILES)
+include $(LIBDRM_COMMON_MK)
include $(BUILD_SHARED_LIBRARY)
@@ -29,14 +29,11 @@ include $(LOCAL_PATH)/Makefile.sources
LOCAL_MODULE := libdrm_intel
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_INTEL_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
- -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_INTEL_FILES)
LOCAL_SHARED_LIBRARIES := \
libdrm \
libpciaccess
+include $(LIBDRM_COMMON_MK)
include $(BUILD_SHARED_LIBRARY)
@@ -26,7 +26,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/Makefile.sources
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBKMS_FILES))
+LOCAL_SRC_FILES := $(LIBKMS_FILES)
ifneq ($(filter $(vmwgfx_drivers), $(DRM_GPU_DRIVERS)),)
LOCAL_SRC_FILES += $(LIBKMS_VMWGFX_FILES)
@@ -47,6 +47,5 @@ endif
LOCAL_MODULE := libkms
LOCAL_SHARED_LIBRARIES := libdrm
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
+include $(LIBDRM_COMMON_MK)
include $(BUILD_SHARED_LIBRARY)
@@ -8,10 +8,7 @@ LOCAL_MODULE := libdrm_nouveau
LOCAL_SHARED_LIBRARIES := libdrm
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_NOUVEAU_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
- -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_NOUVEAU_FILES)
+include $(LIBDRM_COMMON_MK)
include $(BUILD_SHARED_LIBRARY)
@@ -8,10 +8,7 @@ LOCAL_MODULE := libdrm_radeon
LOCAL_SHARED_LIBRARIES := libdrm
-LOCAL_SRC_FILES := $(patsubst %.h, , $(LIBDRM_RADEON_FILES))
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-LOCAL_CFLAGS := \
- -DHAVE_LIBDRM_ATOMIC_PRIMITIVES=1
+LOCAL_SRC_FILES := $(LIBDRM_RADEON_FILES)
+include $(LIBDRM_COMMON_MK)
include $(BUILD_SHARED_LIBRARY)
@@ -3,11 +3,12 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/Makefile.sources
-LOCAL_SRC_FILES := $(patsubst %.h, , $(MODETEST_FILES))
+LOCAL_SRC_FILES := $(MODETEST_FILES)
LOCAL_MODULE := modetest
LOCAL_SHARED_LIBRARIES := libdrm
LOCAL_STATIC_LIBRARIES := libdrm_util
+include $(LIBDRM_COMMON_MK)
include $(BUILD_EXECUTABLE)
@@ -3,11 +3,12 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/Makefile.sources
-LOCAL_SRC_FILES := $(patsubst %.h, , $(PROPTEST_FILES))
+LOCAL_SRC_FILES := $(PROPTEST_FILES)
LOCAL_MODULE := proptest
LOCAL_SHARED_LIBRARIES := libdrm
LOCAL_STATIC_LIBRARIES := libdrm_util
+include $(LIBDRM_COMMON_MK)
include $(BUILD_EXECUTABLE)
@@ -30,9 +30,7 @@ LOCAL_MODULE := libdrm_util
LOCAL_SHARED_LIBRARIES := libdrm
-LOCAL_SRC_FILES := $(patsubst %.h, , $(UTIL_FILES))
-
-# avoid name clashes by requiring users to include util/*.h
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(dir $(LOCAL_PATH))
+LOCAL_SRC_FILES := $(UTIL_FILES)
+include $(LIBDRM_COMMON_MK)
include $(BUILD_STATIC_LIBRARY)
... across the makefiles. Currently this isn't much but that will change shortly. As an added bonus this fixes all present and future cases where we've forgotten to strip out the headers from LOCAL_SRC_FILES. In a couple of cases (the tests) we start setting LOCAL_EXPORT_C_INCLUDE_DIRS, which shouldn't be an issue. Cc: Chih-Wei Huang <cwhuang@android-x86.org> Cc: Rob Herring <robh@kernel.org> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> --- Android.common.mk | 6 ++++++ Android.mk | 17 ++++++++++------- amdgpu/Android.mk | 7 ++----- etnaviv/Android.mk | 7 ++----- freedreno/Android.mk | 7 ++----- intel/Android.mk | 7 ++----- libkms/Android.mk | 5 ++--- nouveau/Android.mk | 7 ++----- radeon/Android.mk | 7 ++----- tests/modetest/Android.mk | 3 ++- tests/proptest/Android.mk | 3 ++- tests/util/Android.mk | 6 ++---- 12 files changed, 36 insertions(+), 46 deletions(-) create mode 100644 Android.common.mk