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)/wget-1.10.1
	
ifeq ("$(CONFIG_OPENSOURCE_WGET_SSL)","y")
WITH_SSL = --with-ssl
else
WITH_SSL = --without-ssl
endif


all:configure build

configure:
	cd $(SRCDIR);\
	./configure --prefix=$(TMPDISTDIR) --host=$(TARGET) --disable-debug $(WITH_SSL)
	touch configure;
build:
	make -C $(SRCDIR) all 

clean:
	make -C $(SRCDIR) clean

distclean:
	make -C $(SRCDIR) distclean
	rm -f configure
	
install:
	rm -f $(FSROOT)/usr/bin/wget 
	cp $(SRCDIR)/src/wget $(FSROOT)/usr/bin/wget 
	$(STRIP) $(FSROOT)/usr/bin/wget
	
