2011-03-20 19:18:19 +01:00
|
|
|
############################################################################
|
|
|
|
# apps/examples/udp/Makefile
|
|
|
|
#
|
2017-06-23 18:58:41 +02:00
|
|
|
# Copyright (C) 2007-2008, 2011-2012, 2014, 2017 Gregory Nutt. All rights reserved.
|
2012-09-13 16:14:18 +02:00
|
|
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
2011-03-20 19:18:19 +01:00
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
#
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in
|
|
|
|
# the documentation and/or other materials provided with the
|
|
|
|
# distribution.
|
|
|
|
# 3. Neither the name NuttX nor the names of its contributors may be
|
|
|
|
# used to endorse or promote products derived from this software
|
|
|
|
# without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2019-10-15 03:25:48 +02:00
|
|
|
-include $(TOPDIR)/Make.defs
|
2011-03-20 19:18:19 +01:00
|
|
|
|
|
|
|
# UDP Test
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS = udp_cmdline.c
|
2017-06-19 19:58:56 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_UDP_NETINIT),y)
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += udp_netinit.c
|
2017-06-19 19:58:56 +02:00
|
|
|
endif
|
2017-06-23 19:40:02 +02:00
|
|
|
|
2017-06-19 19:58:56 +02:00
|
|
|
# Target 1
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2017-06-19 19:03:10 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_UDP_SERVER1),y)
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += udp_server.c
|
2011-03-20 19:18:19 +01:00
|
|
|
else
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += udp_client.c
|
2011-03-20 19:18:19 +01:00
|
|
|
endif
|
2018-09-03 17:29:56 +02:00
|
|
|
MAINSRC = udp_target1.c
|
2017-06-19 19:58:56 +02:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
PROGNAME = $(CONFIG_EXAMPLES_UDP_PROGNAME1)
|
|
|
|
PRIORITY = $(CONFIG_EXAMPLES_UDP_PRIORITY1)
|
|
|
|
STACKSIZE = $(CONFIG_EXAMPLES_UDP_STACKSIZE1)
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2017-06-19 19:58:56 +02:00
|
|
|
# Target 2
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2017-06-19 19:58:56 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_UDP_TARGET2),y)
|
2014-09-07 16:43:01 +02:00
|
|
|
|
2017-06-19 19:58:56 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_UDP_SERVER1),y)
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += udp_client.c
|
2017-06-19 19:58:56 +02:00
|
|
|
else
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += udp_server.c
|
2014-09-07 16:43:01 +02:00
|
|
|
endif
|
2018-09-03 17:29:56 +02:00
|
|
|
MAINSRC += udp_target2.c
|
2017-06-19 19:58:56 +02:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
PROGNAME += $(CONFIG_EXAMPLES_UDP_PROGNAME2)
|
|
|
|
PRIORITY += $(CONFIG_EXAMPLES_UDP_PRIORITY2)
|
|
|
|
STACKSIZE += $(CONFIG_EXAMPLES_UDP_STACKSIZE2)
|
2017-06-19 19:58:56 +02:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Host
|
|
|
|
|
|
|
|
ifneq ($(CONFIG_EXAMPLES_UDP_TARGET2),y)
|
|
|
|
|
2015-01-22 22:30:23 +01:00
|
|
|
HOSTCFLAGS += -DEXAMPLES_UDP_HOST=1
|
2017-06-23 19:23:43 +02:00
|
|
|
HOSTOBJSEXT ?= hobj
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2017-06-23 18:58:41 +02:00
|
|
|
HOST_SRCS = udp_host.c udp_cmdline.c
|
2017-06-19 19:03:10 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_UDP_SERVER1),y)
|
2017-06-19 17:46:40 +02:00
|
|
|
HOST_SRCS += udp_client.c
|
2017-06-23 18:58:41 +02:00
|
|
|
HOST_BIN = udpclient$(EXEEXT)
|
2011-03-20 19:18:19 +01:00
|
|
|
else
|
2017-06-19 17:46:40 +02:00
|
|
|
HOST_SRCS += udp_server.c
|
2017-06-23 18:58:41 +02:00
|
|
|
HOST_BIN = udpserver$(EXEEXT)
|
2011-03-20 19:18:19 +01:00
|
|
|
endif
|
|
|
|
|
2017-06-19 21:29:58 +02:00
|
|
|
HOST_OBJS = $(HOST_SRCS:.c=.$(HOSTOBJSEXT))
|
2017-06-19 19:58:56 +02:00
|
|
|
|
2011-03-20 19:18:19 +01:00
|
|
|
# Common build
|
|
|
|
|
2017-06-19 21:29:58 +02:00
|
|
|
$(HOST_OBJS): %.$(HOSTOBJSEXT): %.c
|
2015-01-22 22:30:23 +01:00
|
|
|
@echo "CC: $<"
|
|
|
|
$(Q) $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@
|
|
|
|
|
2019-10-19 00:24:43 +02:00
|
|
|
endif
|
|
|
|
|
2015-01-22 22:30:23 +01:00
|
|
|
config.h: $(TOPDIR)/include/nuttx/config.h
|
|
|
|
@echo "CP: $<"
|
|
|
|
$(Q) cp $< $@
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2019-10-19 00:24:43 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_UDP_TARGET2),y)
|
|
|
|
|
2015-01-22 22:30:23 +01:00
|
|
|
$(HOST_BIN): config.h $(HOST_OBJS)
|
|
|
|
$(Q) $(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2019-10-19 00:24:43 +02:00
|
|
|
endif
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
context:: config.h $(HOST_BIN)
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
clean::
|
2019-10-19 00:24:43 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_UDP_TARGET2),y)
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, $(HOST_BIN))
|
2017-06-19 21:29:58 +02:00
|
|
|
$(call DELFILE, *.$(HOSTOBJSEXT))
|
2013-05-30 23:24:22 +02:00
|
|
|
$(call DELFILE, *.dSYM)
|
2019-10-06 14:14:39 +02:00
|
|
|
endif
|
2019-10-19 00:24:43 +02:00
|
|
|
$(call DELFILE, config.h)
|
2019-10-06 14:14:39 +02:00
|
|
|
|
|
|
|
MODULE = $(CONFIG_EXAMPLES_UDP)
|
2017-06-19 19:58:56 +02:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
include $(APPDIR)/Application.mk
|