ifndef COMPILING_WHOLE_TREE
TOPDIR=$(shell pwd)/../../..
endif


CC=mips-uclibc-gcc
STRIP=mips-uclibc-strip

INCLUDES = -I../libftdi-0.5/src -I../../libusb-0.1.7
LIBS= -lpthread  ../../libusb-0.1.7/.libs/libusb.so ../libftdi-0.5/src/.libs/libftdi.a
ifeq ($(DEBUG),1)
OPT = -g -O2
else
OPT = -O2
endif


CFLAGS += -Wall -W -g $(OPT)

all: test_ftdi test_ftdi2


test_ftdi: libftdi_example_bitbang2232.o
	$(CC) -o  $@  $(CFLAGS) libftdi_example_bitbang2232.o $(LIBS) 
	$(STRIP) test_ftdi
	@echo "make $@ finished on `date`"

test_ftdi2: test_ftdi_main.o
	$(CC) -o  $@  $(CFLAGS) test_ftdi_main.o $(LIBS) 
	$(STRIP) test_ftdi2
	@echo "make $@ finished on `date`"


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

clean:
	rm -f *.o test_ftdi test_ftdi2



release: all
	$(INSTALL) -o root -g root test_ftdi $(ROOT_FS_DIR)/usr/bin
	$(INSTALL) -o root -g root test_ftdi2 $(ROOT_FS_DIR)/usr/bin



