include $(ROOTDIR)/.config
include $(ROOTDIR)/BaseVar.mk
.PHONY: all build clean distclean 
SRCDIR=$(CURDIR)/bridge-utils-1.2
all:configure build
CFLAGS=-Os

ifeq ("$(CONFIG_IGMP_SNOOPING)","y")
CFLAGS +=-DCONFIG_IGMP_SNOOPING
endif

ifeq ("$(CONFIG_IGMP_VLAN)","y")
CFLAGS +=-DCONFIG_IGMP_VLAN
endif

ifeq ("$(CONFIG_BR_MLD_SNOOP)","y")
CFLAGS +=-DCONFIG_BR_MLD_SNOOP
endif

ifeq ("$(CONFIG_BR_DEL_FDB)","y")
CFLAGS +=-DCONFIG_BR_DEL_FDB
endif

export CFLAGS
configure:
	cd $(SRCDIR); \
	find  | xargs touch;\
	if [ ! -f configure ]; then \
	  autoconf; \
	fi; \
	./configure --prefix=$(TMPDISTDIR) --host=$(TARGET) --with-linux-headers=$(KERNEL_DIR)/include/;
	touch configure
build:
	make -C $(SRCDIR) all install
	#CFLAGS=${CFLAGS}; 

clean:
	cd $(SRCDIR); \
	make clean
distclean:	
	cd $(SRCDIR); \
	make distclean; 
	rm -f configure
	
install:
	cp $(TMPDISTDIR)/sbin/brctl $(FSROOT)/sbin/brctl
	$(STRIP) $(FSROOT)/sbin/brctl
