# Simple Makefile
# Volker Oth (c) 1999


########### change this lines according to your project ##################

TRGDIR	= ../OBJ
LSTDIR  = ../LST
INCDIR	= .
LIBDIR	= $(AVR)/avr/lib
SHELL   = $(AVR)/bin/sh.exe

#put the name of the target mcu here (at90s8515, at90s8535, attiny22, atmega603 etc.)
    MCU = atmega103

#put the name of the target file here (without extension)
	TRG	= test

#put your C sourcefiles here 
	CSRC	= test.c os_cpu_c.c ucos_ii.c 

#put additional assembler source file here
	ASRC	= os_cpu_a.asm

#additional libraries and object files to link
	LIB	=

#additional includes to compile
	INC	= 
	
OBJ	= $(CSRC:%.c=$(TRGDIR)/%.o) $(ASRC:%.asm=$(TRGDIR)/%.o)	

#compiler flags
	CPFLAGS	= -g -O3 -Wall -Wstrict-prototypes -Wa,-ahlms=$(<:.c=.lst)

#linker flags
	LDFLAGS = -Wl,-Map=$(TRG).map,--cref
	
$(TRGDIR)/$(TRG).o: $(TRG).c
	$(CC) -c $(CPFLAGS) -I$(INCDIR) -o $@ $<

	$(AS) -c $(ASFLAGS) -I$(INCDIR) -o $@ $<
$(TRGDIR)/os_cpu_c.o: ../source/os_cpu_c.c
	$(CC) -c $(CPFLAGS) -I$(INCDIR) -o $@ $<

$(TRGDIR)/os_cpu_a.o: ../source/os_cpu_a.asm

$(TRGDIR)/ucos_ii.o: ../../../source/ucos_ii.c
	$(CC) -c $(CPFLAGS) -I$(INCDIR) -o $@ $<	
########### you should not need to change the following line #############
include $(AVR)/include/avr_make

###### dependecies, add any dependencies you need here ###################
$(TRG).o : $(TRG).c
