Makefile 3.05 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

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

JPeg's avatar
JPeg committed
11
all: vlc.apk
12

Rafaël Carré's avatar
Rafaël Carré committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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" > $@
28

Rafaël Carré's avatar
Rafaël Carré committed
29
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 ==="
	@if [ -z "$(VLC_SRC_DIR)" ] ; then VLC_SRC_DIR=./vlc; fi ; \
Rafaël Carré's avatar
Rafaël Carré committed
34
	if [ -z "$(VLC_CONTRIB)" ] ; then VLC_CONTRIB="$$VLC_SRC_DIR/contrib/arm-linux-androideabi"; fi ; \
Rafaël Carré's avatar
Rafaël Carré committed
35
36
37
38
39
40
41
42
43
44
45
46
	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 ; \
	if [ `echo "$$VLC_CONTRIB"   | head -c 1` != "/" ] ; then VLC_CONTRIB="../$$VLC_CONTRIB"; fi ; \
	if [ `echo "$$VLC_SRC_DIR"   | head -c 1` != "/" ] ; then VLC_SRC_DIR="../$$VLC_SRC_DIR"; fi ; \
	$(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"
47

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

53
$(VLC_APK): $(LIBVLCJNI) $(JAVA_SOURCES) vlc-android/local.properties
JPeg's avatar
JPeg committed
54
	@echo "=== Building APK =="
Tanguy Pruvot's avatar
Tanguy Pruvot committed
55
	@cd vlc-android && ant $(VERBOSE) debug
JPeg's avatar
JPeg committed
56

57
libvlcjni: $(LIBVLCJNI)
JPeg's avatar
JPeg committed
58

59
vlc.apk: libvlcjni $(VLC_APK)
60
61

clean:
JPeg's avatar
JPeg committed
62
63
64
	rm -rf vlc-android/libs
	rm -rf vlc-android/obj
	rm -rf vlc-android/bin
65
66

distclean: clean
67
	rm -f $(LIBVLCJNI_H)
JPeg's avatar
JPeg committed
68
	rm -f vlc-android/local.properties
69

ivoire's avatar
ivoire committed
70
install: vlc.apk
71
72
	@echo "=== Installing APK on a remote device ==="
	@echo "Waiting for a device to be ready..." && adb wait-for-device
73
74
	@echo "Installing package" && adb install -r $(VLC_APK)

JPeg's avatar
JPeg committed
75
76
run:
	@echo "=== Running application on device ==="
77
	@adb wait-for-device && adb shell monkey -p org.videolan.vlc.android -s 0 1
JPeg's avatar
JPeg committed
78
79
80

build-and-run: vlc.apk install run
	@echo "=== Application is running ==="