19682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# This Makefile is for building the CELL BE SPU libs
29682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# libfb_writer_spu.so, libyuv2rgb_spu.so, libbilin_scaler_spu.so
39682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
49682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# Toolchain
59682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallSPU_GCC=/usr/bin/spu-gcc
69682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallPPU_GCC=/usr/bin/gcc
79682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallPPU_EMBEDSPU=/usr/bin/embedspu
89682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallPPU_AR=/usr/bin/ar
99682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallPPU_LD=/usr/bin/ld
109682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallINSTALL=/usr/bin/install
119682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
129682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallSPU_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
139682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
149682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# Usually /usr/lib, depending on your distribution
159682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse HallPREFIX=/usr/lib
169682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
179682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
189682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallall: libfb_writer_spu.a libfb_writer_spu.so \
199682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall				libyuv2rgb_spu.so libyuv2rgb_spu.a \
209682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall				libbilin_scaler_spu.so libbilin_scaler_spu.a
219682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
229682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
239682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# fb_writer
249682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallfb_writer_spu-embed.o: fb_writer.c spu_common.h
259682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(SPU_GCC) $(SPU_CFLAGS) -o fb_writer_spu fb_writer.c -lm
269682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(PPU_EMBEDSPU) -m32 fb_writer_spu fb_writer_spu fb_writer_spu-embed.o
279682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
289682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halllibfb_writer_spu.so: fb_writer_spu-embed.o
299682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(PPU_LD) -o libfb_writer_spu.so -shared -soname=libfb_writer_spu.so fb_writer_spu-embed.o
309682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
319682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halllibfb_writer_spu.a: fb_writer_spu-embed.o
329682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(PPU_AR) -qcs libfb_writer_spu.a fb_writer_spu-embed.o
339682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
349682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
359682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# yuv2rgb_converter
369682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallyuv2rgb_spu-embed.o: yuv2rgb_converter.c spu_common.h
379682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(SPU_GCC) $(SPU_CFLAGS) -o yuv2rgb_spu yuv2rgb_converter.c -lm
389682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(PPU_EMBEDSPU) -m32 yuv2rgb_spu yuv2rgb_spu yuv2rgb_spu-embed.o
399682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
409682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halllibyuv2rgb_spu.a: yuv2rgb_spu-embed.o
419682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(PPU_AR) -qcs libyuv2rgb_spu.a yuv2rgb_spu-embed.o
429682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
439682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halllibyuv2rgb_spu.so: yuv2rgb_spu-embed.o
449682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(PPU_LD) -o libyuv2rgb_spu.so -shared -soname=libyuv2rgb_spu.so yuv2rgb_spu-embed.o
459682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
469682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
479682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall# bilin_scaler
489682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallbilin_scaler_spu-embed.o: bilin_scaler.c spu_common.h
499682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(SPU_GCC) $(SPU_CFLAGS) -o bilin_scaler_spu bilin_scaler.c -lm
509682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(PPU_EMBEDSPU) -m32 bilin_scaler_spu bilin_scaler_spu bilin_scaler_spu-embed.o
519682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
529682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halllibbilin_scaler_spu.a: bilin_scaler_spu-embed.o
539682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(PPU_AR) -qcs libbilin_scaler_spu.a bilin_scaler_spu-embed.o
549682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
559682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halllibbilin_scaler_spu.so: bilin_scaler_spu-embed.o
569682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(PPU_LD) -o libbilin_scaler_spu.so -shared -soname=libbilin_scaler_spu.so bilin_scaler_spu-embed.o
579682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
589682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallinstall: libfb_writer_spu.a libfb_writer_spu.so \
599682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall				libyuv2rgb_spu.so libyuv2rgb_spu.a \
609682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall				libbilin_scaler_spu.so libbilin_scaler_spu.a
619682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(INSTALL) -c -m 0755 libfb_writer_spu.so $(PREFIX)/.
629682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(INSTALL) -c -m 0655 libfb_writer_spu.a $(PREFIX)/.
639682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(INSTALL) -c -m 0755 libyuv2rgb_spu.so $(PREFIX)/.
649682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(INSTALL) -c -m 0655 libyuv2rgb_spu.a $(PREFIX)/.
659682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(INSTALL) -c -m 0755 libbilin_scaler_spu.so $(PREFIX)/.
669682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	$(INSTALL) -c -m 0655 libbilin_scaler_spu.a $(PREFIX)/.
679682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
689682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
699682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Halluninstall: $(PREFIX)/libfb_writer_spu.so $(PREFIX)/libfb_writer_spu.a \
709682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		$(PREFIX)/libyuv2rgb_spu.so $(PREFIX)/libyuv2rgb_spu.a \
719682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall		$(PREFIX)/libbilin_scaler_spu.so $(PREFIX)/libbilin_scaler_spu.a
729682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	rm -f $(PREFIX)/libfb_writer_spu.a
739682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	rm -f $(PREFIX)/libfb_writer_spu.so
749682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	rm -f $(PREFIX)/libyuv2rgb_spu.so
759682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	rm -f $(PREFIX)/libyuv2rgb_spu.a
769682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	rm -f $(PREFIX)/libbilin_scaler_spu.so
779682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	rm -f $(PREFIX)/libbilin_scaler_spu.a
789682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
799682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall
809682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hallclean:
819682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	rm -f bilin_scaler_spu-embed.o libbilin_scaler_spu.so libbilin_scaler_spu.a bilin_scaler_spu
829682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	rm -f yuv2rgb_spu-embed.o libyuv2rgb_spu.so libyuv2rgb_spu.a yuv2rgb_spu
839682c8870b8ff5e4ac2e4c70b759f791c6f38c1fJesse Hall	rm -f fb_writer_spu-embed.o libfb_writer_spu.so libfb_writer_spu.a fb_writer_spu
84