2011-03-20 19:18:19 +01:00
|
|
|
############################################################################
|
2022-03-08 23:05:12 +01:00
|
|
|
# apps/examples/nettest/Makefile
|
2011-03-20 19:18:19 +01:00
|
|
|
#
|
2021-06-07 17:31:08 +02:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership. The
|
|
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance with the
|
|
|
|
# License. You may obtain a copy of the License at
|
2011-03-20 19:18:19 +01:00
|
|
|
#
|
2021-06-07 17:31:08 +02:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2011-03-20 19:18:19 +01:00
|
|
|
#
|
2021-06-07 17:31:08 +02:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
2011-03-20 19:18:19 +01:00
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2020-05-20 06:35:03 +02:00
|
|
|
include $(APPDIR)/Make.defs
|
2011-03-20 19:18:19 +01:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
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)
|
|
|
|
|
2019-10-06 14:14:39 +02:00
|
|
|
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),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
|
|
|
|
|
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
|
|
|
|
|
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
|
2020-05-19 15:56:39 +02:00
|
|
|
HOST_BIN = tcpclient$(HOSTEXEEXT)
|
2015-08-26 18:35:40 +02:00
|
|
|
else
|
2017-06-23 19:23:43 +02:00
|
|
|
HOST_SRCS += nettest_server.c
|
2020-05-19 15:56:39 +02:00
|
|
|
HOST_BIN = tcpserver$(HOSTEXEEXT)
|
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
|
|
|
|
2011-03-20 19:18:19 +01:00
|
|
|
# Common build
|
|
|
|
|
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
|
|
|
|
2019-10-19 00:24:43 +02:00
|
|
|
endif
|
|
|
|
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_NETTEST_TARGET2),y)
|
|
|
|
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
|
|
|
|
|
2020-06-02 09:24:10 +02:00
|
|
|
$(HOST_OBJS): config.h
|
|
|
|
|
|
|
|
$(HOST_BIN): $(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
|
|
|
|
2019-10-19 00:24:43 +02:00
|
|
|
endif
|
|
|
|
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_NETTEST_TARGET2),y)
|
|
|
|
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))
|
2013-05-30 23:24:22 +02:00
|
|
|
$(call DELFILE, *.dSYM)
|
2019-10-06 14:14:39 +02:00
|
|
|
endif
|
|
|
|
endif
|
2019-10-19 00:24:43 +02:00
|
|
|
$(call DELFILE, config.h)
|
2019-10-06 14:14:39 +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
|