
# this one is executed from directory lwip2-src/src/

OBJ = \
	$(patsubst %.c,$(BUILD)/%.o,$(wildcard netif/ethernet.c)) \
	$(patsubst %.c,$(BUILD)/%.o,$(wildcard netif/ppp/*.c)) \
	$(patsubst %.c,$(BUILD)/%.o,$(wildcard core/*.c)) \
	$(patsubst %.c,$(BUILD)/%.o,$(wildcard core/ipv4/*.c)) \
	$(patsubst %.c,$(BUILD)/%.o,$(wildcard core/ipv6/*.c)) \
	$(patsubst %.c,$(BUILD)/%.o,$(wildcard api/*.c)) \
	$(patsubst %.c,$(BUILD)/%.o,$(wildcard apps/sntp/*.c)) \
	$(patsubst %.c,$(BUILD)/%.o,$(wildcard apps/mdns/*.c)) \
#	$(subst ../../lwip2-contrib-src/,contrib/, \
#		$(patsubst %.c,$(BUILD)/%.o,$(wildcard ../../lwip2-contrib-src/apps/ping/*.c)))

BUILD_INCLUDES = -I$(BUILD) -I$(SDK)/include -Iinclude -I../../glue -I../../glue-lwip -I../../glue-lwip/$(target)
#BUILD_INCLUDES += -I../../lwip2-contrib-src/apps/ping

all: patches $(LWIP_LIB)

patches: .patched

.patched:
	for p in ../../patches/*.patch; do echo "--------- APPLY PATCH $${p#../../}:"; patch -d .. -p1 < $$p; done
ifeq ($(target),open)
	patch -d .. -p1 < ../../patches/open/sdk-mem-macros.patch
endif
	touch .patched

include ../../makefiles/Makefile.defs
include ../../makefiles/Makefile.rules

-include $(BUILD)/*/*.d
-include $(BUILD)/*/*/*.d
-include $(BUILD)/*/*/*/*.d
