[PATCH libdrm 2/5] android: introduce Android.common.mk to reduce boilerplate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



... 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@xxxxxxxxxxxxxxx>
Cc: Rob Herring <robh@xxxxxxxxxx>
Signed-off-by: Emil Velikov <emil.l.velikov@xxxxxxxxx>
---
 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

diff --git a/Android.common.mk b/Android.common.mk
new file mode 100644
index 00000000..c6ab8f50
--- /dev/null
+++ b/Android.common.mk
@@ -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)
diff --git a/Android.mk b/Android.mk
index 6ecc4e1c..ec6d5322 100644
--- a/Android.mk
+++ b/Android.mk
@@ -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))
diff --git a/amdgpu/Android.mk b/amdgpu/Android.mk
index 332d9570..bf0611ba 100644
--- a/amdgpu/Android.mk
+++ b/amdgpu/Android.mk
@@ -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)
diff --git a/etnaviv/Android.mk b/etnaviv/Android.mk
index a70eeac0..390f9a98 100644
--- a/etnaviv/Android.mk
+++ b/etnaviv/Android.mk
@@ -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)
diff --git a/freedreno/Android.mk b/freedreno/Android.mk
index d7e80e12..2b582aed 100644
--- a/freedreno/Android.mk
+++ b/freedreno/Android.mk
@@ -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)
diff --git a/intel/Android.mk b/intel/Android.mk
index e7ec5a57..5407ff3e 100644
--- a/intel/Android.mk
+++ b/intel/Android.mk
@@ -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)
diff --git a/libkms/Android.mk b/libkms/Android.mk
index 0259ffbb..0be72054 100644
--- a/libkms/Android.mk
+++ b/libkms/Android.mk
@@ -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)
diff --git a/nouveau/Android.mk b/nouveau/Android.mk
index 451f9a73..b430af4f 100644
--- a/nouveau/Android.mk
+++ b/nouveau/Android.mk
@@ -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)
diff --git a/radeon/Android.mk b/radeon/Android.mk
index 57cbc92a..71040dab 100644
--- a/radeon/Android.mk
+++ b/radeon/Android.mk
@@ -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)
diff --git a/tests/modetest/Android.mk b/tests/modetest/Android.mk
index 6a7f4069..c1a71fd9 100644
--- a/tests/modetest/Android.mk
+++ b/tests/modetest/Android.mk
@@ -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)
diff --git a/tests/proptest/Android.mk b/tests/proptest/Android.mk
index badeb588..91a590fc 100644
--- a/tests/proptest/Android.mk
+++ b/tests/proptest/Android.mk
@@ -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)
diff --git a/tests/util/Android.mk b/tests/util/Android.mk
index c9d087e3..7656c4c2 100644
--- a/tests/util/Android.mk
+++ b/tests/util/Android.mk
@@ -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)
-- 
2.11.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux