summaryrefslogtreecommitdiff
path: root/Makefile
blob: a40f316f8af9c8fd430ab41b34989f095a3f63f4 (plain)
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
SYSPREFIX=$(shell pwd)/toolchain
NDK=/home/yvesf/share/android-ndk-r10b

export PATH := $(SYSPREFIX)/bin:$(PATH)
export PKG_CONFIG_PATH := $(SYSPREFIX)/lib/pkgconfig
export CFLAGS := -g
export CPPFLAGS := -g

all:
	echo "Call target 'compile'"

distfiles/fftw-3.3.4.tar.gz:
	wget http://www.fftw.org/fftw-3.3.4.tar.gz -O $@
distfiles/libconfig-1.4.9.tar.gz:
	wget http://www.hyperrealm.com/libconfig/libconfig-1.4.9.tar.gz -O $@
distfiles/jpegsrc.v8d.tar.gz:
	wget http://ijg.org/files/jpegsrc.v8d.tar.gz -O $@
distfiles/libusb-1.0.9.tar.bz2:
	wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2 -O $@
distfiles/librtlsdr-0.5.3.tar.gz:
	wget https://github.com/steve-m/librtlsdr/archive/v0.5.3.tar.gz -O $@

work:
	mkdir work
work/fftw-3.3.4: distfiles/fftw-3.3.4.tar.gz work
	tar xvzf $< -C work
	touch $@
work/fftw-3.3.4f: distfiles/fftw-3.3.4.tar.gz work
	mkdir -p $@
	tar xvzf $< --strip-components=1 -C $@
	touch $@
work/libconfig-1.4.9: distfiles/libconfig-1.4.9.tar.gz work
	tar xvzf $< -C work
	touch $@
work/jpeg-8d: distfiles/jpegsrc.v8d.tar.gz work
	tar xvzf $< -C work
	touch $@
	patch -p0 < patches/jpeg-autoreconf.diff 
work/libusb-1.0.9: distfiles/libusb-1.0.9.tar.bz2 work
	tar xvjf $< -C work
	patch -p0 < patches/libusb-timespec.diff
	touch $@
work/librtlsdr-0.5.3: distfiles/librtlsdr-0.5.3.tar.gz work
	tar xvzf $< -C work
	touch $@

toolchain:
#$(NDK)/build/tools/make-standalone-toolchain.sh --platform=android-14 --toolchain=arm-linux-android-androideabi-4.8 --system=linux-x86_64 --install-dir=toolchain
	$(NDK)/build/tools/make-standalone-toolchain.sh --platform=android-19 --install-dir=toolchain

compile: compile-libfftw3
compile: compile-libfftw3f
compile: compile-libconfig
compile: compile-libjpeg
compile: compile-libusb
compile: compile-librtlsdr

compile-libfftw3: $(SYSPREFIX)/lib/libfftw3.a
$(SYSPREFIX)/lib/libfftw3.a: work/fftw-3.3.4 toolchain
	cd $< && autoreconf -i
	cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
		make -j4 && \
		make install

compile-libfftw3f: $(SYSPREFIX)/lib/libfftw3f.a
$(SYSPREFIX)/lib/libfftw3f.a: work/fftw-3.3.4f toolchain
	cd $< && autoreconf -i
	cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi --enable-single && \
		make -j4 && \
		make install

compile-libconfig: $(SYSPREFIX)/lib/libconfig.a
$(SYSPREFIX)/lib/libconfig.a: work/libconfig-1.4.9 toolchain
	rm -rf $</aux-build
	cd $< && autoreconf -i
	cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
		make -j4 && \
		make install

compile-libjpeg: $(SYSPREFIX)/lib/libjpeg.a
$(SYSPREFIX)/lib/libjpeg.a: work/jpeg-8d toolchain
	cd $< && autoreconf -i
	cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
		make -j4 && \
		make install

compile-libusb: $(SYSPREFIX)/lib/libusb-1.0.a
$(SYSPREFIX)/lib/libusb-1.0.a: work/libusb-1.0.9 toolchain
	cd $< && autoreconf -i
	cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
		make -j4 && \
		make install


compile-librtlsdr: $(SYSPREFIX)/lib/librtlsdr.a
$(SYSPREFIX)/lib/librtlsdr.a: work/librtlsdr-0.5.3 toolchain $(SYSPREFIX)/lib/libusb-1.0.a
	cd $< && autoreconf -i
	cd $< && ./configure --prefix=$(SYSPREFIX) --host=arm-linux-androideabi && \
		make -j4 AM_DEFAULT_VERBOSITY=1 && \
		make install


clean:
	rm -r work
	rm -r toolchain