1c87c5fbaSopenharmony_ci# examples/Makefile.am 2c87c5fbaSopenharmony_ci# 3c87c5fbaSopenharmony_ci# Copyright (C) 2015 Carsten Schoenert <c.schoenert@t-online.de> 4c87c5fbaSopenharmony_ci# Copyright (C) 2018-2023 Jon Shallow <supjps-libcoap@jpshallow.com> 5c87c5fbaSopenharmony_ci# 6c87c5fbaSopenharmony_ci# SPDX-License-Identifier: BSD-2-Clause 7c87c5fbaSopenharmony_ci# 8c87c5fbaSopenharmony_ci# This file is part of the CoAP C library libcoap. Please see README and 9c87c5fbaSopenharmony_ci# COPYING for terms of use. 10c87c5fbaSopenharmony_ci 11c87c5fbaSopenharmony_ciEXTRA_DIST = \ 12c87c5fbaSopenharmony_ci share.libcoap.examples.Makefile \ 13c87c5fbaSopenharmony_ci share.libcoap.examples.README \ 14c87c5fbaSopenharmony_ci coap_list.h \ 15c87c5fbaSopenharmony_ci getopt.c \ 16c87c5fbaSopenharmony_ci interop/a_client.conf \ 17c87c5fbaSopenharmony_ci interop/b_server.conf \ 18c87c5fbaSopenharmony_ci interop/c_client.conf \ 19c87c5fbaSopenharmony_ci interop/d_server.conf \ 20c87c5fbaSopenharmony_ci interop/e_client.conf \ 21c87c5fbaSopenharmony_ci interop/f_client.conf \ 22c87c5fbaSopenharmony_ci interop/g_client.conf \ 23c87c5fbaSopenharmony_ci oscore_testcases.sh 24c87c5fbaSopenharmony_ci 25c87c5fbaSopenharmony_ci# just do nothing if 'BUILD_EXAMPLES' isn't defined 26c87c5fbaSopenharmony_ciif BUILD_EXAMPLES 27c87c5fbaSopenharmony_ci 28c87c5fbaSopenharmony_ci# picking up the default warning CFLAGS into AM_CFLAGS 29c87c5fbaSopenharmony_ciAM_CFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include \ 30c87c5fbaSopenharmony_ci $(WARNING_CFLAGS) $(DTLS_CFLAGS) -std=c99 $(EXTRA_CFLAGS) 31c87c5fbaSopenharmony_ci 32c87c5fbaSopenharmony_ci# 33c87c5fbaSopenharmony_ci 34c87c5fbaSopenharmony_cibin_PROGRAMS = 35c87c5fbaSopenharmony_cinoinst_PROGRAMS = 36c87c5fbaSopenharmony_cicheck_PROGRAMS = 37c87c5fbaSopenharmony_ci 38c87c5fbaSopenharmony_ciif HAVE_CLIENT_SUPPORT 39c87c5fbaSopenharmony_ci 40c87c5fbaSopenharmony_cibin_PROGRAMS += coap-client@LIBCOAP_DTLS_LIB_EXTENSION_NAME@ 41c87c5fbaSopenharmony_cicheck_PROGRAMS += coap-tiny 42c87c5fbaSopenharmony_ci 43c87c5fbaSopenharmony_ciif BUILD_ADD_DEFAULT_NAMES 44c87c5fbaSopenharmony_cinoinst_PROGRAMS += coap-client 45c87c5fbaSopenharmony_ciendif # BUILD_ADD_DEFAULT_NAMES 46c87c5fbaSopenharmony_ci 47c87c5fbaSopenharmony_ciendif # HAVE_CLIENT_SUPPORT 48c87c5fbaSopenharmony_ci 49c87c5fbaSopenharmony_ciif HAVE_SERVER_SUPPORT 50c87c5fbaSopenharmony_ci 51c87c5fbaSopenharmony_cibin_PROGRAMS += coap-server@LIBCOAP_DTLS_LIB_EXTENSION_NAME@ \ 52c87c5fbaSopenharmony_ci coap-rd@LIBCOAP_DTLS_LIB_EXTENSION_NAME@ 53c87c5fbaSopenharmony_cicheck_PROGRAMS += coap-etsi_iot_01 oscore-interop-server 54c87c5fbaSopenharmony_ci 55c87c5fbaSopenharmony_ciif BUILD_ADD_DEFAULT_NAMES 56c87c5fbaSopenharmony_cinoinst_PROGRAMS += coap-server coap-rd 57c87c5fbaSopenharmony_ciendif # BUILD_ADD_DEFAULT_NAMES 58c87c5fbaSopenharmony_ci 59c87c5fbaSopenharmony_ciif ! HAVE_CLIENT_SUPPORT 60c87c5fbaSopenharmony_cicoap_server_CPPFLAGS=-DSERVER_CAN_PROXY=0 61c87c5fbaSopenharmony_cicoap_server@LIBCOAP_DTLS_LIB_EXTENSION_NAME@_CPPFLAGS=-DSERVER_CAN_PROXY=0 62c87c5fbaSopenharmony_ciendif # ! HAVE_CLIENT_SUPPORT 63c87c5fbaSopenharmony_ci 64c87c5fbaSopenharmony_ciendif # HAVE_SERVER_SUPPORT 65c87c5fbaSopenharmony_ci 66c87c5fbaSopenharmony_cicoap_client_SOURCES = coap-client.c 67c87c5fbaSopenharmony_cicoap_client_LDADD = $(DTLS_LIBS) \ 68c87c5fbaSopenharmony_ci $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la 69c87c5fbaSopenharmony_ci 70c87c5fbaSopenharmony_cicoap_server_SOURCES = coap-server.c 71c87c5fbaSopenharmony_cicoap_server_LDADD = $(DTLS_LIBS) \ 72c87c5fbaSopenharmony_ci $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la 73c87c5fbaSopenharmony_ci 74c87c5fbaSopenharmony_cicoap_rd_SOURCES = coap-rd.c 75c87c5fbaSopenharmony_cicoap_rd_LDADD = $(DTLS_LIBS) \ 76c87c5fbaSopenharmony_ci $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la 77c87c5fbaSopenharmony_ci 78c87c5fbaSopenharmony_cicoap_client@LIBCOAP_DTLS_LIB_EXTENSION_NAME@_SOURCES = coap-client.c 79c87c5fbaSopenharmony_cicoap_client@LIBCOAP_DTLS_LIB_EXTENSION_NAME@_LDADD = $(DTLS_LIBS) \ 80c87c5fbaSopenharmony_ci $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la 81c87c5fbaSopenharmony_ci 82c87c5fbaSopenharmony_cicoap_server@LIBCOAP_DTLS_LIB_EXTENSION_NAME@_SOURCES = coap-server.c 83c87c5fbaSopenharmony_cicoap_server@LIBCOAP_DTLS_LIB_EXTENSION_NAME@_LDADD = $(DTLS_LIBS) \ 84c87c5fbaSopenharmony_ci $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la 85c87c5fbaSopenharmony_ci 86c87c5fbaSopenharmony_cicoap_rd@LIBCOAP_DTLS_LIB_EXTENSION_NAME@_SOURCES = coap-rd.c 87c87c5fbaSopenharmony_cicoap_rd@LIBCOAP_DTLS_LIB_EXTENSION_NAME@_LDADD = $(DTLS_LIBS) \ 88c87c5fbaSopenharmony_ci $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la 89c87c5fbaSopenharmony_ci 90c87c5fbaSopenharmony_cicoap_etsi_iot_01_SOURCES = etsi_iot_01.c 91c87c5fbaSopenharmony_cicoap_etsi_iot_01_LDADD = $(DTLS_LIBS) \ 92c87c5fbaSopenharmony_ci $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la 93c87c5fbaSopenharmony_ci 94c87c5fbaSopenharmony_cioscore_interop_server_SOURCES = oscore-interop-server.c 95c87c5fbaSopenharmony_cioscore_interop_server_LDADD = $(DTLS_LIBS) \ 96c87c5fbaSopenharmony_ci $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la 97c87c5fbaSopenharmony_ci 98c87c5fbaSopenharmony_cicoap_tiny_SOURCES = tiny.c 99c87c5fbaSopenharmony_cicoap_tiny_LDADD = $(DTLS_LIBS) \ 100c87c5fbaSopenharmony_ci $(top_builddir)/.libs/libcoap-$(LIBCOAP_NAME_SUFFIX).la 101c87c5fbaSopenharmony_ci 102c87c5fbaSopenharmony_ciendif # BUILD_EXAMPLES 103c87c5fbaSopenharmony_ci 104c87c5fbaSopenharmony_ciif BUILD_EXAMPLES_SOURCE 105c87c5fbaSopenharmony_ciEXAMPLES_DIR = $(DESTDIR)$(datadir)/libcoap/examples 106c87c5fbaSopenharmony_ciEXAMPLES_SRC = coap-client.c coap-server.c 107c87c5fbaSopenharmony_ciendif # BUILD_EXAMPLES_SOURCE 108c87c5fbaSopenharmony_ci 109c87c5fbaSopenharmony_ci## Install example files 110c87c5fbaSopenharmony_ciinstall-exec-hook: 111c87c5fbaSopenharmony_ciif BUILD_EXAMPLES_SOURCE 112c87c5fbaSopenharmony_ci $(MKDIR_P) $(EXAMPLES_DIR) 113c87c5fbaSopenharmony_ci (cd $(top_srcdir)/examples ; \ 114c87c5fbaSopenharmony_ci $(INSTALL_DATA) $(EXAMPLES_SRC) ../LICENSE ../COPYING $(EXAMPLES_DIR) ; \ 115c87c5fbaSopenharmony_ci $(INSTALL_DATA) share.libcoap.examples.Makefile $(EXAMPLES_DIR)/Makefile; \ 116c87c5fbaSopenharmony_ci $(INSTALL_DATA) share.libcoap.examples.README $(EXAMPLES_DIR)/README) 117c87c5fbaSopenharmony_ciendif # BUILD_EXAMPLES_SOURCE 118c87c5fbaSopenharmony_ciif BUILD_ADD_DEFAULT_NAMES 119c87c5fbaSopenharmony_ci if [ -d "$(DESTDIR)$(bindir)" ] ; then \ 120c87c5fbaSopenharmony_ci (cd $(DESTDIR)$(bindir) && \ 121c87c5fbaSopenharmony_ci (if [ -f coap-client@LIBCOAP_DTLS_LIB_EXTENSION_NAME@ ] ; then \ 122c87c5fbaSopenharmony_ci rm -f coap-client ; \ 123c87c5fbaSopenharmony_ci $(LN_S) coap-client@LIBCOAP_DTLS_LIB_EXTENSION_NAME@ coap-client ; \ 124c87c5fbaSopenharmony_ci fi ; \ 125c87c5fbaSopenharmony_ci if [ -f coap-server@LIBCOAP_DTLS_LIB_EXTENSION_NAME@ ] ; then \ 126c87c5fbaSopenharmony_ci rm -f coap-server ; \ 127c87c5fbaSopenharmony_ci $(LN_S) coap-server@LIBCOAP_DTLS_LIB_EXTENSION_NAME@ coap-server ; \ 128c87c5fbaSopenharmony_ci fi ; \ 129c87c5fbaSopenharmony_ci if [ -f coap-rd@LIBCOAP_DTLS_LIB_EXTENSION_NAME@ ] ; then \ 130c87c5fbaSopenharmony_ci rm -f coap-rd ; \ 131c87c5fbaSopenharmony_ci $(LN_S) coap-rd@LIBCOAP_DTLS_LIB_EXTENSION_NAME@ coap-rd ; \ 132c87c5fbaSopenharmony_ci fi) \ 133c87c5fbaSopenharmony_ci ) ; \ 134c87c5fbaSopenharmony_ci fi 135c87c5fbaSopenharmony_ciendif # BUILD_ADD_DEFAULT_NAMES 136c87c5fbaSopenharmony_ci 137c87c5fbaSopenharmony_ciuninstall-hook: 138c87c5fbaSopenharmony_ciif BUILD_EXAMPLES_SOURCE 139c87c5fbaSopenharmony_ci rm -rf $(DESTDIR)$(datadir)/libcoap/examples 140c87c5fbaSopenharmony_ciendif # BUILD_EXAMPLES_SOURCE 141c87c5fbaSopenharmony_ciif BUILD_ADD_DEFAULT_NAMES 142c87c5fbaSopenharmony_ci rm -f $(DESTDIR)$(bindir)/coap-client 143c87c5fbaSopenharmony_ci rm -f $(DESTDIR)$(bindir)/coap-server 144c87c5fbaSopenharmony_ci rm -f $(DESTDIR)$(bindir)/coap-rd 145c87c5fbaSopenharmony_ciendif # BUILD_ADD_DEFAULT_NAMES 146