1# This Makefile is for building the CELL BE SPU libs
2# libfb_writer_spu.so, libyuv2rgb_spu.so, libbilin_scaler_spu.so
3
4# Toolchain
5SPU_GCC=/usr/bin/spu-gcc
6PPU_GCC=/usr/bin/gcc
7PPU_EMBEDSPU=/usr/bin/embedspu
8PPU_AR=/usr/bin/ar
9PPU_LD=/usr/bin/ld
10INSTALL=/usr/bin/install
11
12SPU_CFLAGS=-W -Wall -Winline -Wno-main -I. -I /usr/spu/include -I /opt/cell/sdk/usr/spu/include -finline-limit=10000 -Winline -ftree-vectorize -funroll-loops -fmodulo-sched -ffast-math -fPIC -O2
13
14# Usually /usr/lib, depending on your distribution
15PREFIX=/usr/lib
16
17
18all: libfb_writer_spu.a libfb_writer_spu.so \
19				libyuv2rgb_spu.so libyuv2rgb_spu.a \
20				libbilin_scaler_spu.so libbilin_scaler_spu.a
21
22
23# fb_writer
24fb_writer_spu-embed.o: fb_writer.c spu_common.h
25	$(SPU_GCC) $(SPU_CFLAGS) -o fb_writer_spu fb_writer.c -lm
26	$(PPU_EMBEDSPU) -m32 fb_writer_spu fb_writer_spu fb_writer_spu-embed.o
27
28libfb_writer_spu.so: fb_writer_spu-embed.o
29	$(PPU_LD) -o libfb_writer_spu.so -shared -soname=libfb_writer_spu.so fb_writer_spu-embed.o
30
31libfb_writer_spu.a: fb_writer_spu-embed.o
32	$(PPU_AR) -qcs libfb_writer_spu.a fb_writer_spu-embed.o
33
34
35# yuv2rgb_converter
36yuv2rgb_spu-embed.o: yuv2rgb_converter.c spu_common.h
37	$(SPU_GCC) $(SPU_CFLAGS) -o yuv2rgb_spu yuv2rgb_converter.c -lm
38	$(PPU_EMBEDSPU) -m32 yuv2rgb_spu yuv2rgb_spu yuv2rgb_spu-embed.o
39
40libyuv2rgb_spu.a: yuv2rgb_spu-embed.o
41	$(PPU_AR) -qcs libyuv2rgb_spu.a yuv2rgb_spu-embed.o
42
43libyuv2rgb_spu.so: yuv2rgb_spu-embed.o
44	$(PPU_LD) -o libyuv2rgb_spu.so -shared -soname=libyuv2rgb_spu.so yuv2rgb_spu-embed.o
45
46
47# bilin_scaler
48bilin_scaler_spu-embed.o: bilin_scaler.c spu_common.h
49	$(SPU_GCC) $(SPU_CFLAGS) -o bilin_scaler_spu bilin_scaler.c -lm
50	$(PPU_EMBEDSPU) -m32 bilin_scaler_spu bilin_scaler_spu bilin_scaler_spu-embed.o
51
52libbilin_scaler_spu.a: bilin_scaler_spu-embed.o
53	$(PPU_AR) -qcs libbilin_scaler_spu.a bilin_scaler_spu-embed.o
54
55libbilin_scaler_spu.so: bilin_scaler_spu-embed.o
56	$(PPU_LD) -o libbilin_scaler_spu.so -shared -soname=libbilin_scaler_spu.so bilin_scaler_spu-embed.o
57
58install: libfb_writer_spu.a libfb_writer_spu.so \
59				libyuv2rgb_spu.so libyuv2rgb_spu.a \
60				libbilin_scaler_spu.so libbilin_scaler_spu.a
61	$(INSTALL) -c -m 0755 libfb_writer_spu.so $(PREFIX)/.
62	$(INSTALL) -c -m 0655 libfb_writer_spu.a $(PREFIX)/.
63	$(INSTALL) -c -m 0755 libyuv2rgb_spu.so $(PREFIX)/.
64	$(INSTALL) -c -m 0655 libyuv2rgb_spu.a $(PREFIX)/.
65	$(INSTALL) -c -m 0755 libbilin_scaler_spu.so $(PREFIX)/.
66	$(INSTALL) -c -m 0655 libbilin_scaler_spu.a $(PREFIX)/.
67
68
69uninstall: $(PREFIX)/libfb_writer_spu.so $(PREFIX)/libfb_writer_spu.a \
70		$(PREFIX)/libyuv2rgb_spu.so $(PREFIX)/libyuv2rgb_spu.a \
71		$(PREFIX)/libbilin_scaler_spu.so $(PREFIX)/libbilin_scaler_spu.a
72	rm -f $(PREFIX)/libfb_writer_spu.a
73	rm -f $(PREFIX)/libfb_writer_spu.so
74	rm -f $(PREFIX)/libyuv2rgb_spu.so
75	rm -f $(PREFIX)/libyuv2rgb_spu.a
76	rm -f $(PREFIX)/libbilin_scaler_spu.so
77	rm -f $(PREFIX)/libbilin_scaler_spu.a
78
79
80clean:
81	rm -f bilin_scaler_spu-embed.o libbilin_scaler_spu.so libbilin_scaler_spu.a bilin_scaler_spu
82	rm -f yuv2rgb_spu-embed.o libyuv2rgb_spu.so libyuv2rgb_spu.a yuv2rgb_spu
83	rm -f fb_writer_spu-embed.o libfb_writer_spu.so libfb_writer_spu.a fb_writer_spu
84