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)/curl-7.80.0
	
ifeq ("$(CONFIG_OPENSOURCE_CURL_SSL)","y")
WITH_SSL = --with-ssl=$(TMPDISTDIR)
else
WITH_SSL = --without-ssl
endif


all:configure build

configure:
	cd $(SRCDIR);\
	./configure --prefix=$(TMPDISTDIR) --host=$(TARGET)  $(WITH_SSL) --with-zlib=$(TMPDISTDIR) --disable-shared --disable-manual --disable-proxy \
	--disable-cookies --disable-ipv6 --disable-dict --disable-file  --disable-gopher \
	--disable-imap --disable-pop3 --disable-smtp --disable-telnet --disable-tftp --disable-rtsp 
	touch configure;
build:
	make -C $(SRCDIR) all 

clean:
	make -C $(SRCDIR) clean

distclean:
	make -C $(SRCDIR) distclean
	rm -f configure
	
install:
	rm -f $(FSROOT)/sbin/curl 
	cp $(SRCDIR)/src/curl $(FSROOT)/sbin
	$(STRIP) $(FSROOT)/sbin/curl