
MAJOR = 0
MINOR = 0
RELEASE = 2
VERSION = $(MAJOR).$(MINOR).$(RELEASE)

# 디버깅 모드 - y, 릴리즈 모드 - n
DEBUG = y

CROSS = arm-linux-

CC = $(CROSS)gcc
LD = $(CROSS)ld
OC = $(CROSS)objcopy

TOPDIR = $(shell pwd)
INCLUDE = -nostdinc -I. -I$(TOPDIR)/include

CFLAGS = $(INCLUDE) -nostdinc -Wall -W -O3 -march=armv4 \
	 -mtune=arm9tdmi -fno-builtin -msoft-float -DDEBUG=$(DEBUG)

OCFLAGS = -O binary -R .note -R .comment -S

SRCS = head.S exceptions.S irqhandler.S swihandler.c printk.c timer.c uart.c main.c \
	fiqhandler.c aborthandler.c interrupt.c load_task.S tcb.c schedule.c string.c \
	led.S rtc.c
OBJS = head.o exceptions.o irqhandler.o swihandler.o printk.o timer.o uart.o main.o \
	fiqhandler.o aborthandler.o interrupt.o load_task.o tcb.o schedule.o string.o \
	led.o rtc.o

%.o : %.c
	$(CROSS)gcc $(CFLAGS) -c $<

%.o : %.S
	$(CROSS)gcc $(CFLAGS) -c $<

all : $(OBJS)
	@echo
	@echo "micro kernel theBlueKernel....."
	@echo
	$(LD) -o theBlueKernel.o $(OBJS) -Ttext 0x30100000 -N
	$(OC) theBlueKernel.o theBlueKernel $(OCFLAGS)

swihandler.o : swihandler.c
	$(CROSS)gcc $(CFLAGS) -DVERSION='"$(VERSION)"' -c $<
clean :
	rm -f *.o
	rm -f theBlueKernel
