ifeq "$(ROOTDIR)" "" 
export ROOTDIR=$(shell while true; do if [ -f BaseVar.mk ]; then pwd;exit; else cd ..;fi;done;)
endif
include $(ROOTDIR)/.config
include $(ROOTDIR)/BaseVar.mk
.PHONY: all build clean distclean 
SRCDIR=$(CURDIR)/ebtables

export PATH:=$(TOOLCHAINS_PATH)/../${TARGET}/bin:$(PATH)
KERNEL_INCLUDES=$(KERNEL_DIR)
export KERNEL_INCLUDES
all:build

build:
	make -C $(SRCDIR) all

clean:
	-make -C $(SRCDIR) clean 

distclean:	
	-make -C $(SRCDIR) clean 
	rm -f configure
	
install:
#	-mkdir -p $(FSROOT)/usr/lib
#	-cp -Pf $(SRCDIR)/extensions/*.so $(FSROOT)/usr/lib
#	-cp -Pf $(SRCDIR)/*.so $(FSROOT)/usr/lib
	cp -Pf $(SRCDIR)/ebtables $(FSROOT)/usr/bin
#	-$(STRIP) $(FSROOT)/usr/lib/*ebt*.so*  $(FSROOT)/usr/bin/ebtables
	-$(STRIP) $(FSROOT)/usr/bin/ebtables
