2011-03-20 19:18:19 +01:00
|
|
|
############################################################################
|
|
|
|
# examples/nettest/Makefile
|
|
|
|
#
|
2017-06-23 19:23:43 +02:00
|
|
|
# Copyright (C) 2007-2008, 2010-2012, 2017 Gregory Nutt. All rights reserved.
|
2011-12-13 18:56:14 +01: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.
|
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
|
|
|
-include $(TOPDIR)/Make.defs
|
|
|
|
|
|
|
|
# Basic TCP networking test
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS = nettest_cmdline.c
|
2017-06-23 19:40:02 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_INIT),y)
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += nettest_netinit.c
|
2017-06-23 19:40:02 +02:00
|
|
|
endif
|
|
|
|
|
2017-06-23 23:49:27 +02:00
|
|
|
# Target 1 Files
|
2017-06-23 19:40:02 +02:00
|
|
|
|
2015-08-26 18:35:40 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += nettest_server.c nettest_client.c
|
2015-08-26 18:35:40 +02:00
|
|
|
else ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y)
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += nettest_server.c
|
2011-03-20 19:18:19 +01:00
|
|
|
else
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += nettest_client.c
|
2011-03-20 19:18:19 +01:00
|
|
|
endif
|
2018-09-03 17:29:56 +02:00
|
|
|
MAINSRC = nettest_target1.c
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2017-06-23 23:49:27 +02:00
|
|
|
# Target 1 Application Info
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER1),y)
|
|
|
|
CONFIG_EXAMPLES_NETTEST_PROGNAME1 ?= tcpserver
|
|
|
|
else
|
|
|
|
CONFIG_EXAMPLES_NETTEST_PROGNAME1 ?= tcpclient
|
|
|
|
endif
|
|
|
|
CONFIG_EXAMPLES_NETTEST_PRIORITY1 ?= 100
|
|
|
|
CONFIG_EXAMPLES_NETTEST_STACKSIZE1 ?= 2048
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
PROGNAME = $(CONFIG_EXAMPLES_NETTEST_PROGNAME1)
|
|
|
|
PRIORITY = $(CONFIG_EXAMPLES_NETTEST_PRIORITY1)
|
|
|
|
STACKSIZE = $(CONFIG_EXAMPLES_NETTEST_STACKSIZE1)
|
2017-06-23 23:49:27 +02:00
|
|
|
|
|
|
|
# Target 2
|
|
|
|
|
2017-06-24 02:12:34 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_TARGET2),y)
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER1),y)
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += nettest_client.c
|
2017-06-24 02:12:34 +02:00
|
|
|
else
|
2018-09-03 17:29:56 +02:00
|
|
|
CSRCS += nettest_server.c
|
2017-06-24 02:12:34 +02:00
|
|
|
endif
|
2018-09-03 17:29:56 +02:00
|
|
|
MAINSRC += nettest_target2.c
|
2017-06-24 02:12:34 +02:00
|
|
|
|
2017-06-23 23:49:27 +02:00
|
|
|
# Target 2 Application Info
|
|
|
|
|
2017-06-24 02:12:34 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER1),y)
|
|
|
|
CONFIG_EXAMPLES_NETTEST_PROGNAME2 ?= tcpclient
|
|
|
|
else
|
|
|
|
CONFIG_EXAMPLES_NETTEST_PROGNAME2 ?= tcpserver
|
|
|
|
endif
|
|
|
|
CONFIG_EXAMPLES_NETTEST_PRIORITY2 ?= 100
|
|
|
|
CONFIG_EXAMPLES_NETTEST_STACKSIZE2 ?= 2048
|
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
PROGNAME += $(CONFIG_EXAMPLES_NETTEST_PROGNAME2)
|
|
|
|
PRIORITY += $(CONFIG_EXAMPLES_NETTEST_PRIORITY2)
|
|
|
|
STACKSIZE += $(CONFIG_EXAMPLES_NETTEST_STACKSIZE2)
|
2017-06-23 23:49:27 +02:00
|
|
|
|
2017-06-24 02:12:34 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_TARGET2),y)
|
2018-09-03 17:29:56 +02:00
|
|
|
APPNAME = nettest1 nettest2
|
2017-06-24 02:12:34 +02:00
|
|
|
else
|
2018-09-03 17:29:56 +02:00
|
|
|
APPNAME = nettest
|
2011-04-10 18:08:08 +02:00
|
|
|
endif
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2017-06-23 23:49:27 +02:00
|
|
|
# Host
|
|
|
|
|
2017-06-24 02:12:34 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_TARGET2),y)
|
2015-08-26 18:35:40 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
2017-06-24 02:12:34 +02:00
|
|
|
|
2015-08-26 18:35:40 +02:00
|
|
|
HOSTCFLAGS += -DNETTEST_HOST=1
|
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y)
|
2017-06-23 20:21:13 +02:00
|
|
|
HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_SERVER=1 -DCONFIG_EXAMPLES_NETTEST_SERVERIP="$(CONFIG_EXAMPLES_NETTEST_SERVERIP)"
|
2015-08-26 18:35:40 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_PERFORMANCE),y)
|
|
|
|
HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_PERFORMANCE=1
|
|
|
|
endif
|
|
|
|
|
2017-06-23 19:23:43 +02:00
|
|
|
HOST_SRCS = nettest_host.c
|
2015-08-26 18:35:40 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y)
|
2017-06-23 19:23:43 +02:00
|
|
|
HOST_SRCS += nettest_client.c
|
|
|
|
HOST_BIN = tcpclient$(EXEEXT)
|
2015-08-26 18:35:40 +02:00
|
|
|
else
|
2017-06-23 19:23:43 +02:00
|
|
|
HOST_SRCS += nettest_server.c
|
|
|
|
HOST_BIN = tcpserver$(EXEEXT)
|
2015-08-26 18:35:40 +02:00
|
|
|
endif
|
|
|
|
|
2017-06-23 19:23:43 +02:00
|
|
|
HOSTOBJEXT ?= hobj
|
|
|
|
HOST_OBJS = $(HOST_SRCS:.c=.$(HOSTOBJEXT))
|
2017-06-24 02:12:34 +02:00
|
|
|
|
|
|
|
endif
|
2011-03-20 19:18:19 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Common build
|
|
|
|
|
2017-06-25 17:15:27 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_TARGET2),y)
|
2015-08-26 18:35:40 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
2017-06-24 02:12:34 +02:00
|
|
|
|
2017-06-23 19:23:43 +02:00
|
|
|
$(HOST_OBJS): %.$(HOSTOBJEXT): %.c
|
2011-12-13 19:14:14 +01:00
|
|
|
@echo "CC: $<"
|
2015-01-22 22:30:23 +01:00
|
|
|
$(Q) $(HOSTCC) -c $(HOSTCFLAGS) $< -o $@
|
2017-06-24 02:12:34 +02:00
|
|
|
|
|
|
|
endif
|
2015-08-26 18:35:40 +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
|
|
|
|
2017-06-25 17:15:27 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_TARGET2),y)
|
2015-08-26 18:35:40 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
2017-06-24 02:12:34 +02:00
|
|
|
|
2015-01-21 01:12:27 +01:00
|
|
|
$(HOST_BIN): config.h $(HOST_OBJS)
|
2011-12-13 19:14:14 +01:00
|
|
|
@echo "LD: $@"
|
2015-01-22 22:30:23 +01:00
|
|
|
$(Q) $(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@
|
2017-06-24 02:12:34 +02:00
|
|
|
|
|
|
|
endif
|
2015-08-26 18:35:40 +02:00
|
|
|
endif
|
2015-01-21 01:12:27 +01:00
|
|
|
|
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::
|
2017-06-25 17:15:27 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_TARGET2),y)
|
2015-08-26 18:35:40 +02:00
|
|
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
2017-06-23 19:23:43 +02:00
|
|
|
$(call DELFILE, *.$(HOSTOBJEXT))
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, $(HOST_BIN))
|
2017-06-24 02:12:34 +02:00
|
|
|
endif
|
2015-08-26 18:35:40 +02:00
|
|
|
endif
|
2013-05-30 23:24:22 +02:00
|
|
|
$(call DELFILE, *.dSYM)
|
2015-01-21 01:12:27 +01:00
|
|
|
$(call DELFILE, config.h)
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
MODULE = CONFIG_EXAMPLES_NETTEST
|
2017-06-23 19:23:43 +02:00
|
|
|
|
2018-09-03 17:29:56 +02:00
|
|
|
include $(APPDIR)/Application.mk
|