#Makefile for rk kernel modules

#CPU = $(shell uname -m)
CPU = arm

CC = arm-linux-gcc


#ADD -DTHREADED_NET option to CFLAGS if you want receiver network reserve
#I did not add it on this version of Makefile

ifndef LINUXDIR
LINUXDIR = /home/gaurav/arm-linux
endif
LINUXINCLUDE=$(LINUXDIR)/include

#Attention!!! Pls add -DTHREADED_NET if you want to have rcv_net_reserve

CFLAGS = -I$(LINUXINCLUDE) -DMODULE  -DCONFIG_RK \
	-D__RK__ -D__arm__ -D__KERNEL__ -O2 -DDEBUG_RK\
	-DRSV_PROPAGATION \
	 -Wall -Wstrict-prototypes -fomit-frame-pointer  \
	 -msoft-float -fno-builtin
O_OBJS = misc.o cpu_reserve.o division.o mutex.o net_reserve.o reserve.o \
	resource_set.o rk_init.o rk_isr.o rk_procfs.o rk_sched.o \
	rt_process.o timer.o css_disk_cpu.o disk_reserve.o \
	pcp.o

ifeq ($(CPU),ppc)
O_OBJS += ppc_timer.o	
endif

ifeq ($(CPU), arm)
O_OBJS += arm_timer.o
endif

ifeq ($(CPU), i386)
O_OBJS += 8254.o
endif

all:	rk.o

rk.o:	$(O_OBJS)	
		arm-linux-ld -r -o rk.o $(O_OBJS)

#.c.o:
#	$(CC) $(CFLAGS) -c -o $@ $<

deps :$(O_OBJS:.o=.c)
	$(CC) $(CFLAGS) -M $(O_OBJS:.o=.c) > deps

clean:		
		rm -rf *.o

ifeq (deps,$(wildcard deps))
include deps
endif

