Makefile 3.7 KB
Newer Older
1
# Sources and objects
2
3
4
5
6
7
8

ifeq ($(NO_NEON),)
ARCH = armeabi-v7a
else
ARCH = armeabi
endif

Rafaël Carré's avatar
Rafaël Carré committed
9
10
11
12
SRC=vlc-android
JAVA_SOURCES=$(SRC)/src/org/videolan/vlc/*.java
JNI_SOURCES=$(SRC)/jni/*.c $(SRC)/jni/*.h
VLC_APK=$(SRC)/bin/VLC-debug.apk
13
LIBVLCJNI=	\
14
15
16
	$(SRC)/obj/local/$(ARCH)/libvlcjni.so \
	$(SRC)/obj/local/$(ARCH)/libiomx-ics.so \
	$(SRC)/obj/local/$(ARCH)/libiomx-gingerbread.so \
17

Rafaël Carré's avatar
Rafaël Carré committed
18
LIBVLCJNI_H=$(SRC)/jni/libvlcjni.h
JPeg's avatar
JPeg committed
19

20
21
22
PRIVATE_LIBDIR=android-libs
PRIVATE_LIBS=$(PRIVATE_LIBDIR)/libstagefright.so $(PRIVATE_LIBDIR)/libmedia.so $(PRIVATE_LIBDIR)/libutils.so $(PRIVATE_LIBDIR)/libbinder.so

23
24
ifneq ($(V),)
ANT_OPTS += -v
Rafaël Carré's avatar
Rafaël Carré committed
25
26
VERBOSE =
GEN =
27
else
Rafaël Carré's avatar
Rafaël Carré committed
28
29
VERBOSE = @
GEN = @echo "Generating" $@;
30
endif
Tanguy Pruvot's avatar
Tanguy Pruvot committed
31

Rafaël Carré's avatar
Rafaël Carré committed
32
$(VLC_APK): $(LIBVLCJNI) $(JAVA_SOURCES)
Rafaël Carré's avatar
Rafaël Carré committed
33
34
35
	@echo
	@echo "=== Building $@ for $(ARCH) ==="
	@echo
Rafaël Carré's avatar
Rafaël Carré committed
36
	$(VERBOSE)cd $(SRC) && ant $(ANT_OPTS) debug
37

38
VLC_MODULES=`find $(VLC_BUILD_DIR)/modules -name 'lib*_plugin.a'|grep -v -E "stats|access_bd|oldrc|real|hotkeys|gestures|sap|dynamicoverlay|rss|libball|bargraph|clone|access_shm|mosaic|imem|osdmenu|puzzle|mediadirs|t140|ripple|motion|sharpen|grain|posterize|mirror|wall|scene|blendbench|psychedelic|alphamask|netsync|audioscrobbler|imem|motiondetect|export|smf|podcast|bluescreen|erase|record|speex_resampler|remoteosd|magnify|gradient|spdif|dtstofloat32" | tr \\\\n \ `
Rafaël Carré's avatar
Rafaël Carré committed
39
40

$(LIBVLCJNI_H):
Rafaël Carré's avatar
Rafaël Carré committed
41
42
	$(VERBOSE)if [ -z "$(VLC_BUILD_DIR)" ]; then echo "VLC_BUILD_DIR not defined" ; exit 1; fi
	$(GEN)modules="$(VLC_MODULES)" ; \
Rafaël Carré's avatar
Rafaël Carré committed
43
44
45
46
47
48
49
50
51
52
	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" > $@
53

54
$(PRIVATE_LIBDIR)/%.so: $(PRIVATE_LIBDIR)/%.c
Rafaël Carré's avatar
Rafaël Carré committed
55
	$(GEN)arm-linux-androideabi-gcc $< -shared -o $@ --sysroot=$(ANDROID_NDK)/platforms/android-3/arch-arm
56
57

$(PRIVATE_LIBDIR)/%.c: $(PRIVATE_LIBDIR)/%.symbols
Rafaël Carré's avatar
Rafaël Carré committed
58
59
	$(VERBOSE)rm -f $@
	$(GEN)for s in `cat $<`; do echo "void $$s() {}" >> $@; done
60
61

$(LIBVLCJNI): $(JNI_SOURCES) $(LIBVLCJNI_H) $(PRIVATE_LIBS)
Rafaël Carré's avatar
Rafaël Carré committed
62
63
	@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
Rafaël Carré's avatar
Rafaël Carré committed
64
	@echo
Rafaël Carré's avatar
Rafaël Carré committed
65
	@echo "=== Building libvlcjni with$${NO_NEON:+out} neon ==="
66
	@echo
Rafaël Carré's avatar
Rafaël Carré committed
67
	$(VERBOSE)if [ -z "$(VLC_SRC_DIR)" ] ; then VLC_SRC_DIR=./vlc; fi ; \
Rafaël Carré's avatar
Rafaël Carré committed
68
	if [ -z "$(VLC_CONTRIB)" ] ; then VLC_CONTRIB="$$VLC_SRC_DIR/contrib/arm-linux-androideabi"; fi ; \
Rafaël Carré's avatar
Rafaël Carré committed
69
70
71
72
73
	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 ; \
Rafaël Carré's avatar
Rafaël Carré committed
74
75
	[ `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
76
	$(ANDROID_NDK)/ndk-build -C $(SRC) \
Rafaël Carré's avatar
Rafaël Carré committed
77
78
79
80
		VLC_SRC_DIR="$$VLC_SRC_DIR" \
		VLC_CONTRIB="$$VLC_CONTRIB" \
		VLC_BUILD_DIR="$$VLC_BUILD_DIR" \
		VLC_MODULES="$$vlc_modules"
81
82

clean:
Rafaël Carré's avatar
Rafaël Carré committed
83
	cd $(SRC) && rm -rf gen libs obj bin $(VLC_APK)
84
	rm -f $(PRIVATE_LIBDIR)/*.so $(PRIVATE_LIBDIR)/*.c
85
86

distclean: clean
Rafaël Carré's avatar
Rafaël Carré committed
87
	rm -f $(LIBVLCJNI) $(LIBVLCJNI_H)
88

89
90
91
92
install: $(VLC_APK)
	@echo "=== Installing VLC on device ==="
	adb wait-for-device
	adb install -r $(VLC_APK)
93

JPeg's avatar
JPeg committed
94
run:
95
96
	@echo "=== Running VLC on device ==="
	adb wait-for-device
Sébastien Toque's avatar
Sébastien Toque committed
97
	adb shell monkey -p org.videolan.vlc -s 0 1
98
99

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

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