191edfa49Sarnd@arndb.deobj-y += switch.o
291edfa49Sarnd@arndb.de
367207b96SArnd Bergmannobj-$(CONFIG_SPU_FS) += spufs.o
4bf1ab978SDwayne Grant McConnellspufs-y += inode.o file.o context.o syscalls.o coredump.o
56263203eSArnd Bergmannspufs-y += sched.o backing_ops.o hw_ops.o run.o gang.o
65473af04SMark Nutter
705b84117SMark Nutter# Rules to build switch.o with the help of SPU tool chain
805b84117SMark NutterSPU_CROSS	:= spu-
905b84117SMark NutterSPU_CC		:= $(SPU_CROSS)gcc
1005b84117SMark NutterSPU_AS		:= $(SPU_CROSS)gcc
1105b84117SMark NutterSPU_LD		:= $(SPU_CROSS)ld
1205b84117SMark NutterSPU_OBJCOPY	:= $(SPU_CROSS)objcopy
1337950718Sarnd@arndb.deSPU_CFLAGS	:= -O2 -Wall -I$(srctree)/include \
1437950718Sarnd@arndb.de		   -I$(objtree)/include2 -D__KERNEL__
1537950718Sarnd@arndb.deSPU_AFLAGS	:= -c -D__ASSEMBLY__ -I$(srctree)/include \
1637950718Sarnd@arndb.de		   -I$(objtree)/include2 -D__KERNEL__
1705b84117SMark NutterSPU_LDFLAGS	:= -N -Ttext=0x0
1805b84117SMark Nutter
195473af04SMark Nutter$(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h
206e18b27bSMasato Noguchiclean-files := spu_save_dump.h spu_restore_dump.h
2105b84117SMark Nutter
2205b84117SMark Nutter# Compile SPU files
2305b84117SMark Nutter      cmd_spu_cc = $(SPU_CC) $(SPU_CFLAGS) -c -o $@ $<
2405b84117SMark Nutterquiet_cmd_spu_cc = SPU_CC  $@
2505b84117SMark Nutter$(obj)/spu_%.o: $(src)/spu_%.c
2605b84117SMark Nutter	$(call if_changed,spu_cc)
2705b84117SMark Nutter
2805b84117SMark Nutter# Assemble SPU files
2905b84117SMark Nutter      cmd_spu_as = $(SPU_AS) $(SPU_AFLAGS) -o $@ $<
3005b84117SMark Nutterquiet_cmd_spu_as = SPU_AS  $@
3105b84117SMark Nutter$(obj)/spu_%.o: $(src)/spu_%.S
3205b84117SMark Nutter	$(call if_changed,spu_as)
3305b84117SMark Nutter
3405b84117SMark Nutter# Link SPU Executables
3505b84117SMark Nutter      cmd_spu_ld = $(SPU_LD) $(SPU_LDFLAGS) -o $@ $^
3605b84117SMark Nutterquiet_cmd_spu_ld = SPU_LD  $@
3705b84117SMark Nutter$(obj)/spu_%: $(obj)/spu_%_crt0.o $(obj)/spu_%.o
3805b84117SMark Nutter	$(call if_changed,spu_ld)
3905b84117SMark Nutter
4005b84117SMark Nutter# Copy into binary format
4105b84117SMark Nutter      cmd_spu_objcopy = $(SPU_OBJCOPY) -O binary $< $@
4205b84117SMark Nutterquiet_cmd_spu_objcopy = OBJCOPY $@
4305b84117SMark Nutter$(obj)/spu_%.bin: $(src)/spu_%
4405b84117SMark Nutter	$(call if_changed,spu_objcopy)
4505b84117SMark Nutter
4605b84117SMark Nutter# create C code from ELF executable
4705b84117SMark Nuttercmd_hexdump   = ( \
4805b84117SMark Nutter		echo "/*" ; \
4905b84117SMark Nutter		echo " * $*_dump.h: Copyright (C) 2005 IBM." ; \
5005b84117SMark Nutter		echo " * Hex-dump auto generated from $*.c." ; \
5105b84117SMark Nutter		echo " * Do not edit!" ; \
5205b84117SMark Nutter		echo " */" ; \
5337950718Sarnd@arndb.de		echo "static unsigned int $*_code[] " \
5437950718Sarnd@arndb.de			"__attribute__((__aligned__(128))) = {" ; \
55462c853eSArnd Bergmann		hexdump -v -e '"0x" 4/1 "%02x" "," "\n"' $< ; \
5605b84117SMark Nutter		echo "};" ; \
5705b84117SMark Nutter		) > $@
5805b84117SMark Nutterquiet_cmd_hexdump = HEXDUMP $@
5905b84117SMark Nutter$(obj)/%_dump.h: $(obj)/%.bin
6005b84117SMark Nutter	$(call if_changed,hexdump)
61