examples/nettest: More prep for a second target

This commit is contained in:
Gregory Nutt 2017-06-23 15:49:27 -06:00
parent cde3cb1544
commit 1c0f237c06
2 changed files with 41 additions and 29 deletions

View File

@ -12,20 +12,20 @@ config EXAMPLES_NETTEST
if EXAMPLES_NETTEST
config EXAMPLES_NETTEST_PROGNAME
string "Program name"
config EXAMPLES_NETTEST_PROGNAME1
string "Target1 program name"
default "nettest"
depends on BUILD_KERNEL
---help---
This is the name of the program that will be use when the Nettest
program is installed.
config EXAMPLES_NETTEST_STACKSIZE
int "Nettest stack size"
config EXAMPLES_NETTEST_STACKSIZE1
int "Target1 stack size"
default 2048
config EXAMPLES_NETTEST_PRIORITY
int "Nettest priority"
config EXAMPLES_NETTEST_PRIORITY1
int "Target1 priority"
default 100
config EXAMPLES_NETTEST_LOOPBACK
@ -48,8 +48,8 @@ config EXAMPLES_NETTEST_SERVER_PRIORITY
endif # EXAMPLES_NETTEST_LOOPBACK
config EXAMPLES_NETTEST_SERVER
bool "Target is server"
config EXAMPLES_NETTEST_SERVER1
bool "Target1 is server"
default n
depends on !EXAMPLES_NETTEST_LOOPBACK
---help---

View File

@ -46,7 +46,7 @@ endif
TARGCMN_COBJS = $(TARGCMN_CSRCS:.c=$(OBJEXT))
# Target 1
# Target 1 Files
TARG1_CSRCS =
ifeq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
@ -64,6 +64,28 @@ TARG1_MAINOBJ = $(TARG1_MAINSRC:.c=$(OBJEXT))
TARG_CSRCS = $(TARG1_CSRCS) $(TARG1_CSRCS) $(TARGCMN_CSRCS)
TARG_OBJS = $(TARG1_COBJS) $(TARGCMN_COBJS)
# Target 1 Application Info
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER1),y)
CONFIG_EXAMPLES_NETTEST_PROGNAME1 ?= tcpserver
APPNAME1 = tcpserver
else
CONFIG_EXAMPLES_NETTEST_PROGNAME1 ?= tcpclient
APPNAME1 = tcpclient
endif
CONFIG_EXAMPLES_NETTEST_PRIORITY1 ?= 100
CONFIG_EXAMPLES_NETTEST_STACKSIZE1 ?= 2048
PROGNAME1 = $(CONFIG_EXAMPLES_NETTEST_PROGNAME1)
PRIORITY1 = $(CONFIG_EXAMPLES_NETTEST_PRIORITY1)
STACKSIZE1 = $(CONFIG_EXAMPLES_NETTEST_STACKSIZE1)
# Target 2
# Target 2 Application Info
# Target common
ifneq ($(CONFIG_BUILD_KERNEL),y)
TARG_OBJS += $(TARG1_MAINOBJ)
endif
@ -78,6 +100,8 @@ else
endif
endif
# Host
ifneq ($(CONFIG_EXAMPLES_NETTEST_LOOPBACK),y)
HOSTCFLAGS += -DNETTEST_HOST=1
ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y)
@ -108,18 +132,6 @@ endif
ROOTDEPPATH = --dep-path .
# NET test built-in application info
CONFIG_EXAMPLES_NETTEST_STACKSIZE ?= 2048
CONFIG_EXAMPLES_NETTEST_PRIORITY ?= 100
APPNAME = nettest
PRIORITY = $(CONFIG_EXAMPLES_NETTEST_PRIORITY)
STACKSIZE = $(CONFIG_EXAMPLES_NETTEST_STACKSIZE)
CONFIG_EXAMPLES_NETTEST_PROGNAME ?= nettest$(EXEEXT)
PROGNAME = $(CONFIG_EXAMPLES_HELLO_PROGNAME)
# Common build
VPATH =
@ -151,12 +163,12 @@ endif
$(Q) touch .built
ifeq ($(CONFIG_BUILD_KERNEL),y)
$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(TARG1_MAINOBJ)
@echo "LD: $(PROGNAME)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(TARG1_MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
$(BIN_DIR)$(DELIM)$(PROGNAME1): $(OBJS) $(TARG1_MAINOBJ)
@echo "LD: $(PROGNAME1)"
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME1) $(ARCHCRT0OBJ) $(TARG1_MAINOBJ) $(LDLIBS)
$(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME1)
install: $(BIN_DIR)$(DELIM)$(PROGNAME)
install: $(BIN_DIR)$(DELIM)$(PROGNAME1)
else
install:
@ -164,10 +176,10 @@ install:
endif
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main)
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat
context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat
else
context:
endif