1c87c5fbaSopenharmony_ci# Makefile.am for libcoap
2c87c5fbaSopenharmony_ci#
3c87c5fbaSopenharmony_ci# Copyright (C) 2010-2023 Olaf Bergmann <bergmann@tzi.org>
4c87c5fbaSopenharmony_ci# Copyright (C) 2015-2017 Carsten Schoenert <c.schoenert@t-online.de>
5c87c5fbaSopenharmony_ci# Copyright (C) 2018-2023 Jon Shallow <supjps-libcoap@jpshallow.com>
6c87c5fbaSopenharmony_ci#
7c87c5fbaSopenharmony_ci# SPDX-License-Identifier: BSD-2-Clause
8c87c5fbaSopenharmony_ci#
9c87c5fbaSopenharmony_ci# This file is part of the CoAP C library libcoap. Please see README and
10c87c5fbaSopenharmony_ci# COPYING for terms of use.
11c87c5fbaSopenharmony_ci
12c87c5fbaSopenharmony_ci## Place generated object files (.o) into the same directory as their source
13c87c5fbaSopenharmony_ci## files, in order to avoid collisions when non-recursive make is used.
14c87c5fbaSopenharmony_ciAUTOMAKE_OPTIONS = subdir-objects
15c87c5fbaSopenharmony_ci
16c87c5fbaSopenharmony_ciACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
17c87c5fbaSopenharmony_ci
18c87c5fbaSopenharmony_ciLIBCOAP_PACKAGE_BUILD = @DOLLAR_SIGN@(shell git describe --tags --dirty --always 2>/dev/null || echo @PACKAGE_VERSION@)
19c87c5fbaSopenharmony_ci
20c87c5fbaSopenharmony_ci## Source files specifically for OSCORE
21c87c5fbaSopenharmony_cilibcoap_OSCORE_sources = \
22c87c5fbaSopenharmony_ci  src/oscore/oscore.c \
23c87c5fbaSopenharmony_ci  src/oscore/oscore_cbor.c \
24c87c5fbaSopenharmony_ci  src/oscore/oscore_context.c \
25c87c5fbaSopenharmony_ci  src/oscore/oscore_cose.c \
26c87c5fbaSopenharmony_ci  src/oscore/oscore_crypto.c
27c87c5fbaSopenharmony_ci
28c87c5fbaSopenharmony_ci## Additional files for the distribution archive
29c87c5fbaSopenharmony_ciEXTRA_DIST = \
30c87c5fbaSopenharmony_ci  BUILDING \
31c87c5fbaSopenharmony_ci  CONTRIBUTE \
32c87c5fbaSopenharmony_ci  TODO \
33c87c5fbaSopenharmony_ci  LICENSE \
34c87c5fbaSopenharmony_ci  CMakeLists.txt \
35c87c5fbaSopenharmony_ci  cmake_coap_config.h.in \
36c87c5fbaSopenharmony_ci  cmake/Config.cmake.in \
37c87c5fbaSopenharmony_ci  cmake/FindMbedTLS.cmake \
38c87c5fbaSopenharmony_ci  cmake/FindTinyDTLS.cmake \
39c87c5fbaSopenharmony_ci  coap_config.h.contiki \
40c87c5fbaSopenharmony_ci  coap_config.h.riot \
41c87c5fbaSopenharmony_ci  coap_config.h.windows \
42c87c5fbaSopenharmony_ci  libcoap-$(LIBCOAP_API_VERSION).pc.in \
43c87c5fbaSopenharmony_ci  libcoap-$(LIBCOAP_API_VERSION).map \
44c87c5fbaSopenharmony_ci  libcoap-$(LIBCOAP_API_VERSION).sym \
45c87c5fbaSopenharmony_ci  examples/coap_list.h \
46c87c5fbaSopenharmony_ci  examples/getopt.c \
47c87c5fbaSopenharmony_ci  examples/contiki/coap_config.h \
48c87c5fbaSopenharmony_ci  examples/contiki/Makefile \
49c87c5fbaSopenharmony_ci  examples/contiki/Makefile.contiki \
50c87c5fbaSopenharmony_ci  examples/contiki/project-conf.h \
51c87c5fbaSopenharmony_ci  examples/contiki/README \
52c87c5fbaSopenharmony_ci  examples/contiki/server.c \
53c87c5fbaSopenharmony_ci  examples/lwip/client.c \
54c87c5fbaSopenharmony_ci  examples/lwip/client-coap.c \
55c87c5fbaSopenharmony_ci  examples/lwip/client-coap.h \
56c87c5fbaSopenharmony_ci  examples/lwip/Makefile \
57c87c5fbaSopenharmony_ci  examples/lwip/README \
58c87c5fbaSopenharmony_ci  examples/lwip/server.c \
59c87c5fbaSopenharmony_ci  examples/lwip/server-coap.c \
60c87c5fbaSopenharmony_ci  examples/lwip/server-coap.h \
61c87c5fbaSopenharmony_ci  examples/lwip/config/coap_config.h \
62c87c5fbaSopenharmony_ci  examples/lwip/config/coap_config.h.in \
63c87c5fbaSopenharmony_ci  examples/lwip/config/lwipopts.h \
64c87c5fbaSopenharmony_ci  examples/lwip/config/lwippools.h \
65c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_client/client-coap.c \
66c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_client/client-coap.h \
67c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_client/Kconfig \
68c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_client/main.c \
69c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_client/Makefile \
70c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_client/Makefile.ci \
71c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_client/README.md \
72c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_server/main.c \
73c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_server/Makefile \
74c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_server/Makefile.ci \
75c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_server/README.md \
76c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_server/server-coap.c \
77c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_server/server-coap.h \
78c87c5fbaSopenharmony_ci  examples/riot/examples_libcoap_server/Kconfig \
79c87c5fbaSopenharmony_ci  examples/riot/Makefile \
80c87c5fbaSopenharmony_ci  examples/riot/pkg_libcoap/Kconfig \
81c87c5fbaSopenharmony_ci  examples/riot/pkg_libcoap/Makefile \
82c87c5fbaSopenharmony_ci  examples/riot/pkg_libcoap/Makefile.dep \
83c87c5fbaSopenharmony_ci  examples/riot/pkg_libcoap/Makefile.include \
84c87c5fbaSopenharmony_ci  examples/riot/pkg_libcoap/Makefile.libcoap \
85c87c5fbaSopenharmony_ci  examples/riot/README \
86c87c5fbaSopenharmony_ci  Makefile.libcoap \
87c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_internal.h \
88c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_riot.h \
89c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_asn1_internal.h \
90c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_async_internal.h \
91c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_block_internal.h \
92c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_cache_internal.h \
93c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_crypto_internal.h \
94c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_debug_internal.h \
95c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_dtls_internal.h \
96c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_hashkey_internal.h \
97c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_io_internal.h \
98c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_layers_internal.h \
99c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_mutex_internal.h \
100c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_net_internal.h \
101c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_netif_internal.h \
102c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_oscore_internal.h \
103c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_pdu_internal.h \
104c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_resource_internal.h \
105c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_session_internal.h \
106c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_subscribe_internal.h \
107c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_tcp_internal.h \
108c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_uri_internal.h \
109c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_uthash_internal.h \
110c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_utlist_internal.h \
111c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap_ws_internal.h \
112c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap.h.in \
113c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap.h.riot \
114c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap.h.riot.in \
115c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap.h.windows \
116c87c5fbaSopenharmony_ci  include/coap$(LIBCOAP_API_VERSION)/coap.h.windows.in \
117c87c5fbaSopenharmony_ci  include/oscore/oscore_cbor.h \
118c87c5fbaSopenharmony_ci  include/oscore/oscore_context.h \
119c87c5fbaSopenharmony_ci  include/oscore/oscore_cose.h \
120c87c5fbaSopenharmony_ci  include/oscore/oscore_crypto.h \
121c87c5fbaSopenharmony_ci  include/oscore/oscore.h \
122c87c5fbaSopenharmony_ci  src/coap_io_contiki.c \
123c87c5fbaSopenharmony_ci  src/coap_io_lwip.c \
124c87c5fbaSopenharmony_ci  src/coap_io_riot.c \
125c87c5fbaSopenharmony_ci  tests/test_error_response.h \
126c87c5fbaSopenharmony_ci  tests/test_encode.h \
127c87c5fbaSopenharmony_ci  tests/test_options.h \
128c87c5fbaSopenharmony_ci  tests/test_oscore.h \
129c87c5fbaSopenharmony_ci  tests/test_pdu.h \
130c87c5fbaSopenharmony_ci  tests/test_sendqueue.h \
131c87c5fbaSopenharmony_ci  tests/test_session.h \
132c87c5fbaSopenharmony_ci  tests/test_tls.h \
133c87c5fbaSopenharmony_ci  tests/test_uri.h \
134c87c5fbaSopenharmony_ci  tests/test_wellknown.h \
135c87c5fbaSopenharmony_ci  win32/coap-client/coap-client.vcxproj \
136c87c5fbaSopenharmony_ci  win32/coap-client/coap-client.vcxproj.filters \
137c87c5fbaSopenharmony_ci  win32/coap-rd/coap-rd.vcxproj \
138c87c5fbaSopenharmony_ci  win32/coap-rd/coap-rd.vcxproj.filters \
139c87c5fbaSopenharmony_ci  win32/coap-server/coap-server.vcxproj \
140c87c5fbaSopenharmony_ci  win32/coap-server/coap-server.vcxproj.filters \
141c87c5fbaSopenharmony_ci  win32/libcoap.sln \
142c87c5fbaSopenharmony_ci  win32/libcoap.vcxproj \
143c87c5fbaSopenharmony_ci  win32/libcoap.vcxproj.filters \
144c87c5fbaSopenharmony_ci  win32/testdriver/testdriver.vcxproj \
145c87c5fbaSopenharmony_ci  win32/testdriver/testdriver.vcxproj.filters \
146c87c5fbaSopenharmony_ci  win32/testdriver/testdriver.vcxproj.user
147c87c5fbaSopenharmony_ci
148c87c5fbaSopenharmony_ci# This is a mirror of files depending on COAP_OSCORE_SUPPORT included in src as per
149c87c5fbaSopenharmony_ci# libcoap_@LIBCOAP_NAME_SUFFIX@_la_SOURCES
150c87c5fbaSopenharmony_ciif !COAP_OSCORE_SUPPORT
151c87c5fbaSopenharmony_ciEXTRA_DIST += $(libcoap_OSCORE_sources)
152c87c5fbaSopenharmony_ci
153c87c5fbaSopenharmony_ciendif # !COAP_OSCORE_SUPPORT
154c87c5fbaSopenharmony_ci
155c87c5fbaSopenharmony_ciAM_CFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include $(WARNING_CFLAGS) \
156c87c5fbaSopenharmony_ci            $(DTLS_CFLAGS) -std=c99 $(EXTRA_CFLAGS) \
157c87c5fbaSopenharmony_ci            -DLIBCOAP_PACKAGE_BUILD='"$(LIBCOAP_PACKAGE_BUILD)"'
158c87c5fbaSopenharmony_ci
159c87c5fbaSopenharmony_ciSUBDIRS = $(subdirs) . man doc tests examples
160c87c5fbaSopenharmony_ci
161c87c5fbaSopenharmony_ci## Define a libtool archive target "libcoap-@LIBCOAP_NAME_SUFFIX@.la", with
162c87c5fbaSopenharmony_ci## @LIBCOAP_NAME_SUFFIX@ substituted into the generated Makefile at configure
163c87c5fbaSopenharmony_ci## time.
164c87c5fbaSopenharmony_ci## The libtool archive file (.la) will be installed into the directory named
165c87c5fbaSopenharmony_ci## by the predefined variable $(bindir), along with the actual shared library
166c87c5fbaSopenharmony_ci## file (.so).
167c87c5fbaSopenharmony_cilib_LTLIBRARIES = libcoap-@LIBCOAP_NAME_SUFFIX@.la
168c87c5fbaSopenharmony_ci
169c87c5fbaSopenharmony_cilibcoap_@LIBCOAP_NAME_SUFFIX@_la_CFLAGS = \
170c87c5fbaSopenharmony_ci  -fPIC \
171c87c5fbaSopenharmony_ci  -fPIE \
172c87c5fbaSopenharmony_ci  $(AM_CFLAGS)
173c87c5fbaSopenharmony_ci
174c87c5fbaSopenharmony_ci## Define the source file list for the "libcoap.la" target.
175c87c5fbaSopenharmony_ci## Note that it is not necessary to list header files which are already listed
176c87c5fbaSopenharmony_ci## elsewhere in a _HEADERS variable assignment.
177c87c5fbaSopenharmony_cilibcoap_@LIBCOAP_NAME_SUFFIX@_la_SOURCES = \
178c87c5fbaSopenharmony_ci  src/coap_address.c \
179c87c5fbaSopenharmony_ci  src/coap_asn1.c \
180c87c5fbaSopenharmony_ci  src/coap_async.c \
181c87c5fbaSopenharmony_ci  src/coap_block.c \
182c87c5fbaSopenharmony_ci  src/coap_cache.c \
183c87c5fbaSopenharmony_ci  src/coap_debug.c \
184c87c5fbaSopenharmony_ci  src/coap_dtls.c \
185c87c5fbaSopenharmony_ci  src/coap_encode.c \
186c87c5fbaSopenharmony_ci  src/coap_event.c \
187c87c5fbaSopenharmony_ci  src/coap_hashkey.c \
188c87c5fbaSopenharmony_ci  src/coap_gnutls.c \
189c87c5fbaSopenharmony_ci  src/coap_io.c \
190c87c5fbaSopenharmony_ci  src/coap_layers.c \
191c87c5fbaSopenharmony_ci  src/coap_mbedtls.c \
192c87c5fbaSopenharmony_ci  src/coap_mem.c \
193c87c5fbaSopenharmony_ci  src/coap_net.c \
194c87c5fbaSopenharmony_ci  src/coap_netif.c \
195c87c5fbaSopenharmony_ci  src/coap_notls.c \
196c87c5fbaSopenharmony_ci  src/coap_openssl.c \
197c87c5fbaSopenharmony_ci  src/coap_option.c \
198c87c5fbaSopenharmony_ci  src/coap_oscore.c \
199c87c5fbaSopenharmony_ci  src/coap_pdu.c \
200c87c5fbaSopenharmony_ci  src/coap_prng.c \
201c87c5fbaSopenharmony_ci  src/coap_resource.c \
202c87c5fbaSopenharmony_ci  src/coap_session.c \
203c87c5fbaSopenharmony_ci  src/coap_str.c \
204c87c5fbaSopenharmony_ci  src/coap_subscribe.c \
205c87c5fbaSopenharmony_ci  src/coap_tcp.c \
206c87c5fbaSopenharmony_ci  src/coap_time.c \
207c87c5fbaSopenharmony_ci  src/coap_tinydtls.c \
208c87c5fbaSopenharmony_ci  src/coap_uri.c \
209c87c5fbaSopenharmony_ci  src/coap_ws.c
210c87c5fbaSopenharmony_ci
211c87c5fbaSopenharmony_ciif COAP_OSCORE_SUPPORT
212c87c5fbaSopenharmony_cilibcoap_@LIBCOAP_NAME_SUFFIX@_la_SOURCES += $(libcoap_OSCORE_sources)
213c87c5fbaSopenharmony_ci
214c87c5fbaSopenharmony_ciendif # COAP_OSCORE_SUPPORT
215c87c5fbaSopenharmony_ci
216c87c5fbaSopenharmony_ci## Define the list of public header files and their install location.
217c87c5fbaSopenharmony_ci## The API version is appended to the install folder to being able to
218c87c5fbaSopenharmony_ci## co-install various versions of libcoap.
219c87c5fbaSopenharmony_cilibcoap_includedir = $(includedir)/coap$(LIBCOAP_API_VERSION)/
220c87c5fbaSopenharmony_ci
221c87c5fbaSopenharmony_ci# If there is a API change to something $(LIBCOAP_API_VERSION) > 1 the install
222c87c5fbaSopenharmony_ci# prefix for the header files has to change to not conflict the older version
223c87c5fbaSopenharmony_ci# if the user want's to install both versions. There will be something used like
224c87c5fbaSopenharmony_ci# libcoap_include_HEADERS = \
225c87c5fbaSopenharmony_ci#  $(top_srcdir)/include/coap-$(LIBCOAP_API_VERSION)/*
226c87c5fbaSopenharmony_ci
227c87c5fbaSopenharmony_cilibcoap_include_HEADERS = \
228c87c5fbaSopenharmony_ci  $(top_builddir)/include/coap$(LIBCOAP_API_VERSION)/coap.h \
229c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/libcoap.h \
230c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_address.h \
231c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_async.h \
232c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_block.h \
233c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_cache.h \
234c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_debug.h \
235c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_dtls.h \
236c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_encode.h \
237c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_event.h \
238c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_forward_decls.h \
239c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_io.h \
240c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_mem.h \
241c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_net.h \
242c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_option.h \
243c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_oscore.h \
244c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_pdu.h \
245c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_prng.h \
246c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_resource.h \
247c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_session.h \
248c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_str.h \
249c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_subscribe.h \
250c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_time.h \
251c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_uri.h \
252c87c5fbaSopenharmony_ci  $(top_srcdir)/include/coap$(LIBCOAP_API_VERSION)/coap_ws.h
253c87c5fbaSopenharmony_ci
254c87c5fbaSopenharmony_ci## Instruct libtool to include API version information in the generated shared
255c87c5fbaSopenharmony_ci## library file (.so). The library ABI version will later defined in configure.ac,
256c87c5fbaSopenharmony_ci## so that all version information is kept in one place.
257c87c5fbaSopenharmony_cilibcoap_@LIBCOAP_NAME_SUFFIX@_la_LDFLAGS =					\
258c87c5fbaSopenharmony_ci  -version-info $(LT_LIBCOAP_CURRENT):$(LT_LIBCOAP_REVISION):$(LT_LIBCOAP_AGE)	\
259c87c5fbaSopenharmony_ci  @libcoap_SYMBOLS@ \
260c87c5fbaSopenharmony_ci  $(DTLS_LIBS) \
261c87c5fbaSopenharmony_ci  -pie
262c87c5fbaSopenharmony_ci
263c87c5fbaSopenharmony_ci## Collect symbols here we want to ignore while building the helper files
264c87c5fbaSopenharmony_ci## libcoap-$(LIBCOAP_API_VERSION).{map,sym} for the linker.
265c87c5fbaSopenharmony_ciCTAGS_IGNORE=-I " \
266c87c5fbaSopenharmony_cicoap_pdu_from_pbuf \
267c87c5fbaSopenharmony_cicoap_lwip_dump_memory_pools \
268c87c5fbaSopenharmony_cicoap_lwip_set_input_wait_handler \
269c87c5fbaSopenharmony_cicoap_print_contiki_prefix \
270c87c5fbaSopenharmony_ci"
271c87c5fbaSopenharmony_ci
272c87c5fbaSopenharmony_ci# This helper is called by libcoap-$(LIBCOAP_API_VERSION).{map,sym} to see if
273c87c5fbaSopenharmony_ci# configure has detected a usable version of the ctags program and aborts if not.
274c87c5fbaSopenharmony_cicheck_ctags:
275c87c5fbaSopenharmony_ci	@if [ "$(CTAGS_PROG)" = "" ]; then \
276c87c5fbaSopenharmony_ci		echo ;\
277c87c5fbaSopenharmony_ci		echo "There was no ctags program found by the configure script!" ;\
278c87c5fbaSopenharmony_ci		echo "ctags is needed for running this target! Please note the warning about the missed ctags program of the configure script." ;\
279c87c5fbaSopenharmony_ci		echo ;\
280c87c5fbaSopenharmony_ci		exit 1;\
281c87c5fbaSopenharmony_ci	fi
282c87c5fbaSopenharmony_ci
283c87c5fbaSopenharmony_ci## Helper target to generate the symbol table needed by libtool.
284c87c5fbaSopenharmony_ci## The .map format is used when ld supports linker scripts, otherwise
285c87c5fbaSopenharmony_ci## it must fall back to a plain symbol file.
286c87c5fbaSopenharmony_ciupdate-map-file: libcoap-$(LIBCOAP_API_VERSION).map libcoap-$(LIBCOAP_API_VERSION).sym
287c87c5fbaSopenharmony_ci
288c87c5fbaSopenharmony_cilibcoap-$(LIBCOAP_API_VERSION).map: check_ctags $(libcoap_include_HEADERS)
289c87c5fbaSopenharmony_ci	( echo "VER_$(LIBCOAP_API_VERSION) {" ; \
290c87c5fbaSopenharmony_ci	echo "global:" ; \
291c87c5fbaSopenharmony_ci	$(CTAGS_PROG) $(CTAGS_IGNORE) -f - --c-kinds=p $(libcoap_include_HEADERS) | awk '/^coap_/ { print "  " $$1 ";" }' | LC_ALL=C sort -u ; \
292c87c5fbaSopenharmony_ci	echo "local:" ; \
293c87c5fbaSopenharmony_ci	echo "  *;" ; \
294c87c5fbaSopenharmony_ci	echo "};" ) > $(top_builddir)/$@.new
295c87c5fbaSopenharmony_ci	mv $(top_builddir)/$@.new $(top_builddir)/$@
296c87c5fbaSopenharmony_ci
297c87c5fbaSopenharmony_cilibcoap-$(LIBCOAP_API_VERSION).sym: check_ctags $(libcoap_include_HEADERS)
298c87c5fbaSopenharmony_ci	( $(CTAGS_PROG) $(CTAGS_IGNORE) -f - --c-kinds=p $(libcoap_include_HEADERS) | awk '/^coap_/ { print $$1 }' | LC_ALL=C sort -u ) \
299c87c5fbaSopenharmony_ci	> $(top_builddir)/$@.new
300c87c5fbaSopenharmony_ci	mv $(top_builddir)/$@.new $(top_builddir)/$@
301c87c5fbaSopenharmony_ci
302c87c5fbaSopenharmony_ci## Install the generated pkg-config file (.pc) into the expected location for
303c87c5fbaSopenharmony_ci## architecture-dependent package configuration information.  Occasionally,
304c87c5fbaSopenharmony_ci## pkg-config files are also used for architecture-independent data packages,
305c87c5fbaSopenharmony_ci## in which case the correct install location would be $(datadir)/pkgconfig.
306c87c5fbaSopenharmony_cipkgconfigdir = $(libdir)/pkgconfig
307c87c5fbaSopenharmony_cipkgconfig_DATA = libcoap-$(LIBCOAP_NAME_SUFFIX).pc
308c87c5fbaSopenharmony_ci
309c87c5fbaSopenharmony_ci## Define an independent executable script for inclusion in the distribution
310c87c5fbaSopenharmony_ci## archive.  However, it will not be installed on an end user's system due to
311c87c5fbaSopenharmony_ci## the noinst_ prefix.
312c87c5fbaSopenharmony_cidist_noinst_SCRIPTS = autogen.sh
313c87c5fbaSopenharmony_ci
314c87c5fbaSopenharmony_ci## Set up a common library that causes linking against the common library
315c87c5fbaSopenharmony_ci## to link with the actual library with (D)TLS support
316c87c5fbaSopenharmony_ciif BUILD_ADD_DEFAULT_NAMES
317c87c5fbaSopenharmony_ciinstall-exec-hook:
318c87c5fbaSopenharmony_ci	(cd $(DESTDIR)$(libdir) ; \
319c87c5fbaSopenharmony_ci	if [ -f libcoap-$(LIBCOAP_NAME_SUFFIX).so ] ; then \
320c87c5fbaSopenharmony_ci		rm -f libcoap-$(LIBCOAP_API_VERSION).so ; \
321c87c5fbaSopenharmony_ci		$(LN_S) libcoap-$(LIBCOAP_NAME_SUFFIX).so libcoap-$(LIBCOAP_API_VERSION).so ; \
322c87c5fbaSopenharmony_ci	fi ; \
323c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_API_VERSION).a ; \
324c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_API_VERSION).la ; \
325c87c5fbaSopenharmony_ci	$(LN_S) libcoap-$(LIBCOAP_NAME_SUFFIX).a libcoap-$(LIBCOAP_API_VERSION).a ; \
326c87c5fbaSopenharmony_ci	$(LN_S) libcoap-$(LIBCOAP_NAME_SUFFIX).la libcoap-$(LIBCOAP_API_VERSION).la ; \
327c87c5fbaSopenharmony_ci	$(MKDIR_P) $(DESTDIR)$(pkgconfigdir) ; \
328c87c5fbaSopenharmony_ci	cd $(DESTDIR)$(pkgconfigdir) ; \
329c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_API_VERSION).pc ; \
330c87c5fbaSopenharmony_ci	$(LN_S) libcoap-$(LIBCOAP_NAME_SUFFIX).pc libcoap-$(LIBCOAP_API_VERSION).pc)
331c87c5fbaSopenharmony_ci
332c87c5fbaSopenharmony_ciuninstall-hook:
333c87c5fbaSopenharmony_ci	(cd $(DESTDIR)$(libdir) ; \
334c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_API_VERSION).a ; \
335c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_API_VERSION).la ; \
336c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_API_VERSION).so ; \
337c87c5fbaSopenharmony_ci	cd $(DESTDIR)$(pkgconfigdir) ; \
338c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_API_VERSION).pc)
339c87c5fbaSopenharmony_ciendif # BUILD_ADD_DEFAULT_NAMES
340c87c5fbaSopenharmony_ci
341c87c5fbaSopenharmony_ci## various *-local targets
342c87c5fbaSopenharmony_ci## Remove the helper files for the linker and the pkg-config file if there
343c87c5fbaSopenharmony_ci## is 'make distclean' called. NOTE: To re create the *.{map,sym} files you
344c87c5fbaSopenharmony_ci## need to call the target update-map-file after the configure script was
345c87c5fbaSopenharmony_ci## running!
346c87c5fbaSopenharmony_ciclean-local:
347c87c5fbaSopenharmony_ci	-find \( -name '*.gcda' -o -name '*.gcno' -o -name '*.gcov' \) -delete
348c87c5fbaSopenharmony_ci
349c87c5fbaSopenharmony_cidistclean-local:
350c87c5fbaSopenharmony_ci	@rm -f src/*.o src/*.lo
351c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_API_VERSION).map
352c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_API_VERSION).sym
353c87c5fbaSopenharmony_ci	rm -f libcoap-$(LIBCOAP_NAME_SUFFIX).pc
354c87c5fbaSopenharmony_ci	@echo
355c87c5fbaSopenharmony_ci	@echo "     ---> Please note the following important advice! <---"
356c87c5fbaSopenharmony_ci	@echo "     The files libcoap-$(LIBCOAP_API_VERSION).{map,sym} are removed by the distclean target!"
357c87c5fbaSopenharmony_ci	@echo "     To regenerate this two files you need to call 'make update-map-file' first before any"
358c87c5fbaSopenharmony_ci	@echo "     other Make target. Otherwise the build of libcoap will fail!"
359c87c5fbaSopenharmony_ci	@echo
360c87c5fbaSopenharmony_ci
361c87c5fbaSopenharmony_ci## Ensure we have actual *.{map,sym} files if we create a release tarball.
362c87c5fbaSopenharmony_cidist-local: update-map-file
363c87c5fbaSopenharmony_ci
364c87c5fbaSopenharmony_ci## Finaly some phony targets, just to ensure those targets are always buildable
365c87c5fbaSopenharmony_ci## no matter if the user has created same called files.
366c87c5fbaSopenharmony_ci.PHONY: update-map-file check_ctags
367c87c5fbaSopenharmony_ci
368