1all: tunslip6 echo-client echo-server monitor_15_4 coap-client dtls-client dtls-server throughput-client 2 3tunslip6: tunslip6.o 4 $(CC) -o $@ $(CFLAGS) $(LIBS) tunslip6.c 5 6echo-client: echo-client.o 7 $(CC) -o $@ $(CFLAGS) $(LIBS) echo-client.c 8 9echo-server: echo-server.o 10 $(CC) -o $@ $(CFLAGS) $(LIBS) echo-server.c 11 12throughput-client: throughput-client.o 13 $(CC) -o $@ $(CFLAGS) $(LIBS) throughput-client.c 14 15TINYDTLS = tinydtls-0.8.2 16TINYDTLS_CFLAGS = -I$(TINYDTLS) -DDTLSv12 -DWITH_SHA256 -DDTLS_ECC -DDTLS_PSK 17TINYDTLS_LIB = $(TINYDTLS)/libtinydtls.a 18 19MBEDTLS = mbedtls-2.4.0 20MBEDTLS_CFLAGS = -I$(MBEDTLS)/include 21MBEDTLS_LIB = $(MBEDTLS)/library/libmbedtls.a \ 22 $(MBEDTLS)/library/libmbedx509.a $(MBEDTLS)/library/libmbedcrypto.a 23 24$(TINYDTLS_LIB): 25 (cd tinydtls-0.8.2; ./configure; make) 26 27.PHONY: tinydtls 28tinydtls: $(TINYDTLS_LIB) 29 30$(MBEDTLS_LIB): 31 (cd mbedtls-2.4.0; make) 32 33.PHONY: mbedtls 34mbedtls: $(MBEDTLS_LIB) 35 36dtls-client.o: dtls-client.c 37 $(CC) -c -o $@ $(CFLAGS) $(MBEDTLS_CFLAGS) dtls-client.c 38 39dtls-client: dtls-client.o $(MBEDTLS_LIB) 40 $(CC) -o $@ $(LIBS) dtls-client.o $(MBEDTLS_LIB) 41 42dtls-server.o: dtls-server.c 43 $(CC) -c -o $@ $(CFLAGS) $(MBEDTLS_CFLAGS) dtls-server.c 44 45dtls-server: dtls-server.o $(MBEDTLS_LIB) 46 $(CC) -o $@ $(LIBS) dtls-server.o $(MBEDTLS_LIB) 47 48GLIB=`pkg-config --cflags --libs glib-2.0` 49 50monitor_15_4.o: monitor_15_4.c 51 $(CC) -c -o $@ $(CFLAGS) $(GLIB) monitor_15_4.c 52 53monitor_15_4: monitor_15_4.o 54 $(CC) -o $@ $(LIBS) monitor_15_4.o $(GLIB) 55 56LIBCOAP = libcoap 57LIBCOAP_CFLAGS = -I$(LIBCOAP)/include -I$(LIBCOAP) -DWITH_POSIX 58LIBCOAP_LIB = $(LIBCOAP)/.libs/libcoap-1.a 59 60$(LIBCOAP_LIB): 61 (cd libcoap; ./autogen.sh; ./configure --disable-documentation; make) 62 63.PHONY: libcoap 64libcoap: $(LIBCOAP_LIB) 65 66coap-client.o: coap-client.c libcoap tinydtls 67 $(CC) -c -o $@ $(CFLAGS) $(TINYDTLS_CFLAGS) $(LIBCOAP_CFLAGS) coap-client.c 68 69coap-client: coap-client.o $(TINYDTLS_LIB) $(LIBCOAP_LIB) 70 $(CC) -o $@ $(LIBS) coap-client.o $(TINYDTLS_LIB) $(LIBCOAP_LIB) 71 72.PHONY: clean-libcoap 73clean-libcoap: 74 (cd libcoap; make distclean) 75 76.PHONY: clean-tinydtls 77clean-tinydtls: 78 (cd tinydtls-0.8.2; make distclean) 79 80.PHONY: clean-mbedtls 81clean-mbedtls: 82 (cd mbedtls-2.4.0; make clean) 83 84clean: clean-libcoap clean-tinydtls clean-mbedtls 85 rm -f *.o tunslip6 tunslip echo-client echo-server dtls-client dtls-server monitor_15_4 coap-client throughput-client 86