examples: adding the examples folder to the build

After including the doc/ and the tests/ folder under the hood of the
autotools now adding the examples/ foolder too.
The user is now able to add the build of the example binarys if
configure is called with '--enable-examples' as option. The example
binarys will not be build by default!

Currently only 'coap-client', 'coap-server' and 'rd' is build.
This commit is contained in:
Carsten Schoenert authored and Olaf Bergmann committed 2015-03-12 11:25:26 +01:00
1 parent 1c348f9ed0
commit 60030d0fb4
4 files changed
+49 -1

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
AM_CFLAGS = -I @top_builddir@/include/coap/ $(WARNING_CFLAGS) -std=c99
SUBDIRS = . $(DOC_DIR) tests
SUBDIRS = . $(DOC_DIR) tests examples
## Define a libtool archive target "libcoap-@LIBCOAP_API_VERSION@.la", with
## @LIBCOAP_API_VERSION@ substituted into the generated Makefile at configure
+20
View File
@@ -222,6 +222,22 @@ if test "x$build_tests" = "xyes"; then
fi
AM_CONDITIONAL(HAVE_CUNIT, [test "x$CUNIT_LIBS" != "x"])
# configure options
# __examples__
AC_ARG_ENABLE([examples],
[AC_HELP_STRING([--enable-examples],
[Enable building the tests (default=yes)])],
[build_examples="$enableval"],
[build_examples="yes"])
if test "x$build_examples" = "xyes"; then
BUILD_EXAMPLES="YES"
fi
AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$build_examples" != "x"])
# end configure options
#######################
# Check for ctags
AC_ARG_VAR([CTAGS_PROG],[the 'ctag' program to use for make target 'update-map-file'])
AC_PATH_PROG([CTAGS_PROG],[ctags],[])
@@ -305,6 +321,7 @@ esac
AC_CONFIG_FILES([
Makefile
doc/Makefile
examples/Makefile
tests/Makefile
libcoap-$LIBCOAP_API_VERSION.pc:libcoap-$LIBCOAP_API_VERSION.pc.in
])
@@ -335,3 +352,6 @@ if test "x$build_tests" = "xyes"; then
else
AC_MSG_RESULT([ build unit test binary : "no"])
fi
if test "x$build_examples" = "xyes"; then
AC_MSG_RESULT([ build examples : "yes"])
fi
+28
View File
@@ -0,0 +1,28 @@
# doc/Makefile.am
#
# Copyright (C) 2015 Carsten Schoenert <c.schoenert@t-online.de>
#
# This file is part of the CoAP C library libcoap. Please see README and
# COPYING for terms of use.
# just do nothing if 'BUILD_EXAMPLES' isn't defined
if BUILD_EXAMPLES
# picking up the default warning CFLAGS into AM_CFLAGS
AM_CFLAGS = -I@top_builddir@/include/coap/ $(WARNING_CFLAGS) -std=c99
# etsi_iot_01 and tiny are missing
bin_PROGRAMS = coap-client coap-server rd
coap_client_SOURCES = client.c coap_list.c
coap_client_LDADD = @top_builddir@/.libs/libcoap-$(LIBCOAP_API_VERSION).la
coap_server_SOURCES = server.c
coap_server_LDADD = @top_builddir@/.libs/libcoap-$(LIBCOAP_API_VERSION).la
rd_SOURCES = rd.c
rd_LDADD = @top_builddir@/.libs/libcoap-$(LIBCOAP_API_VERSION).la
install-exec-am: all-local
endif # BUILD_EXAMPLES
File renamed without changes.