ifndef COMPILING_WHOLE_TREE
TOPDIR:=$(shell pwd)
TOPDIR:=$(shell dirname $(TOPDIR))
TOPDIR:=$(shell dirname $(TOPDIR))
TOPDIR:=$(shell dirname $(TOPDIR))
TOPDIR:=$(shell dirname $(TOPDIR))
TOPDIR:=$(shell dirname $(TOPDIR))
endif
include $(TOPDIR)/Rules.make

KDIR:=$(TOPDIR)/linux

include $(KDIR)/.config
include $(KDIR)/arch/mips/Makefile

HPATH = $(KDIR)/include

DEFS =    -DCONFIG_BLUEZ_HCIUART_H4=1 -DCONFIG_BLUEZ_HCIUART_BCSP=1 -DCONFIG_BLUEZ_HCIUART_BCSP_TXCRC=1

MODULES = hci_uart.o hci_vhci.o hci_usb.o

CFLAGS := $(CFLAGS) $(DEFS) -O2 -DMODULE -D__KERNEL__ -I. -I../include -I$(HPATH) \
         -Wall -Wstrict-prototypes -fomit-frame-pointer -fno-strict-aliasing \
         -mlong-calls

hci_uart_OBJS = hci_ldisc.o hci_h4.o hci_bcsp.o

all : $(MODULES)

hci_uart.o : $(hci_uart_OBJS)
	$(LD) $(LDFLAGS) -r -o hci_uart.o $(hci_uart_OBJS)

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

clean :
	rm -f *.o
