ifeq "$(COMPILATION_BITS)"  "32"
	PPU_CFLAGS = -m32
	NBITS =
else
	PPU_CFLAGS = -m64
	NBITS = 64
endif

ifeq "$(HOSTTYPE)"  "powerpc"
	SYSROOT = 
else
	SYSROOT = /opt/cell/sysroot
endif

CC=gcc
SPU_CFLAGS  = -Wall -I$(SYSROOT)/usr/spu/include/trace -Dmain=_pdt_main -Dexit=_pdt_exit -DMFCIO_TRACE -DLIBSYNC_TRACE
PPU_CFLAGS += -Wall -I$(SYSROOT)/usr/include/trace -mabi=altivec -DLIBSYNC_TRACE
SPU_LDFLAGS = -L$(SYSROOT)/usr/spu/lib/trace -ltrace
PPU_LDFLAGS = -lspe2

all: spe_test test

install:


spe_test: spe_test.o
	spu-$(CC) -O spe_test.o -o $@ $(SPU_CFLAGS) $(SPU_LDFLAGS)

spe_test.o:
	spu-$(CC) -O spe_test.c -c $(SPU_CFLAGS)

test: test.o
	ppu-$(CC) -O test.o -o $@ $(PPU_CFLAGS) $(PPU_LDFLAGS)
	
test.o:
	ppu-$(CC) -O test.c -c $(PPU_CFLAGS)

clean:
	-rm spe_test.o test.o spe_test test
