diff src/video/ps3/spulibs/Makefile @ 3154:95e48f7a3a93 gsoc2009_ps3

Added Makefile rule for spu programs. Added Readme.
author Martin Lowinski <martin@goldtopf.org>
date Mon, 10 Aug 2009 18:05:33 +0000
parents 104786a909a2
children abc49915ccb2
line wrap: on
line diff
--- a/src/video/ps3/spulibs/Makefile	Mon Aug 10 13:28:58 2009 +0000
+++ b/src/video/ps3/spulibs/Makefile	Mon Aug 10 18:05:33 2009 +0000
@@ -3,81 +3,74 @@
 
 # Toolchain
 SPU_GCC=/usr/bin/spu-gcc
-PPU_GCC=/usr/bin/gcc
 PPU_EMBEDSPU=/usr/bin/embedspu
 PPU_AR=/usr/bin/ar
 PPU_LD=/usr/bin/ld
-INSTALL=/usr/bin/install
-
+SPU_SRCDIR=$(srcdir)/src/video/ps3/spulibs
+SPU_LIBDIR=$(srcdir)/src/video/ps3/spulibs/libs
 SPU_CFLAGS=-g -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
 
-# Usually /usr/lib, depending on your distribution
-PREFIX=/usr/lib
-
-
-all: libfb_writer_spu.a libfb_writer_spu.so \
-				libyuv2rgb_spu.so libyuv2rgb_spu.a \
-				libbilin_scaler_spu.so libbilin_scaler_spu.a
-
 
-# fb_writer
-fb_writer_spu-embed.o: fb_writer.c spu_common.h
-	$(SPU_GCC) $(SPU_CFLAGS) -o fb_writer_spu fb_writer.c -lm
-	$(PPU_EMBEDSPU) -m32 fb_writer_spu fb_writer_spu fb_writer_spu-embed.o
+ps3libs: $(SPU_LIBDIR)/libfb_writer_spu.a $(SPU_LIBDIR)/libfb_writer_spu.so \
+				$(SPU_LIBDIR)/libyuv2rgb_spu.so $(SPU_LIBDIR)/libyuv2rgb_spu.a \
+				$(SPU_LIBDIR)/libbilin_scaler_spu.so $(SPU_LIBDIR)/libbilin_scaler_spu.a
 
-libfb_writer_spu.so: fb_writer_spu-embed.o
-	$(PPU_LD) -o libfb_writer_spu.so -shared -soname=libfb_writer_spu.so fb_writer_spu-embed.o
-
-libfb_writer_spu.a: fb_writer_spu-embed.o
-	$(PPU_AR) -qcs libfb_writer_spu.a fb_writer_spu-embed.o
+$(SPU_LIBDIR):
+	$(SHELL) $(auxdir)/mkinstalldirs $(SPU_LIBDIR)
 
-
-# yuv2rgb_converter
-yuv2rgb_spu-embed.o: yuv2rgb_converter.c spu_common.h
-	$(SPU_GCC) $(SPU_CFLAGS) -o yuv2rgb_spu yuv2rgb_converter.c -lm
-	$(PPU_EMBEDSPU) -m32 yuv2rgb_spu yuv2rgb_spu yuv2rgb_spu-embed.o
+# fb_writer (basically copying from a to b)
+$(SPU_LIBDIR)/fb_writer_spu-embed.o: $(SPU_LIBDIR) $(SPU_SRCDIR)/fb_writer.c $(SPU_SRCDIR)/spu_common.h
+	$(SPU_GCC) $(SPU_CFLAGS) -o $(SPU_LIBDIR)/fb_writer_spu $(SPU_SRCDIR)/fb_writer.c -lm
+	$(PPU_EMBEDSPU) -m32 fb_writer_spu $(SPU_LIBDIR)/fb_writer_spu $(SPU_LIBDIR)/fb_writer_spu-embed.o
 
