diff --git a/examples/lwip/Makefile b/examples/lwip/Makefile index 6158f82f..39a26a62 100644 --- a/examples/lwip/Makefile +++ b/examples/lwip/Makefile @@ -1,4 +1,9 @@ top_srcdir = ../.. +include_dir = $(top_srcdir)/include + +LIBCOAP_API_VERSION = $(shell sed -ne 's/^LIBCOAP_API_VERSION=\([0-9]\+\).*$$/\1/p' $(top_srcdir)/configure.ac) + +coap_include_dir = $(include_dir)/coap$(LIBCOAP_API_VERSION) WITH_LWIP_BRANCH=STABLE-2_0_3_RELEASE WITH_LWIP_CONTRIB_BRANCH=STABLE-2_0_1_RELEASE @@ -35,7 +40,8 @@ LWIPOBJS += mld6.o ip6.o icmp6.o ethip6.o nd6.o ip6_addr.o ip6_frag.o CFLAGS += -std=gnu99 -CFLAGS += -I$(top_srcdir)/include -I$(top_srcdir)/include/coap2 +# set path to coap_include_dir for lwippools.h +CFLAGS += -I$(top_srcdir)/include -I$(coap_include_dir) vpath %.c $(top_srcdir)/src @@ -47,18 +53,15 @@ CFLAGS += -Wno-unused-parameter CFLAGS += -Ilwip/src/include/ -Ilwip/src/include/ipv4/ -Ilwip-contrib/ports/unix/port/include/ -Ilwip-contrib/ports/unix/proj/minimal/ -# making an executable out of all of it - OBJS = server.o server-coap.o ${LWIPOBJS} ${COAPOBJS} -../../include/coap2/coap.h: - @echo "Error: coap.h not present. Run the autotools chain (\`./autogen.sh && ./configure\`) in the project root directory to build the required coap.h file." +$(coap_include_dir)/coap.h: + @echo "Error: $@ not present. Run the autotools chain (\`./autogen.sh && ./configure\`) in the project root directory to build the required coap.h file." @exit 1 -${OBJS}: lwip lwip-contrib ../../include/coap2/coap.h +${OBJS}: lwip lwip-contrib $(coap_include_dir)/coap.h server: ${OBJS} -# $(CC) ${OBJS} -o server -lrt clean: rm -f ${OBJS}