#
#	OSEK/VDX Version. 2.2.3
#
#	Copyright (C) 2012
#	  by Kohei Matsumoto <kouhei_3hips@hotmail.com>
#
include .osek_config

cc		=	gcc
rm		=	rm

cflags	=	-g -D$(define) -D$(class) -D$(arch)

objs	=	kernel/alarm.o \
			kernel/event.o \
			kernel/hook.o \
			kernel/interrupt.o \
			kernel/osctl.o \
			kernel/resource.o \
			kernel/$(class)/task_mng.o \
			kernel/$(class)/task.o

# ARM Cortex-A9
ifeq ($(arch), CA9)
objs	+=	arch/ca9.o
endif

# Main Program
objs	+=	$(main)

izon	= include/*.h \
		  arch/*.h \
		  kernel/*.h \
		  kernel/$(class)/*.h \
		  Makefile

# make object
all: $(target)

$(target): $(objs)
	$(cc) -o $@ $(objs)

$(objs) : $(izon)

.c.o: $(objs)
	$(cc) -c $(cflags) -I./include $< -o$@

# osek configurator
config:
	@sh osek_config.sh

# start gdb
debug:
	@gdb --tui $(target)

# clean
clean:
	$(rm) -rf $(target)
	$(rm) -rf $(objs)
