
SDK=$(PREFIX)/xtensa-lx106-elf/sysroot/usr
LWIP14_INCLUDE_DIR=$(PREFIX)/../sdk/third_party/include
LWIP_LIB_RELEASE_DIR=$(SDK)/lib
LWIP_INCLUDES_RELEASE=$(SDK)/include/lwip2

$(shell makefiles/patch-vendor-lwip14 \
	$(LWIP14_INCLUDE_DIR) \
)

$(shell makefiles/patch-non-local-includes \
	$(PREFIX)/xtensa-lx106-elf/sysroot/usr/include \
)

%:
	for v6 in 0 1; do \
	for mss in 536 1460; do \
	for feat in 0 1; do \
		test \( $$feat = 0 \) -a \( $$v6 = 1 \) && continue; \
		featname= ;\
		test $$feat = 1 && featname=-feat ;\
		make -f makefiles/Makefile.build-lwip2 \
			target=open \
			DEFINE_TARGET=OPENSDK \
			SDK=$(SDK) \
			LWIP_ESP=$(LWIP14_INCLUDE_DIR) \
			LWIP_LIB=liblwip$$((2+4*v6))-$$mss$$featname.a \
			LWIP_LIB_RELEASE=$(LWIP_LIB_RELEASE_DIR)/liblwip$$((2+4*v6))-$$mss$$featname.a \
			LWIP_INCLUDES_RELEASE=$(LWIP_INCLUDES_RELEASE) \
			TOOLS=$(PREFIX)/bin/xtensa-lx106-elf- \
			TCP_MSS=$$mss LWIP_FEATURES=$$feat LWIP_IPV6=$$v6 \
			BUILD=build-$$mss$$featname-v$$((4+2*v6)) \
			$@ ; \
	done; done; done
