SOURCE=iptables-1.4.14

.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 -C $(SOURCE)

$(SOURCE)/.configured: 
	[ "$$PJ_PREFIX" != "" ]
	[ "$$PJ_TARGET" != "" ]
	[ "$$PJ_HOST" != "" ]
	cd $(SOURCE) \
	&& ./configure \
	--prefix=$(PJ_PREFIX) \
	--host=$(PJ_TARGET) \
	--disable-largefile \
	--disable-ipv6
	touch $(SOURCE)/.configured

PREFIX_INITDIR := $(PJ_PREFIX)/etc/rc.d/init.d
install: openSource
	make -C $(SOURCE) install
	install -d -m 755 $(PREFIX_INITDIR)/
	install -m 755 sbin/firewall_without_ipv6.sh $(PREFIX_INITDIR)/firewall.sh
	#install -m 755 sbin/firewall.sh $(PREFIX_INITDIR)/