-libyuv2rgb_spu.a: yuv2rgb_spu-embed.o
-	$(PPU_AR) -qcs libyuv2rgb_spu.a yuv2rgb_spu-embed.o
+$(SPU_LIBDIR)/libfb_writer_spu.a: $(SPU_LIBDIR)/fb_writer_spu-embed.o
+	$(PPU_AR) -qcs $(SPU_LIBDIR)/libfb_writer_spu.a $(SPU_LIBDIR)/fb_writer_spu-embed.o
 
-libyuv2rgb_spu.so: yuv2rgb_spu-embed.o
-	$(PPU_LD) -o libyuv2rgb_spu.so -shared -soname=libyuv2rgb_spu.so yuv2rgb_spu-embed.o
+$(SPU_LIBDIR)/libfb_writer_spu.so: $(SPU_LIBDIR)/fb_writer_spu-embed.o
+	$(PPU_LD) -o $(SPU_LIBDIR)/libfb_writer_spu.so -shared -soname=libfb_writer_spu.so $(SPU_LIBDIR)/fb_writer_spu-embed.o
 
 
-# bilin_scaler
-bilin_scaler_spu-embed.o: bilin_scaler.c spu_common.h
-	$(SPU_GCC) $(SPU_CFLAGS) -o bilin_scaler_spu bilin_scaler.c -lm
-	$(PPU_EMBEDSPU) -m32 bilin_scaler_spu bilin_scaler_spu bilin_scaler_spu-embed.o
-
-libbilin_scaler_spu.a: bilin_scaler_spu-embed.o
-	$(PPU_AR) -qcs libbilin_scaler_spu.a bilin_scaler_spu-embed.o
+# yuv2rgb_converter (converting YV12/IYUV to RGB)
+$(SPU_LIBDIR)/yuv2rgb_spu-embed.o: $(SPU_LIBDIR) $(SPU_SRCDIR)/yuv2rgb_converter.c $(SPU_SRCDIR)/spu_common.h
+	$(SPU_GCC) $(SPU_CFLAGS) -o $(SPU_LIBDIR)/yuv2rgb_spu $(SPU_SRCDIR)/yuv2rgb_converter.c -lm
+	$(PPU_EMBEDSPU) -m32 yuv2rgb_spu $(SPU_LIBDIR)/yuv2rgb_spu $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
 
-libbilin_scaler_spu.so: bilin_scaler_spu-embed.o
-	$(PPU_LD) -o libbilin_scaler_spu.so -shared -soname=libbilin_scaler_spu.so bilin_scaler_spu-embed.o
+$(SPU_LIBDIR)/libyuv2rgb_spu.a: $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
+	$(PPU_AR) -qcs $(SPU_LIBDIR)/libyuv2rgb_spu.a $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
 
