[Android] libiomx: factorize builds
Thomas Guillem
git at videolan.org
Thu Jul 24 22:43:23 CEST 2014
vlc-ports/android | branch: master | Thomas Guillem <guillem at archos.com> | Thu Jul 24 10:53:24 2014 +0200| [5d2993f952952a0e03e50d3e70d142231d6838a8] | committer: Martin Storsjö
libiomx: factorize builds
Only libiomx libs that are specified by LIBVLC_LIBS will be built.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=5d2993f952952a0e03e50d3e70d142231d6838a8
---
Makefile | 12 ++++-----
vlc-android/jni/Android.mk | 60 ++++++++++++++++++++++++--------------------
2 files changed, 39 insertions(+), 33 deletions(-)
diff --git a/Makefile b/Makefile
index 8ab1ace..2e0ae65 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,10 @@ ARCH = $(ANDROID_ABI)
SRC=vlc-android
JAVA_SOURCES=$(SRC)/src/org/videolan/vlc/*.java
JNI_SOURCES=$(SRC)/jni/*.c $(SRC)/jni/*.h
-LIBVLCJNI= \
- $(SRC)/obj/local/$(ARCH)/libvlcjni.so \
- $(SRC)/obj/local/$(ARCH)/libiomx-ics.so \
- $(SRC)/obj/local/$(ARCH)/libiomx-hc.so \
- $(SRC)/obj/local/$(ARCH)/libiomx-gingerbread.so \
+LIBVLC_LIBS = libvlcjni
+LIBVLC_LIBS += libiomx-ics libiomx-hc libiomx-gingerbread
+
+LIBVLCJNI= $(addprefix $(SRC)/obj/local/$(ARCH)/,$(addsuffix .so,$(LIBVLC_LIBS)))
LIBVLCJNI_H=$(SRC)/jni/libvlcjni.h
@@ -91,7 +90,8 @@ $(LIBVLCJNI): $(JNI_SOURCES) $(LIBVLCJNI_H) $(PRIVATE_LIBS)
VLC_BUILD_DIR="$$VLC_BUILD_DIR" \
VLC_MODULES="$$vlc_modules" \
NDK_DEBUG=$(NDK_DEBUG) \
- TARGET_CFLAGS="$$VLC_EXTRA_CFLAGS"
+ TARGET_CFLAGS="$$VLC_EXTRA_CFLAGS" \
+ LIBVLC_LIBS="$(LIBVLC_LIBS)"
apkclean:
rm -f $(VLC_APK)
diff --git a/vlc-android/jni/Android.mk b/vlc-android/jni/Android.mk
index 7217439..2752d8e 100644
--- a/vlc-android/jni/Android.mk
+++ b/vlc-android/jni/Android.mk
@@ -75,33 +75,39 @@ LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libiomx-gingerbread
-LOCAL_SRC_FILES := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
-LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/modules/codec/omxil $(ANDROID_SYS_HEADERS_GINGERBREAD)/frameworks/base/include $(ANDROID_SYS_HEADERS_GINGERBREAD)/system/core/include
-LOCAL_CFLAGS := -Wno-psabi
-LOCAL_LDLIBS := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder
-
-include $(BUILD_SHARED_LIBRARY)
-
+# libiomx-* build
+
+LIBIOMX_SRC_FILES_COMMON := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
+LIBIOMX_INCLUDES_COMMON := $(VLC_SRC_DIR)/modules/codec/omxil
+LIBIOMX_LDLIBS_COMMON := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder
+LIBIOMX_CFLAGS_COMMON := -Wno-psabi
+
+LIBIOMX_INCLUDES_gingerbread := $(LIBIOMX_INCLUDES_COMMON) \
+ $(ANDROID_SYS_HEADERS_GINGERBREAD)/frameworks/base/include \
+ $(ANDROID_SYS_HEADERS_GINGERBREAD)/system/core/include
+
+LIBIOMX_INCLUDES_hc := $(LIBIOMX_INCLUDES_COMMON) \
+ $(ANDROID_SYS_HEADERS_HC)/frameworks/base/include \
+ $(ANDROID_SYS_HEADERS_HC)/frameworks/base/native/include \
+ $(ANDROID_SYS_HEADERS_HC)/system/core/include \
+ $(ANDROID_SYS_HEADERS_HC)/hardware/libhardware/include
+
+LIBIOMX_INCLUDES_ics := $(LIBIOMX_INCLUDES_COMMON) \
+ $(ANDROID_SYS_HEADERS_ICS)/frameworks/base/include \
+ $(ANDROID_SYS_HEADERS_ICS)/frameworks/base/native/include \
+ $(ANDROID_SYS_HEADERS_ICS)/system/core/include \
+ $(ANDROID_SYS_HEADERS_ICS)/hardware/libhardware/include
+
+define build_iomx
include $(CLEAR_VARS)
-
-LOCAL_MODULE := libiomx-hc
-LOCAL_SRC_FILES := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
-LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/modules/codec/omxil $(ANDROID_SYS_HEADERS_HC)/frameworks/base/include $(ANDROID_SYS_HEADERS_HC)/frameworks/base/native/include $(ANDROID_SYS_HEADERS_HC)/system/core/include $(ANDROID_SYS_HEADERS_HC)/hardware/libhardware/include
-LOCAL_CFLAGS := -Wno-psabi
-LOCAL_LDLIBS := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder
-
+LOCAL_MODULE := $(1)
+LOCAL_SRC_FILES := $(LIBIOMX_SRC_FILES_COMMON)
+LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
+LOCAL_LDLIBS := $(LIBIOMX_LDLIBS_COMMON)
+LOCAL_CFLAGS := $(LIBIOMX_CFLAGS_COMMON)
include $(BUILD_SHARED_LIBRARY)
+endef
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libiomx-ics
-LOCAL_SRC_FILES := ../$(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
-LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/modules/codec/omxil $(ANDROID_SYS_HEADERS_ICS)/frameworks/base/include $(ANDROID_SYS_HEADERS_ICS)/frameworks/base/native/include $(ANDROID_SYS_HEADERS_ICS)/system/core/include $(ANDROID_SYS_HEADERS_ICS)/hardware/libhardware/include
-LOCAL_CFLAGS := -Wno-psabi
-LOCAL_LDLIBS := -L$(ANDROID_LIBS) -lgcc -lstagefright -lmedia -lutils -lbinder
-
-include $(BUILD_SHARED_LIBRARY)
+# call build_iomx for each libiomx-* in LIBVLC_LIBS
+$(foreach IOMX_MODULE,$(filter libiomx-%,$(LIBVLC_LIBS)), \
+ $(eval $(call build_iomx,$(IOMX_MODULE),$(subst libiomx-,,$(IOMX_MODULE)))))
More information about the Android
mailing list