forked from mstorsjo/vlc-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
133 lines (108 loc) · 4.04 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Sources and objects
export ANDROID_HOME=$(ANDROID_SDK)
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 \
LIBVLCJNI_H=$(SRC)/jni/libvlcjni.h
PRIVATE_LIBDIR=android-libs
PRIVATE_LIBS=$(PRIVATE_LIBDIR)/libstagefright.so $(PRIVATE_LIBDIR)/libmedia.so $(PRIVATE_LIBDIR)/libutils.so $(PRIVATE_LIBDIR)/libbinder.so
ifneq ($(V),)
ANT_OPTS += -v
VERBOSE =
GEN =
else
VERBOSE = @
GEN = @echo "Generating" $@;
endif
ifneq ($(RELEASE),)
ANT_TARGET = release
VLC_APK=$(SRC)/bin/VLC-release-unsigned.apk
NDK_DEBUG=0
else
ANT_TARGET = debug
VLC_APK=$(SRC)/bin/VLC-debug.apk
NDK_DEBUG=1
endif
$(VLC_APK): $(LIBVLCJNI) $(JAVA_SOURCES)
@echo
@echo "=== Building $@ for $(ARCH) ==="
@echo
date +"%Y-%m-%d" > $(SRC)/assets/builddate.txt
echo `id -u -n`@`hostname` > $(SRC)/assets/builder.txt
git rev-parse --short HEAD > $(SRC)/assets/revision.txt
./gen-env.sh $(SRC)
$(VERBOSE)cd $(SRC) && ant $(ANT_OPTS) $(ANT_TARGET)
VLC_MODULES=`./find_modules.sh $(VLC_BUILD_DIR)`
$(LIBVLCJNI_H):
$(VERBOSE)if [ -z "$(VLC_BUILD_DIR)" ]; then echo "VLC_BUILD_DIR not defined" ; exit 1; fi
$(GEN)modules="$(VLC_MODULES)" ; \
if [ -z "$$modules" ]; then echo "No VLC modules found in $(VLC_BUILD_DIR)/modules"; exit 1; fi; \
DEFINITION=""; \
BUILTINS="const void *vlc_static_modules[] = {\n"; \
for file in $$modules; do \
name=`echo $$file | sed 's/.*\.libs\/lib//' | sed 's/_plugin\.a//'`; \
DEFINITION=$$DEFINITION"int vlc_entry__$$name (int (*)(void *, void *, int, ...), void *);\n"; \
BUILTINS="$$BUILTINS vlc_entry__$$name,\n"; \
done; \
BUILTINS="$$BUILTINS NULL\n};\n"; \
printf "/* Autogenerated from the list of modules */\n $$DEFINITION\n $$BUILTINS\n" > $@
$(PRIVATE_LIBDIR)/%.so: $(PRIVATE_LIBDIR)/%.c
$(GEN)$(TARGET_TUPLE)-gcc $< -shared -o $@ --sysroot=$(ANDROID_NDK)/platforms/android-9/arch-$(PLATFORM_SHORT_ARCH)
$(PRIVATE_LIBDIR)/%.c: $(PRIVATE_LIBDIR)/%.symbols
$(VERBOSE)rm -f $@
$(GEN)for s in `cat $<`; do echo "void $$s() {}" >> $@; done
$(LIBVLCJNI): $(JNI_SOURCES) $(LIBVLCJNI_H) $(PRIVATE_LIBS)
@if [ -z "$(VLC_BUILD_DIR)" ]; then echo "VLC_BUILD_DIR not defined" ; exit 1; fi
@if [ -z "$(ANDROID_NDK)" ]; then echo "ANDROID_NDK not defined" ; exit 1; fi
@echo
@echo "=== Building libvlcjni ==="
@echo
$(VERBOSE)if [ -z "$(VLC_SRC_DIR)" ] ; then VLC_SRC_DIR=./vlc; fi ; \
if [ -z "$(VLC_CONTRIB)" ] ; then VLC_CONTRIB="$$VLC_SRC_DIR/contrib/$(TARGET_TUPLE)"; 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\"`" ; \
VLC_BUILD_DIR="../$(VLC_BUILD_DIR)"; \
fi ; \
[ `echo "$$VLC_CONTRIB" | head -c 1` != "/" ] && VLC_CONTRIB="../$$VLC_CONTRIB"; \
[ `echo "$$VLC_SRC_DIR" | head -c 1` != "/" ] && VLC_SRC_DIR="../$$VLC_SRC_DIR"; \
$(ANDROID_NDK)/ndk-build -C $(SRC) \
VLC_SRC_DIR="$$VLC_SRC_DIR" \
VLC_CONTRIB="$$VLC_CONTRIB" \
VLC_BUILD_DIR="$$VLC_BUILD_DIR" \
VLC_MODULES="$$vlc_modules" \
NDK_DEBUG=$(NDK_DEBUG) \
TARGET_CFLAGS="$$VLC_EXTRA_CFLAGS"
apkclean:
rm -f $(VLC_APK)
lightclean:
cd $(SRC) && rm -rf libs obj bin $(VLC_APK)
rm -f $(PRIVATE_LIBDIR)/*.so $(PRIVATE_LIBDIR)/*.c
clean: lightclean
rm -rf $(SRC)/gen java-libs/*/gen java-libs/*/bin
jniclean: lightclean
rm -f $(LIBVLCJNI) $(LIBVLCJNI_H)
distclean: clean jniclean
install: $(VLC_APK)
@echo "=== Installing VLC on device ==="
adb wait-for-device
adb install -r $(VLC_APK)
uninstall:
adb wait-for-device
adb uninstall org.videolan.vlc
run:
@echo "=== Running VLC on device ==="
adb wait-for-device
adb shell monkey -p org.videolan.vlc -s 0 1
build-and-run: install run
apkclean-run: apkclean build-and-run
adb logcat -c
distclean-run: distclean build-and-run
adb logcat -c
.PHONY: lightclean clean jniclean distclean distclean-run apkclean apkclean-run install run build-and-run