1# Makefile 2# 3# Copyright (C) 2010-2023 Olaf Bergmann <bergmann@tzi.org> and others 4# 5# SPDX-License-Identifier: BSD-2-Clause 6# 7# This file is part of the CoAP C library libcoap. Please see README and 8# COPYING for terms of use. 9 10RIOT=RIOT 11TARGET?=native 12 13all: RIOT pkg examples client server 14 15RIOT: 16 git clone --depth 1 https://github.com/RIOT-OS/RIOT.git $@ 17 18pkg: 19 @IN_GIT=`git rev-parse --is-inside-work-tree` ; \ 20 if [ "$${IN_GIT}" = "true" ] ; then \ 21 rm -rf pkg_libcoap/patches ; \ 22 mkdir -p pkg_libcoap/patches ; \ 23 RIOT_HASH=`grep PKG_VERSION= pkg_libcoap/Makefile | cut -d= -f2` ; \ 24 git pull --unshallow > /dev/null 2>&1 ; \ 25 if [ ! -z "$${RIOT_HASH}" ] ; then \ 26 (cd pkg_libcoap/patches ; git format-patch -n $${RIOT_HASH}) ; \ 27 fi \ 28 fi 29 rm -rf RIOT/pkg/libcoap && mkdir RIOT/pkg/libcoap 30 cd pkg_libcoap && cp -r * ../RIOT/pkg/libcoap 31 @HAVE_KCONFIG=`grep libcoap/Kconfig RIOT/pkg/Kconfig | wc -l` ; \ 32 if [ "$${HAVE_KCONFIG}" = 0 ] ; then \ 33 sed -i '/rsource "libcose\/Kconfig"/irsource "libcoap\/Kconfig"' RIOT/pkg/Kconfig ; \ 34 fi 35 36examples: 37 rm -rf RIOT/examples/libcoap-client && mkdir RIOT/examples/libcoap-client 38 cd examples_libcoap_client && cp -r * ../RIOT/examples/libcoap-client 39 rm -rf RIOT/examples/libcoap-server && mkdir RIOT/examples/libcoap-server 40 cd examples_libcoap_server && cp -r * ../RIOT/examples/libcoap-server 41 42client: RIOT pkg examples 43 $(MAKE) -C RIOT/examples/libcoap-client/ RIOT_CI_BUILD=1 44 45server: RIOT pkg examples 46 $(MAKE) -C RIOT/examples/libcoap-server/ RIOT_CI_BUILD=1 47 48clean: 49 rm -rf RIOT/pkg/libcoap 50 rm -rf RIOT/examples/libcoap-client 51 rm -rf RIOT/examples/libcoap-server 52