#**************************************************************************
#* FILE NAME: $RCSfile: makefile,v $         COPYRIGHT (c) FREESCALE 2006 *
#* DESCRIPTION:                                     All Rights Reserved   *
#* This is the makefile for eTPU engine position example programs.        *
#*========================================================================*
#* MAKE: GNU make        VERSION: 3.80                                    *
#* ORIGINAL AUTHOR: Geoff Emerson [r47354]                                *
#* $Log: makefile,v $
#* Revision 1.4  2009/01/14 11:10:15  r47354
#* Revised for Monaco and GCT.
#*
#* Revision 1.3  2009/01/08 12:10:21  r47354
#* Fix error in description
#*
#* Revision 1.2  2008/09/02 07:55:45  r47354
#* change del to rm
#*
#* Revision 1.1  2008/06/06 09:57:42  r47354
#* Initial revision
#*
#*
#*........................................................................*
#*************************************************************************/
VPATH = ../etpu_set2 ../utils ../mpc5500 ../etpu_set2/cpu ../tooth_gen

CC = dcc
AS = das
LD = dld
DEL = rm

CFLAGS = -tPPC5554EF -c -g -Xnested-interrupts -Xdebug-dwarf2 -I../etpu_set2 -I../mpc5500 -I../utils -I../etpu_set2/cpu -I.. -I../tooth_gen
LDFLAGS = -m2 -tPPC5554EF MPC563M_intram.dld
ASFLAGS = -tPPC5554EF
LIBS = -li -lchar -lc -lg

INC = mpc563m.h typedefs.h etpu_util.h makefile
OBJS = ../utils/etpu_util.o etpu_app_eng_pos.o ../mpc5500/fs_gpio.o crt0.o ../tooth_gen/etpu_toothgen.o eng_pos_etpu_gct_example.o

all: eng_pos_example.elf

eng_pos_example.elf : eng_pos_example.o $(OBJS) $(INC) MPC563M_intram.dld etpu_util.o
	cd ../utils && $(MAKE)
	cd ../tooth_gen && $(MAKE)
	cd ../mpc5500 && $(MAKE) gpio
	$(LD) $(LDFLAGS) eng_pos_example.o $(OBJS) $(LIBS) -o ${@F} > eng_pos_example.map
#	ddump -R eng_pos_example.elf -o eng_pos_example.s19

eng_pos_example.o : eng_pos_example.c etpu_app_eng_pos.h etpu_set2.h $(INC)
	$(CC) $(CFLAGS) $<

etpu_app_eng_pos.o : etpu_app_eng_pos.c etpu_app_eng_pos.h etpu_cam_auto.h etpu_crank_auto.h $(INC) etpu_util.o
	cd ../utils && $(MAKE)
	$(CC) $(CFLAGS) $<

eng_pos_etpu_gct_example.o : eng_pos_etpu_gct_example.c eng_pos_etpu_gct_example.h $(INC)
	$(CC) $(CFLAGS) $<

crt0.o: crt0.s makefile
	$(AS) $(ASFLAGS) -o $@ $<

clean:
	$(DEL) *.db *.ou1 *.blk *.db2 *.map *.hex *lst *.err *.elf __*.* *.o

clean_all:
	$(DEL) *.db *.ou1 *.blk *.db2 *.map *.hex *lst *.err *.elf __*.* *.o
	cd ../tooth_gen && $(MAKE) clean
	cd ../utils && $(MAKE) clean
	cd ../mpc5500 && $(MAKE) clean