-install: libfb_writer_spu.a libfb_writer_spu.so \
-				libyuv2rgb_spu.so libyuv2rgb_spu.a \
-				libbilin_scaler_spu.so libbilin_scaler_spu.a
-	$(INSTALL) -c -m 0755 libfb_writer_spu.so $(PREFIX)/.
-	$(INSTALL) -c -m 0655 libfb_writer_spu.a $(PREFIX)/.
-	$(INSTALL) -c -m 0755 libyuv2rgb_spu.so $(PREFIX)/.
-	$(INSTALL) -c -m 0655 libyuv2rgb_spu.a $(PREFIX)/.
-	$(INSTALL) -c -m 0755 libbilin_scaler_spu.so $(PREFIX)/.
-	$(INSTALL) -c -m 0655 libbilin_scaler_spu.a $(PREFIX)/.
+$(SPU_LIBDIR)/libyuv2rgb_spu.so: $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
+	$(PPU_LD) -o $(SPU_LIBDIR)/libyuv2rgb_spu.so -shared -soname=libyuv2rgb_spu.so $(SPU_LIBDIR)/yuv2rgb_spu-embed.o
 
 
-uninstall: $(PREFIX)/libfb_writer_spu.so $(PREFIX)/libfb_writer_spu.a \
-		$(PREFIX)/libyuv2rgb_spu.so $(PREFIX)/libyuv2rgb_spu.a \
-		$(PREFIX)/libbilin_scaler_spu.so $(PREFIX)/libbilin_scaler_spu.a
-	rm -f $(PREFIX)/libfb_writer_spu.a
-	rm -f $(PREFIX)/libfb_writer_spu.so
-	rm -f $(PREFIX)/libyuv2rgb_spu.so
-	rm -f $(PREFIX)/libyuv2rgb_spu.a
-	rm -f $(PREFIX)/libbilin_scaler_spu.so
-	rm -f $(PREFIX)/libbilin_scaler_spu.a
+# bilin_scaler (scaling bilinear YV12/IYUV pictures with resolutions /16)
+$(SPU_LIBDIR)/bilin_scaler_spu-embed.o: $(SPU_LIBDIR) $(SPU_SRCDIR)/bilin_scaler.c $(SPU_SRCDIR)/spu_common.h
+	$(SPU_GCC) $(SPU_CFLAGS) -o $(SPU_LIBDIR)/bilin_scaler_spu $(SPU_SRCDIR)/bilin_scaler.c -lm
+	$(PPU_EMBEDSPU) -m32 bilin_scaler_spu $(SPU_LIBDIR)/bilin_scaler_spu $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
+
+$(SPU_LIBDIR)/libbilin_scaler_spu.a: $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
+	$(PPU_AR) -qcs $(SPU_LIBDIR)/libbilin_scaler_spu.a $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
+
+$(SPU_LIBDIR)/libbilin_scaler_spu.so: $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
+	$(PPU_LD) -o $(SPU_LIBDIR)/libbilin_scaler_spu.so -shared -soname=libbilin_scaler_spu.so $(SPU_LIBDIR)/bilin_scaler_spu-embed.o
 
 
-clean:
-	rm -f bilin_scaler_spu-embed.o libbilin_scaler_spu.so libbilin_scaler_spu.a bilin_scaler_spu
-	rm -f yuv2rgb_spu-embed.o libyuv2rgb_spu.so libyuv2rgb_spu.a yuv2rgb_spu
-	rm -f fb_writer_spu-embed.o libfb_writer_spu.so libfb_writer_spu.a fb_writer_spu
+ps3libs-install: $(SPU_LIBDIR)/libfb_writer_spu.a $(SPU_LIBDIR)/libfb_writer_spu.so \
+				$(SPU_LIBDIR)/libyuv2rgb_spu.so $(SPU_LIBDIR)/libyuv2rgb_spu.a \
+				$(SPU_LIBDIR)/libbilin_scaler_spu.so $(SPU_LIBDIR)/libbilin_scaler_spu.a
+	$(INSTALL) -c -m 0755 $(SPU_LIBDIR)/libfb_writer_spu.so $(DESTDIR)$(libdir)/.
+	$(INSTALL) -c -m 0655 $(SPU_LIBDIR)/libfb_writer_spu.a $(DESTDIR)$(libdir)/.
+	$(INSTALL) -c -m 0755 $(SPU_LIBDIR)/libyuv2rgb_spu.so $(DESTDIR)$(libdir)/.
+	$(INSTALL) -c -m 0655 $(SPU_LIBDIR)/libyuv2rgb_spu.a $(DESTDIR)$(libdir)/.
+	$(INSTALL) -c -m 0755 $(SPU_LIBDIR)/libbilin_scaler_spu.so $(DESTDIR)$(libdir)/.
+	$(INSTALL) -c -m 0655 $(SPU_LIBDIR)/libbilin_scaler_spu.a $(DESTDIR)$(libdir)/.
+
+ps3libs-uninstall:
+	rm -f $(DESTDIR)$(libdir)/libfb_writer_spu.a
+	rm -f $(DESTDIR)$(libdir)/libfb_writer_spu.so
+	rm -f $(DESTDIR)$(libdir)/libyuv2rgb_spu.so
+	rm -f $(DESTDIR)$(libdir)/libyuv2rgb_spu.a
+	rm -f $(DESTDIR)$(libdir)/libbilin_scaler_spu.so
+	rm -f $(DESTDIR)$(libdir)/libbilin_scaler_spu.a
+
+ps3libs-clean:
+	rm -f $(SPU_LIBDIR)/*