1# Makefile for libcoap standalone examples 2# 3# Copyright (C) 2021 Olaf Bergmann <bergmann@tzi.org> 4# 5# This file is part of the CoAP C library libcoap. Please see README and 6# COPYING for terms of use. 7 8# Set external variable LIBCOAP if you need a specific libcoap library. 9# E.g. libcoap-3-openssl, libcoap-3-gnutls, libcoap-3-mbedtls or libcoap-3-notls 10# 11LIBCOAP?=libcoap-3 12 13WARNING_CFLAGS= \ 14 -pedantic \ 15 -Wall \ 16 -Wcast-qual \ 17 -Wextra \ 18 -Wformat-security \ 19 -Winline \ 20 -Wmissing-declarations \ 21 -Wmissing-prototypes \ 22 -Wnested-externs \ 23 -Wpointer-arith \ 24 -Wshadow \ 25 -Wstrict-prototypes \ 26 -Wswitch-default \ 27 -Wswitch-enum \ 28 -Wunused \ 29 -Wwrite-strings 30 31pkgconfig=$(shell pkg-config $(1) $(2)) 32 33CPPFLAGS=-D_GNU_SOURCE $(WARNING_CFLAGS) $(call pkgconfig,--cflags,$(LIBCOAP)) 34CFLAGS=-std=c99 35LDLIBS=$(call pkgconfig,--libs-only-l,$(LIBCOAP)) 36libdirs=$(call pkgconfig,--libs-only-L,$(LIBCOAP)) 37rpath=$(shell echo "$(libdirs)" | sed -e 's/^-L/-Wl,--rpath /') 38LDFLAGS=$(libdirs) $(rpath) 39 40all: coap-client coap-server 41 42clean: 43 rm -f *.o coap-client coap-server 44