#
# define      description
# ------      ------------------------------------------------------
# DEBUG       enable debugging statements
# DEBUG_ERROR enable only error messages
# DUMP_PACKET display receive/transmit packet contents

include $(ROOT)/usr/include/make/NGdefs

OPTIMIZER = -O2

# enable debugging support
ifdef DEBUG
LCDEFS += -DUE_DEBUG -DAX_DEBUG
endif

ifdef DEBUG_ERROR
LCDEFS += -DUE_DEBUG_ERROR -DAX_DEBUG_ERROR
endif

# enable packet dumping
ifdef DUMP_PACKET
LCDEFS += -DDUMP_PACKET
endif

LCDEFS += -DIOP_OS

TARGETS += usbeth.elf

CFILES  += usbeth.c ax.c
HFILES  += ax.h ax_defs.h

LLDLIBS += -lusb -lioslibc -lios	
LLDOPTS += -Tddr.link

default: $(TARGETS)

usbeth.elf: $(CRT0) $(OBJECTS)
	$(CC) $(CFLAGS) -Ttext $(MK_USBETH_START) -o $@ $^ $(LDFLAGS) $(LDLIBS) 


install: exports install_src
	$(INSTALL) $(TARGETS) $(ROOT)/usr/bin/rvl

install_src: $(SRCS)
	-mkdir -p $(ROOT)/usr/src/os/usbeth
	$(INSTALL) -m 644 $(CFILES) $(HFILES) $(ROOT)/usr/src/os/usbeth
	$(INSTALL) -m 644 Makefile.example $(ROOT)/usr/src/os/usbeth/Makefile

exports: $(TARGETS)
	$(INSTALL) $(TARGETS) $(ROOT)/usr/bin/rvl

include $(COMMONRULES)

