1 2obj-$(CONFIG_SPU_FS) += spufs.o 3spufs-y += inode.o file.o context.o syscalls.o coredump.o 4spufs-y += sched.o backing_ops.o hw_ops.o run.o gang.o 5spufs-y += switch.o fault.o lscsa_alloc.o 6 7# magic for the trace events 8CFLAGS_sched.o := -I$(src) 9 10# Rules to build switch.o with the help of SPU tool chain 11SPU_CROSS := spu- 12SPU_CC := $(SPU_CROSS)gcc 13SPU_AS := $(SPU_CROSS)gcc 14SPU_LD := $(SPU_CROSS)ld 15SPU_OBJCOPY := $(SPU_CROSS)objcopy 16SPU_CFLAGS := -O2 -Wall -I$(srctree)/include -D__KERNEL__ 17SPU_AFLAGS := -c -D__ASSEMBLY__ -I$(srctree)/include -D__KERNEL__ 18SPU_LDFLAGS := -N -Ttext=0x0 19 20$(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h 21clean-files := spu_save_dump.h spu_restore_dump.h 22 23# Compile SPU files 24 cmd_spu_cc = $(SPU_CC) $(SPU_CFLAGS) -c -o $@ $< 25quiet_cmd_spu_cc = SPU_CC $@ 26$(obj)/spu_%.o: $(src)/spu_%.c 27 $(call if_changed,spu_cc) 28 29# Assemble SPU files 30 cmd_spu_as = $(SPU_AS) $(SPU_AFLAGS) -o $@ $< 31quiet_cmd_spu_as = SPU_AS $@ 32$(obj)/spu_%.o: $(src)/spu_%.S 33 $(call if_changed,spu_as) 34 35# Link SPU Executables 36 cmd_spu_ld = $(SPU_LD) $(SPU_LDFLAGS) -o $@ $^ 37quiet_cmd_spu_ld = SPU_LD $@ 38$(obj)/spu_%: $(obj)/spu_%_crt0.o $(obj)/spu_%.o 39 $(call if_changed,spu_ld) 40 41# Copy into binary format 42 cmd_spu_objcopy = $(SPU_OBJCOPY) -O binary $< $@ 43quiet_cmd_spu_objcopy = OBJCOPY $@ 44$(obj)/spu_%.bin: $(src)/spu_% 45 $(call if_changed,spu_objcopy) 46 47# create C code from ELF executable 48cmd_hexdump = ( \ 49 echo "/*" ; \ 50 echo " * $*_dump.h: Copyright (C) 2005 IBM." ; \ 51 echo " * Hex-dump auto generated from $*.c." ; \ 52 echo " * Do not edit!" ; \ 53 echo " */" ; \ 54 echo "static unsigned int $*_code[] " \ 55 "__attribute__((__aligned__(128))) = {" ; \ 56 hexdump -v -e '"0x" 4/1 "%02x" "," "\n"' $< ; \ 57 echo "};" ; \ 58 ) > $@ 59quiet_cmd_hexdump = HEXDUMP $@ 60$(obj)/%_dump.h: $(obj)/%.bin 61 $(call if_changed,hexdump) 62