2011-03-20 19:18:19 +01:00
|
|
|
############################################################################
|
|
|
|
# apps/examples/udp/Makefile
|
|
|
|
#
|
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
|
|
|
|
|
|
|
# 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
|
2020-05-19 15:56:39 +02:00
|
|
|
HOST_BIN = udpclient$(HOSTEXEEXT)
|
2011-03-20 19:18:19 +01:00
|
|
|
else
|
2017-06-19 17:46:40 +02:00
|
|
|
HOST_SRCS += udp_server.c
|
2020-05-19 15:56:39 +02:00
|
|
|
HOST_BIN = udpserver$(HOSTEXEEXT)
|
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)
|
|
|
|
|
2020-06-02 09:24:10 +02:00
|
|
|
$(HOST_OBJS): config.h
|
|
|
|
|
|
|
|
$(HOST_BIN): $(HOST_OBJS)
|
2015-01-22 22:30:23 +01:00
|
|
|
$(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
|