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-v2.0.9-2

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

build:
	echo $(KERNEL_INCLUDES)

	make -C $(SRCDIR) all

clean:
	-make -C $(SRCDIR) clean 

distclean:	
	-make -C $(SRCDIR) clean 
	rm -f configure
	
install:
	install -dv $(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
#	cp -pf $(SRCDIR)/ethertypes $(FSROOT)/etc
#	-$(STRIP) $(FSROOT)/usr/lib/*ebt*.so*  $(FSROOT)/usr/bin/ebtables
	-$(STRIP) $(FSROOT)/usr/bin/ebtables
#	-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
