#########################################################################
#
# Copyright (c) 2002 Xilinx, Inc.  All rights reserved.
#
# Xilinx, Inc.
# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A 
# COURTESY TO YOU.  BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
# ONE POSSIBLE   IMPLEMENTATION OF THIS FEATURE, APPLICATION OR 
# STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
# IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE 
# FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.  
# XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO 
# THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO 
# ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE 
# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY 
# AND FITNESS FOR A PARTICULAR PURPOSE.
# 
# File   : Makefile
# Date   : 2002, March 20.
# Company: Xilinx
#
# $Id: Makefile.sh,v 1.1.2.3 2003/04/01 01:07:13 mohan Exp $
#
############################################################################
# COMPILER=powerpc-eabi-gcc
# ARCHIVER=powerpc-eabi-ar
# CP=cp
COMPILER_FLAGS= -O2 -g -Wl,-defsym -Wl,_HEAP_SIZE=0 -Wl,-T -Wl,./klinker_script
COMPILER_FLAGST= -O2 -g -Wl,-defsym -Wl,_HEAP_SIZE=100 -Wl,-T -Wl,./klinker_script
COMPILER_FLAGS0= -O0 -g -Wl,-defsym -Wl,_HEAP_SIZE=600 -Wl,-T -Wl,./klinker_script
EXTRA_COMPILER_FLAGS0=-Wl,-defsym -Wl,_START_ADDR=0x00f00000
EXTRA_COMPILER_FLAGS1=-Wl,-defsym -Wl,_START_ADDR=0x00f10000
EXTRA_COMPILER_FLAGS2=-Wl,-defsym -Wl,_START_ADDR=0x00f20000
EXTRA_COMPILER_FLAGS3=-Wl,-defsym -Wl,_START_ADDR=0x00f30000
EXTRA_COMPILER_FLAGS4=-Wl,-defsym -Wl,_START_ADDR=0x00f40000
EXTRA_COMPILER_FLAGS5=-Wl,-defsym -Wl,_START_ADDR=0x00f50000
EXTRA_COMPILER_FLAGS6=-Wl,-defsym -Wl,_START_ADDR=0x00f60000
EXTRA_COMPILER_FLAGS7=-Wl,-defsym -Wl,_START_ADDR=0x00f70000
EXTRA_COMPILER_FLAGS8=-Wl,-defsym -Wl,_START_ADDR=0x00f80000

# RELEASEDIR=../../ppc405_i/code
# INCLUDEDIR=../../ppc405_i/include
# LIBDIR=../../ppc405_i/lib
# INCLUDES= -I${INCLUDEDIR} -I../xilkernel_ppc/include
# LIBS=-L${LIBDIR} -L.
TOPDIR = ../../..
SYSTEMDIR = ../../../../../..
INCLUDEDIR = $(SYSTEMDIR)/include
LIBDIR = ${SYSTEMDIR}/lib
INCLUDES = -I${TOPDIR}/include -I$(INCLUDEDIR)
LIBS = -L${LIBDIR} -L${TOPDIR}

EXECS=system0.elf system1.elf system2.elf system01.elf system11.elf system21.elf shell.elf print_thread.elf llist.elf producer.elf consumer.elf producer_nb.elf consumer_nb.elf testmfs.elf

FIRST_TASK=crt0.o

all: ${FIRST_TASK} $(EXECS)

crt0.o:
	${AR} -x ${LIBDIR}/libxil.a crt0.o

system0.elf: system0.c
	$(CC) system0.c -o system0.elf $(EXTRA_COMPILER_FLAGS0) $(COMPILER_FLAGS) $(INCLUDES) $(LIBS)

system1.elf: system1.c
	$(CC) system1.c -o system1.elf $(EXTRA_COMPILER_FLAGS1) $(COMPILER_FLAGS) $(INCLUDES) $(LIBS)

system2.elf: system2.c
	$(CC) system2.c -o system2.elf $(EXTRA_COMPILER_FLAGS2) $(COMPILER_FLAGS) $(INCLUDES) $(LIBS)

system01.elf: system01.c
	$(CC) system01.c -o system01.elf $(EXTRA_COMPILER_FLAGS0) $(COMPILER_FLAGS) $(INCLUDES) -lw  $(LIBS)

system11.elf: system11.c
	$(CC) system11.c -o system11.elf $(EXTRA_COMPILER_FLAGS1) $(COMPILER_FLAGS) $(INCLUDES) -lw  $(LIBS)

system21.elf: system21.c
	$(CC) system21.c -o system21.elf $(EXTRA_COMPILER_FLAGS2) $(COMPILER_FLAGS) $(INCLUDES) -lw  $(LIBS)

shell.elf: shell.c
	$(CC) shell.c -o shell.elf $(EXTRA_COMPILER_FLAGS3) $(COMPILER_FLAGS) $(INCLUDES) -lw  $(LIBS)

print_thread.elf: print_thread.c
	$(CC) print_thread.c -o print_thread.elf $(EXTRA_COMPILER_FLAGS4) $(COMPILER_FLAGST) $(INCLUDES) -lw  $(LIBS)

llist.elf: llist.c
	$(CC) llist.c -o llist.elf $(EXTRA_COMPILER_FLAGS5) $(COMPILER_FLAGS) $(INCLUDES) -lw  $(LIBS)

producer.elf: producer.c
	$(CC) producer.c -o producer.elf $(EXTRA_COMPILER_FLAGS6) $(COMPILER_FLAGS0) $(INCLUDES) -lw  $(LIBS)

consumer.elf: consumer.c
	$(CC) consumer.c -o consumer.elf $(EXTRA_COMPILER_FLAGS7) $(COMPILER_FLAGS0) $(INCLUDES) -lw  $(LIBS)

producer_nb.elf: producer_nb.c
	$(CC) producer_nb.c -o producer_nb.elf $(EXTRA_COMPILER_FLAGS6) $(COMPILER_FLAGS0) $(INCLUDES) -lw  $(LIBS)

consumer_nb.elf: consumer_nb.c
	$(CC) consumer_nb.c -o consumer_nb.elf $(EXTRA_COMPILER_FLAGS7) $(COMPILER_FLAGS0) $(INCLUDES) -lw  $(LIBS)

testmfs.elf: testmfsflashrom.c
	$(CC) testmfsflashrom.c -o testmfs.elf $(EXTRA_COMPILER_FLAGS8) $(COMPILER_FLAGS) $(INCLUDES) -lw  $(LIBS)

release: 
	${CP} $(EXECS) $(CODEDIR)

clean:
	rm -rf ${EXECS}

