TOPDIR=$(shell pwd)
SHAREDLIBS=$(TOPDIR)/../../sharedlibs

include $(SHAREDLIBS)/ar7def.mk

INSTALL=install

ifeq ($(HOSTNAME),lara)
IP=ip
else
IP=
endif

.PHONY: all install clean ip bridge

include config.mk

SUBDIRS=lib $(IP) tc $(BRIDGE)

all: config.mk
	$(MAKE) -f Makefile.iproute \
			CC=$(TARGET)-gcc \
			KERNEL_INCLUDE=$(GU_KERNEL_FILE)/include \
			XTRACFLAGS="$(PROJECTCFLAGS)" \
			SUBDIRS="$(SUBDIRS)" \
			all

install: all $(IP) $(BRIDGE)
	$(INSTALL) tc/tc $(TARGETFS)/sbin/tc
	$(TARGET)-strip -x $(TARGETFS)/sbin/tc

ip: | all
	$(INSTALL) ip/ip $(TARGETFS)/sbin/ip
	$(TARGET)-strip -x $(TARGETFS)/sbin/ip

bridge: | all
	$(INSTALL) bridge/bridge $(TARGETFS)/sbin/bridge
	$(TARGET)-strip -x $(TARGETFS)/sbin/bridge

real-clean: clean
maintainer-clean: clean

clean:
	$(MAKE) -f Makefile.iproute SUBDIRS="$(SUBDIRS)" clean
