# kernel sources 
TOPDIR  := $(shell /bin/pwd)

ifndef KSRC
KSRC  := $(TOPDIR)/..
endif

include $(KSRC)/.config

CC := arm-none-linux-gnueabi-gcc
LD := arm-none-linux-gnueabi-ld

CFLAGS  := $(EXTRA_CFLAGS)
CFLAGS  += -I$(KSRC)/arch/arm/mach-mv88fxx81/LSP/cesa/ 

SUBDIRS=egigatool	 
TARGETS=mv_shell testusb
ifeq ($(CONFIG_MV_CESA),y)
TARGETS += mv_cesa_tool
endif
ifeq ($(CONFIG_MV_PHONE),y)
TARGETS += mv_voip_tool
endif


all : Makefile $(TARGETS)
	@for subdir in $(SUBDIRS); do \
                (cd $$subdir && $(MAKE) $@) || exit 1; \
        done
	
mv_shell : MV_shell.c 
	$(CC) $(CFLAGS) MV_shell.c -o MV_shell

mv_voip_tool: mv_voip_tool.c
	$(CC) $(CFLAGS) mv_voip_tool.c -o mv_voip_tool

mv_cesa_tool:mv_cesa_tool.c
	$(CC) $(CFLAGS) mv_cesa_tool.c -o mv_cesa_tool

testusb: testusb.c
	$(CC) $(CFLAGS) testusb.c -o testusb -lpthread

clean:
	rm -f MV_shell mv_cesa_tool mv_voip_tool testusb *.o
	@for subdir in $(SUBDIRS); do \
                (cd $$subdir && $(MAKE) $@) || exit 1; \
        done

