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)/zebra-0.95a
#CC=gcc
#LD=ld
#CPP=cpp
#AR=ar
all:configure build
configure:
	cd $(SRCDIR); \
	find | xargs touch;\
	./configure --prefix=$(TMPDISTDIR) --host=$(TARGET) --disable-FEATURE --disable-ipv6 --disable-bgpd --disable-ripngd --disable-ospfd --disable-ospf6d --disable-bgp-announce 
	touch configure
build:
	make -C $(SRCDIR)
clean:
	if [ -d "$(SRCDIR)" ]; then \
		cd $(SRCDIR); \
		make clean;  \
	fi
distclean:
	-if [ -d "$(SRCDIR)" ]; then \
		cd $(SRCDIR); \
		make distclean; \
	fi

	rm -f configure

install:
	-if [ -d "$(SRCDIR)" ]; then \
		cd $(SRCDIR); \
		make install; \
	fi
	
	cp $(TMPDISTDIR)/sbin/zebra $(FSROOT)/sbin/zebra
	$(STRIP) $(FSROOT)/sbin/zebra
	cp $(TMPDISTDIR)/sbin/ripd $(FSROOT)/sbin/ripd
	$(STRIP) $(FSROOT)/sbin/ripd

