[Android] [PATCH 4/7] Makefile: Don't hardcode the build target arch and binary

Edward Wang edward.c.wang at compdigitec.com
Sun Jul 15 22:27:31 CEST 2012


---
 Makefile         |    6 ++++--
 echo-abi-vars.sh |   17 +++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)
 create mode 100755 echo-abi-vars.sh

diff --git a/Makefile b/Makefile
index 6022f8e..52a0372 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,8 @@
 # Sources and objects
 
 ARCH = $(ANDROID_ABI)
+TARGET = `./echo-abi-vars.sh TARGET_TUPLET`
+PLATFORM_SHORT_ARCH = `./echo-abi-vars.sh PLATFORM_SHORT_ARCH`
 
 SRC=vlc-android
 JAVA_SOURCES=$(SRC)/src/org/videolan/vlc/*.java
@@ -62,7 +64,7 @@ $(LIBVLCJNI_H):
 	printf "/* Autogenerated from the list of modules */\n $$DEFINITION\n $$BUILTINS\n" > $@
 
 $(PRIVATE_LIBDIR)/%.so: $(PRIVATE_LIBDIR)/%.c
-	$(GEN)arm-linux-androideabi-gcc $< -shared -o $@ --sysroot=$(ANDROID_NDK)/platforms/android-3/arch-arm
+	$(GEN)$(TARGET)-gcc $< -shared -o $@ --sysroot=$(ANDROID_NDK)/platforms/android-9/arch-$(PLATFORM_SHORT_ARCH)
 
 $(PRIVATE_LIBDIR)/%.c: $(PRIVATE_LIBDIR)/%.symbols
 	$(VERBOSE)rm -f $@
@@ -75,7 +77,7 @@ $(LIBVLCJNI): $(JNI_SOURCES) $(LIBVLCJNI_H) $(PRIVATE_LIBS)
 	@echo "=== Building libvlcjni with$${NO_NEON:+out} neon ==="
 	@echo
 	$(VERBOSE)if [ -z "$(VLC_SRC_DIR)" ] ; then VLC_SRC_DIR=./vlc; fi ; \
-	if [ -z "$(VLC_CONTRIB)" ] ; then VLC_CONTRIB="$$VLC_SRC_DIR/contrib/arm-linux-androideabi"; fi ; \
+	if [ -z "$(VLC_CONTRIB)" ] ; then VLC_CONTRIB="$$VLC_SRC_DIR/contrib/$(TARGET)"; fi ; \
 	vlc_modules="$(VLC_MODULES)" ; \
 	if [ `echo "$(VLC_BUILD_DIR)" | head -c 1` != "/" ] ; then \
 		vlc_modules="`echo $$vlc_modules|sed \"s|$(VLC_BUILD_DIR)|../$(VLC_BUILD_DIR)|g\"`" ; \
diff --git a/echo-abi-vars.sh b/echo-abi-vars.sh
new file mode 100755
index 0000000..3a0180a
--- /dev/null
+++ b/echo-abi-vars.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+source $(dirname $0)/setup-abi-vars.sh
+
+if [ -n "$1" ]; then
+    case $1 in
+        TARGET_TUPLET)
+            echo $TARGET_TUPLET
+            ;;
+        PATH_HOST)
+            echo $PATH_HOST
+            ;;
+        PLATFORM_SHORT_ARCH)
+            echo $PLATFORM_SHORT_ARCH
+            ;;
+    esac
+fi
-- 
1.7.5.4



More information about the Android mailing list