Makefile 2.81 KB
Newer Older
1
# Sources and objects
2
JAVA_SOURCES=vlc-android/src/org/videolan/vlc/android/*.java
3
JNI_SOURCES=vlc-android/jni/*.c vlc-android/jni/*.h
4
5
6
VLC_APK=vlc-android/bin/VLC-debug.apk
LIBVLCJNI=vlc-android/libs/armeabi/libvlcjni.so
LIBVLCJNI_H=vlc-android/jni/libvlcjni.h
JPeg's avatar
JPeg committed
7

Rafaël Carré's avatar
Rafaël Carré committed
8
# Verbose level: -q -v or nothing (default verbose)
Tanguy Pruvot's avatar
Tanguy Pruvot committed
9
10
VERBOSE ?= -v

11
12
$(VLC_APK): $(LIBVLCJNI) $(JAVA_SOURCES) vlc-android/local.properties
	cd vlc-android && ant $(VERBOSE) debug
13

Rafaël Carré's avatar
Rafaël Carré committed
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
VLC_MODULES=`find $(VLC_BUILD_DIR)/modules -name 'lib*_plugin.a'|grep -v stats|tr \\\\n \ `

$(LIBVLCJNI_H):
	@if [ -z "$(VLC_BUILD_DIR)" ]; then echo "VLC_BUILD_DIR not defined" ; exit 1; fi
	@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" > $@
29

Rafaël Carré's avatar
Rafaël Carré committed
30
31
32
33
$(LIBVLCJNI): $(JNI_SOURCES) $(LIBVLCJNI_H)
	@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 "=== Building libvlcjni with$${NO_NEON:+out} neon ==="
34
35
	@echo
	if [ -z "$(VLC_SRC_DIR)" ] ; then VLC_SRC_DIR=./vlc; fi ; \
Rafaël Carré's avatar
Rafaël Carré committed
36
	if [ -z "$(VLC_CONTRIB)" ] ; then VLC_CONTRIB="$$VLC_SRC_DIR/contrib/arm-linux-androideabi"; fi ; \
Rafaël Carré's avatar
Rafaël Carré committed
37
38
39
40
41
	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 ; \
42
43
	[ `echo "$$VLC_CONTRIB"   | head -c 1` != "/" ] && VLC_CONTRIB="../$$VLC_CONTRIB"; \
	[ `echo "$$VLC_SRC_DIR"   | head -c 1` != "/" ] && VLC_SRC_DIR="../$$VLC_SRC_DIR"; \
Rafaël Carré's avatar
Rafaël Carré committed
44
45
46
47
48
	$(ANDROID_NDK)/ndk-build -C vlc-android \
		VLC_SRC_DIR="$$VLC_SRC_DIR" \
		VLC_CONTRIB="$$VLC_CONTRIB" \
		VLC_BUILD_DIR="$$VLC_BUILD_DIR" \
		VLC_MODULES="$$vlc_modules"
49

JPeg's avatar
JPeg committed
50
vlc-android/local.properties:
Rafaël Carré's avatar
Rafaël Carré committed
51
	@if [ -z "$$ANDROID_SDK" ]; then echo "ANDROID_SDK not defined" ; exit 1; fi
52
	printf "# Auto-generated file. Do not edit.\nsdk.dir=$$ANDROID_SDK" > $@
53
54

clean:
55
	cd vlc-android && rm -rf libs obj bin $(VLC_APK)
56
57

distclean: clean
58
	rm -f $(LIBVLCJNI) $(LIBVLCJNI_H) vlc-android/local.properties
59

60
61
62
63
install: $(VLC_APK)
	@echo "=== Installing VLC on device ==="
	adb wait-for-device
	adb install -r $(VLC_APK)
64

JPeg's avatar
JPeg committed
65
run:
66
67
68
69
70
	@echo "=== Running VLC on device ==="
	adb wait-for-device
	adb shell monkey -p org.videolan.vlc.android -s 0 1

build-and-run: install run
JPeg's avatar
JPeg committed
71

72
.PHONY: clean distclean install run build-and-run