SOURCE=stunnel-4.21
TARGET=arm-linux
#TARGET=mipsel-linux-uclibc

.PHONY: all clean distclean openSource install
all: openSource
clean:
	make -C $(SOURCE) clean

distclean:
	make -C $(SOURCE) distclean
	rm -f $(SOURCE)/.configured

openSource: $(SOURCE)/.configured
	make CC=$(TARGET)-gcc -C $(SOURCE)

$(SOURCE)/.configured:
	cd $(SOURCE) \
		&& LDFLAGS='-s' CFLAGS='-Os' ./configure \
			--host=$(TARGET) \
			--with-ssl=$(PROJ_ROOT)/source/open/openssl/openssl-0.9.8g \
  			--with-random=/dev/random  \
			--disable-nls
	touch $(SOURCE)/.configured

install: $(SOURCE)/.configured
	make -C $(SOURCE) install-strip
