ARCH := ppc
LOAD_ADDR = 0x040000
UBOOTHOME = /project/ben/u-boot-1.1.4
CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
OBJCOPY = $(CROSS_COMPILE)objcopy
OBJDUMP = $(CROSS_COMPILE)objdump

#export	CROSS_COMPILE = /project/native_e500/installed_gcc-3.4.3/bin/
#export	CROSS_COMPILE = /embedded/mpc_85xx/bin/powerpc-linux-
#export	CROSS_COMPILE = /opt/mtwk/gcc-3.3.e500-glibc-2.3.2-linuxspe/bin/powerpc-linux-gnuspe-
#export	CROSS_COMPILE = /opt/mtwk/gcc-3.4.3-e500-glibc-2.3.3-spe/bin/powerpc-linux-gnuspe-
export CROSS_COMPILE	= /opt/mtwk/usr/local/gcc-3_4-e500-glibc-2.3.4-dp/powerpc-linux-gnuspe/bin/powerpc-linux-gnuspe-


COPTS = -c -g  -Os  -mrelocatable -Wa,-me500 -fno-builtin -pipe -mstring -meabi -ffixed-r14 -ffixed-r2 -ffixed-r29
CONFIGOPTS = -DUBOOT  -DCFG_TLB_AND_LAW

INCLUDES = -I$(UBOOTHOME)/include
 

CFLAGS = $(COPTS) $(CONFIGOPTS)  $(INCLUDES)

OBJ = objects

##this file is extracted from the examples directory of the u-boot directory
LIB	= libstubs.a

$(OBJ)/%.o : source/%.c source/rio_bringup.h source/rio_regs.h
	$(CC) $(CFLAGS)  -c $< -o $@



host: $(OBJ)/main.o $(OBJ)/rio_discovery.o $(OBJ)/rio_setup.o $(OBJ)/rio_boot.o $(OBJ)/srio_dbs.o $(OBJ)/srio_msgs.o $(OBJ)/rio_tests.o $(OBJ)/rio_local_cfg.o 
	$(LD)  -g -Ttext $(LOAD_ADDR) -e main -o main   $(OBJ)/main.o $(OBJ)/rio_discovery.o $(OBJ)/rio_setup.o $(OBJ)/rio_boot.o $(OBJ)/rio_tests.o $(OBJ)/srio_dbs.o $(OBJ)/srio_msgs.o $(OBJ)/rio_local_cfg.o $(LIB)
	$(OBJCOPY) -O srec main srio_bringup.srec
	$(OBJCOPY) -O binary main srio_bringup.bin
	$(OBJDUMP) -f main
	$(OBJDUMP) -DS main > disassemble

	cp srio_bringup.bin /tftpboot/srio
	rm main

all:	host

clean: 
	rm $(OBJ)/*.o
	rm *.srec
	rm *.bin







