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