summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/examples/adc/Makefile2
-rw-r--r--apps/examples/buttons/Makefile2
-rw-r--r--apps/examples/can/Makefile2
-rw-r--r--apps/examples/cc3000/Makefile2
-rw-r--r--apps/examples/configdata/Makefile2
-rw-r--r--apps/examples/cpuhog/Makefile2
-rw-r--r--apps/examples/dhcpd/Makefile2
-rw-r--r--apps/examples/discover/Makefile2
-rw-r--r--apps/examples/elf/Makefile2
-rw-r--r--apps/examples/flash_test/Makefile2
-rw-r--r--apps/examples/ftpc/Makefile2
-rw-r--r--apps/examples/ftpd/Makefile2
-rw-r--r--apps/examples/helloxx/Makefile24
-rw-r--r--apps/examples/hidkbd/Makefile2
-rw-r--r--apps/examples/i2schar/Makefile2
-rw-r--r--apps/examples/igmp/Makefile2
-rw-r--r--apps/examples/json/Makefile2
-rw-r--r--apps/examples/keypadtest/Makefile2
-rw-r--r--apps/examples/lcdrw/Makefile2
-rw-r--r--apps/examples/mm/Makefile2
-rw-r--r--apps/examples/modbus/Makefile2
-rw-r--r--apps/examples/mount/Makefile2
-rwxr-xr-xapps/examples/mtdpart/Makefile2
-rw-r--r--apps/examples/netpkt/Makefile2
-rw-r--r--apps/examples/nrf24l01_term/Makefile2
-rw-r--r--apps/examples/nsh/Makefile2
-rw-r--r--apps/examples/null/Makefile2
-rw-r--r--apps/examples/nx/Makefile2
-rw-r--r--apps/examples/nxconsole/Makefile2
-rw-r--r--apps/examples/nxffs/Makefile2
-rw-r--r--apps/examples/nxflat/Makefile2
-rw-r--r--apps/examples/nxhello/Makefile2
-rw-r--r--apps/examples/nximage/Makefile2
-rw-r--r--apps/examples/nxlines/Makefile2
-rw-r--r--apps/examples/nxtext/Makefile2
-rw-r--r--apps/examples/ostest/Makefile2
-rw-r--r--apps/examples/pashello/Makefile2
-rw-r--r--apps/examples/pipe/Makefile2
-rw-r--r--apps/examples/poll/Makefile2
-rw-r--r--apps/examples/posix_spawn/Makefile2
-rw-r--r--apps/examples/pwm/Makefile2
-rw-r--r--apps/examples/qencoder/Makefile2
-rw-r--r--apps/examples/random/Makefile2
-rw-r--r--apps/examples/relays/Makefile2
-rw-r--r--apps/examples/rgmp/Makefile2
-rw-r--r--apps/examples/romfs/Makefile2
-rw-r--r--apps/examples/sendmail/Makefile2
-rw-r--r--apps/examples/serialblaster/Makefile2
-rw-r--r--apps/examples/serialrx/Makefile2
-rw-r--r--apps/examples/serloop/Makefile2
-rw-r--r--apps/examples/slcd/Makefile2
-rw-r--r--apps/examples/smart/Makefile2
-rw-r--r--apps/examples/smart_test/Makefile2
-rw-r--r--apps/examples/tcpecho/Makefile2
-rw-r--r--apps/examples/telnetd/Makefile2
-rw-r--r--apps/examples/thttpd/Makefile2
-rw-r--r--apps/examples/tiff/Makefile2
-rw-r--r--apps/examples/touchscreen/Makefile2
-rw-r--r--apps/examples/usbserial/Makefile2
-rw-r--r--apps/examples/usbterm/Makefile2
-rw-r--r--apps/examples/watchdog/Makefile2
-rw-r--r--apps/examples/webserver/Makefile2
-rw-r--r--apps/examples/wget/Makefile2
-rw-r--r--apps/examples/wgetjson/Makefile2
-rw-r--r--apps/examples/xmlrpc/Makefile2
-rw-r--r--apps/graphics/screenshot/Makefile2
-rw-r--r--apps/netutils/thttpd/Makefile2
-rw-r--r--apps/system/cdcacm/Makefile2
-rw-r--r--apps/system/composite/Makefile2
-rw-r--r--apps/system/flash_eraseall/Makefile2
-rw-r--r--apps/system/free/Makefile2
-rw-r--r--apps/system/hex2bin/Makefile2
-rw-r--r--apps/system/i2c/Makefile2
-rw-r--r--apps/system/install/Makefile2
-rw-r--r--apps/system/mdio/Makefile2
-rw-r--r--apps/system/nxplayer/Makefile2
-rw-r--r--apps/system/poweroff/Makefile2
-rw-r--r--apps/system/prun/Makefile2
-rw-r--r--apps/system/ramtest/Makefile2
-rw-r--r--apps/system/ramtron/Makefile2
-rw-r--r--apps/system/sdcard/Makefile2
-rw-r--r--apps/system/sudoku/Makefile2
-rw-r--r--apps/system/sysinfo/Makefile2
-rw-r--r--apps/system/usbmsc/Makefile2
-rw-r--r--apps/system/vi/Makefile2
-rw-r--r--apps/system/zmodem/Makefile2
86 files changed, 107 insertions, 87 deletions
diff --git a/apps/examples/adc/Makefile b/apps/examples/adc/Makefile
index c90e265fa..475d94be9 100644
--- a/apps/examples/adc/Makefile
+++ b/apps/examples/adc/Makefile
@@ -45,7 +45,7 @@ CSRCS = adc_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/buttons/Makefile b/apps/examples/buttons/Makefile
index 8d28625de..9af24472a 100644
--- a/apps/examples/buttons/Makefile
+++ b/apps/examples/buttons/Makefile
@@ -45,7 +45,7 @@ CSRCS = buttons_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/can/Makefile b/apps/examples/can/Makefile
index 4dea6656d..59e9e4359 100644
--- a/apps/examples/can/Makefile
+++ b/apps/examples/can/Makefile
@@ -45,7 +45,7 @@ CSRCS = can_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/cc3000/Makefile b/apps/examples/cc3000/Makefile
index 339e11d3e..c98f14894 100644
--- a/apps/examples/cc3000/Makefile
+++ b/apps/examples/cc3000/Makefile
@@ -55,7 +55,7 @@ CSRCS = cc3000basic.c board.c shell.c telnetd_driver.c telnetd_daemon.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/configdata/Makefile b/apps/examples/configdata/Makefile
index 668f3c7c9..a2083657b 100644
--- a/apps/examples/configdata/Makefile
+++ b/apps/examples/configdata/Makefile
@@ -45,7 +45,7 @@ CSRCS = configdata_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/cpuhog/Makefile b/apps/examples/cpuhog/Makefile
index afad49791..429a9b3e6 100644
--- a/apps/examples/cpuhog/Makefile
+++ b/apps/examples/cpuhog/Makefile
@@ -45,7 +45,7 @@ CSRCS = cpuhog_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/dhcpd/Makefile b/apps/examples/dhcpd/Makefile
index 6c4543bec..e7fe4fa3e 100644
--- a/apps/examples/dhcpd/Makefile
+++ b/apps/examples/dhcpd/Makefile
@@ -45,7 +45,7 @@ CSRCS = target.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/discover/Makefile b/apps/examples/discover/Makefile
index 10188fb71..8d355e6cf 100644
--- a/apps/examples/discover/Makefile
+++ b/apps/examples/discover/Makefile
@@ -52,7 +52,7 @@ CSRCS = discover_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/elf/Makefile b/apps/examples/elf/Makefile
index 7a10a7e40..ed64e72df 100644
--- a/apps/examples/elf/Makefile
+++ b/apps/examples/elf/Makefile
@@ -45,7 +45,7 @@ CSRCS = elf_main.c symtab.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/flash_test/Makefile b/apps/examples/flash_test/Makefile
index f0c675c2e..22fa1c1ce 100644
--- a/apps/examples/flash_test/Makefile
+++ b/apps/examples/flash_test/Makefile
@@ -54,7 +54,7 @@ CSRCS = flash_test.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/ftpc/Makefile b/apps/examples/ftpc/Makefile
index 10c2f97ad..0a53098f8 100644
--- a/apps/examples/ftpc/Makefile
+++ b/apps/examples/ftpc/Makefile
@@ -49,7 +49,7 @@ CSRCS = ftpc_main.c ftpc_cmds.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/ftpd/Makefile b/apps/examples/ftpd/Makefile
index ba7721dba..d98d5960b 100644
--- a/apps/examples/ftpd/Makefile
+++ b/apps/examples/ftpd/Makefile
@@ -45,7 +45,7 @@ CSRCS = ftpd_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile
index f138cb2fb..204ed6881 100644
--- a/apps/examples/helloxx/Makefile
+++ b/apps/examples/helloxx/Makefile
@@ -41,15 +41,21 @@ include $(APPDIR)/Make.defs
ASRCS =
CSRCS =
-CXXSRCS = helloxx_main.cxx
+CXXSRCS =
+MAINSRC = helloxx_main.cxx
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
CXXOBJS = $(CXXSRCS:.cxx=$(OBJEXT))
+MAINOBJ = $(MAINSRC:.cxx=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS) $(CXXOBJS)
+ifneq ($(CONFIG_BUILD_KERNEL),y)
+ OBJS += $(MAINOBJ)
+endif
+
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
BIN = ..\..\libapps$(LIBEXT)
else
@@ -60,6 +66,9 @@ else
endif
endif
+CONFIG_EXAMPLES_HELLOXX_PROGNAME ?= helloxx$(EXEEXT)
+PROGNAME = $(CONFIG_EXAMPLES_HELLOXX_PROGNAME)
+
ROOTDEPPATH = --dep-path .
# helloxx built-in application info
@@ -100,8 +109,19 @@ $(CXXOBJS): %$(OBJEXT): %.cxx
$(call ARCHIVE, $(BIN), $(OBJS))
@touch .built
+feq ($(CONFIG_BUILD_KERNEL),y)
+$(BIN_DIR)$(DELIM)$(PROGNAME): $(OBJS) $(MAINOBJ)
+ @echo "LD: $(PROGNAME)"
+ $(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) -o $(INSTALL_DIR)$(DELIM)$(PROGNAME) $(ARCHCRT0OBJ) $(MAINOBJ) $(LDLIBS)
+ $(Q) $(NM) -u $(INSTALL_DIR)$(DELIM)$(PROGNAME)
+
+install: $(BIN_DIR)$(DELIM)$(PROGNAME)
+
+else
install:
+endif
+
ifeq ($(CONFIG_NSH_BUILTIN_APPS),y)
$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile
$(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
diff --git a/apps/examples/hidkbd/Makefile b/apps/examples/hidkbd/Makefile
index 41da3800a..b677ee12a 100644
--- a/apps/examples/hidkbd/Makefile
+++ b/apps/examples/hidkbd/Makefile
@@ -45,7 +45,7 @@ CSRCS = hidkbd_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/i2schar/Makefile b/apps/examples/i2schar/Makefile
index e0817d99e..246afb34b 100644
--- a/apps/examples/i2schar/Makefile
+++ b/apps/examples/i2schar/Makefile
@@ -51,7 +51,7 @@ endif
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/igmp/Makefile b/apps/examples/igmp/Makefile
index c1265295c..39c24b4b2 100644
--- a/apps/examples/igmp/Makefile
+++ b/apps/examples/igmp/Makefile
@@ -49,7 +49,7 @@ CSRCS = igmp.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/json/Makefile b/apps/examples/json/Makefile
index 0c806ee77..107e988c4 100644
--- a/apps/examples/json/Makefile
+++ b/apps/examples/json/Makefile
@@ -49,7 +49,7 @@ CSRCS = json_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/keypadtest/Makefile b/apps/examples/keypadtest/Makefile
index c207c6d9e..71616bab1 100644
--- a/apps/examples/keypadtest/Makefile
+++ b/apps/examples/keypadtest/Makefile
@@ -45,7 +45,7 @@ CSRCS = keypadtest_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/lcdrw/Makefile b/apps/examples/lcdrw/Makefile
index a6ee72afb..c5d3cd455 100644
--- a/apps/examples/lcdrw/Makefile
+++ b/apps/examples/lcdrw/Makefile
@@ -45,7 +45,7 @@ CSRCS = lcdrw_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/mm/Makefile b/apps/examples/mm/Makefile
index 8cbb5e4af..dc06e6d14 100644
--- a/apps/examples/mm/Makefile
+++ b/apps/examples/mm/Makefile
@@ -45,7 +45,7 @@ CSRCS = mm_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/modbus/Makefile b/apps/examples/modbus/Makefile
index 3e5b5b378..93e39f2e0 100644
--- a/apps/examples/modbus/Makefile
+++ b/apps/examples/modbus/Makefile
@@ -51,7 +51,7 @@ CSRCS = modbus_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/mount/Makefile b/apps/examples/mount/Makefile
index 48da4fe1f..3c6e553e4 100644
--- a/apps/examples/mount/Makefile
+++ b/apps/examples/mount/Makefile
@@ -45,7 +45,7 @@ CSRCS = mount_main.c ramdisk.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/mtdpart/Makefile b/apps/examples/mtdpart/Makefile
index cec032ac3..62427c77d 100755
--- a/apps/examples/mtdpart/Makefile
+++ b/apps/examples/mtdpart/Makefile
@@ -45,7 +45,7 @@ CSRCS = mtdpart_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/netpkt/Makefile b/apps/examples/netpkt/Makefile
index 91f610fa1..86602a22f 100644
--- a/apps/examples/netpkt/Makefile
+++ b/apps/examples/netpkt/Makefile
@@ -51,7 +51,7 @@ CSRCS = netpkt_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nrf24l01_term/Makefile b/apps/examples/nrf24l01_term/Makefile
index e837ad1aa..2dc0fe4a0 100644
--- a/apps/examples/nrf24l01_term/Makefile
+++ b/apps/examples/nrf24l01_term/Makefile
@@ -45,7 +45,7 @@ CSRCS = nrf24l01_term.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nsh/Makefile b/apps/examples/nsh/Makefile
index c282bd9a1..e5aac3037 100644
--- a/apps/examples/nsh/Makefile
+++ b/apps/examples/nsh/Makefile
@@ -45,7 +45,7 @@ CSRCS = nsh_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/null/Makefile b/apps/examples/null/Makefile
index eed20f334..20db85711 100644
--- a/apps/examples/null/Makefile
+++ b/apps/examples/null/Makefile
@@ -45,7 +45,7 @@ CSRCS = null_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nx/Makefile b/apps/examples/nx/Makefile
index 15c86b339..124336d95 100644
--- a/apps/examples/nx/Makefile
+++ b/apps/examples/nx/Makefile
@@ -48,7 +48,7 @@ endif
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nxconsole/Makefile b/apps/examples/nxconsole/Makefile
index a3930352e..1107e3a87 100644
--- a/apps/examples/nxconsole/Makefile
+++ b/apps/examples/nxconsole/Makefile
@@ -45,7 +45,7 @@ CSRCS = nxcon_main.c nxcon_toolbar.c nxcon_wndo.c nxcon_server.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nxffs/Makefile b/apps/examples/nxffs/Makefile
index bd8cd330e..2ed244f6b 100644
--- a/apps/examples/nxffs/Makefile
+++ b/apps/examples/nxffs/Makefile
@@ -45,7 +45,7 @@ CSRCS = nxffs_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nxflat/Makefile b/apps/examples/nxflat/Makefile
index 9273bcea1..003865051 100644
--- a/apps/examples/nxflat/Makefile
+++ b/apps/examples/nxflat/Makefile
@@ -45,7 +45,7 @@ CSRCS = nxflat_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nxhello/Makefile b/apps/examples/nxhello/Makefile
index 00af43a0e..4792e301e 100644
--- a/apps/examples/nxhello/Makefile
+++ b/apps/examples/nxhello/Makefile
@@ -45,7 +45,7 @@ CSRCS = nxhello_main.c nxhello_bkgd.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nximage/Makefile b/apps/examples/nximage/Makefile
index b087c7466..c31ed1954 100644
--- a/apps/examples/nximage/Makefile
+++ b/apps/examples/nximage/Makefile
@@ -45,7 +45,7 @@ CSRCS = nximage_main.c nximage_bkgd.c nximage_bitmap.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nxlines/Makefile b/apps/examples/nxlines/Makefile
index 8f7e0f49e..58271ccf4 100644
--- a/apps/examples/nxlines/Makefile
+++ b/apps/examples/nxlines/Makefile
@@ -45,7 +45,7 @@ CSRCS = nxlines_main.c nxlines_bkgd.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/nxtext/Makefile b/apps/examples/nxtext/Makefile
index 88d4e6161..596254bbf 100644
--- a/apps/examples/nxtext/Makefile
+++ b/apps/examples/nxtext/Makefile
@@ -49,7 +49,7 @@ endif
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile
index 63dd00fec..c3d4d474c 100644
--- a/apps/examples/ostest/Makefile
+++ b/apps/examples/ostest/Makefile
@@ -100,7 +100,7 @@ endif # CONFIG_DISABLE_SIGNALS
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/pashello/Makefile b/apps/examples/pashello/Makefile
index 4beb38819..9cddd5709 100644
--- a/apps/examples/pashello/Makefile
+++ b/apps/examples/pashello/Makefile
@@ -53,7 +53,7 @@ CSRCS = pashello.c device.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/pipe/Makefile b/apps/examples/pipe/Makefile
index d7b9c411e..611babf84 100644
--- a/apps/examples/pipe/Makefile
+++ b/apps/examples/pipe/Makefile
@@ -45,7 +45,7 @@ CSRCS = pipe_main.c transfer_test.c interlock_test.c redirect_test.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/poll/Makefile b/apps/examples/poll/Makefile
index f484492a5..4d7b600b4 100644
--- a/apps/examples/poll/Makefile
+++ b/apps/examples/poll/Makefile
@@ -45,7 +45,7 @@ CSRCS = poll_main.c poll_listener.c select_listener.c net_listener.c net_reader
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/posix_spawn/Makefile b/apps/examples/posix_spawn/Makefile
index 5fcca0a89..fe671ea63 100644
--- a/apps/examples/posix_spawn/Makefile
+++ b/apps/examples/posix_spawn/Makefile
@@ -45,7 +45,7 @@ CSRCS = spawn_main.c symtab.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/pwm/Makefile b/apps/examples/pwm/Makefile
index 1c3399fb1..bb209689c 100644
--- a/apps/examples/pwm/Makefile
+++ b/apps/examples/pwm/Makefile
@@ -45,7 +45,7 @@ CSRCS = pwm_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/qencoder/Makefile b/apps/examples/qencoder/Makefile
index 93ce320c1..371c13938 100644
--- a/apps/examples/qencoder/Makefile
+++ b/apps/examples/qencoder/Makefile
@@ -45,7 +45,7 @@ CSRCS = qe_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/random/Makefile b/apps/examples/random/Makefile
index 0a73fd9c2..01a8171ae 100644
--- a/apps/examples/random/Makefile
+++ b/apps/examples/random/Makefile
@@ -49,7 +49,7 @@ CSRCS = random_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/relays/Makefile b/apps/examples/relays/Makefile
index 211823237..2fb6d71a2 100644
--- a/apps/examples/relays/Makefile
+++ b/apps/examples/relays/Makefile
@@ -45,7 +45,7 @@ CSRCS = relays_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/rgmp/Makefile b/apps/examples/rgmp/Makefile
index 34a3485f6..a58849b4a 100644
--- a/apps/examples/rgmp/Makefile
+++ b/apps/examples/rgmp/Makefile
@@ -45,7 +45,7 @@ CSRCS = rgmp_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/romfs/Makefile b/apps/examples/romfs/Makefile
index c508cd1da..b7934312e 100644
--- a/apps/examples/romfs/Makefile
+++ b/apps/examples/romfs/Makefile
@@ -45,7 +45,7 @@ CSRCS = romfs_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/sendmail/Makefile b/apps/examples/sendmail/Makefile
index 68f8c69e2..6bc702763 100644
--- a/apps/examples/sendmail/Makefile
+++ b/apps/examples/sendmail/Makefile
@@ -45,7 +45,7 @@ CSRCS = target.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/serialblaster/Makefile b/apps/examples/serialblaster/Makefile
index 2eb55a8ef..ecb9f7376 100644
--- a/apps/examples/serialblaster/Makefile
+++ b/apps/examples/serialblaster/Makefile
@@ -45,7 +45,7 @@ CSRCS = serialblaster_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/serialrx/Makefile b/apps/examples/serialrx/Makefile
index 201aca2d6..9d2026ad8 100644
--- a/apps/examples/serialrx/Makefile
+++ b/apps/examples/serialrx/Makefile
@@ -45,7 +45,7 @@ CSRCS = serialrx_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/serloop/Makefile b/apps/examples/serloop/Makefile
index b93748d72..6ef6b5605 100644
--- a/apps/examples/serloop/Makefile
+++ b/apps/examples/serloop/Makefile
@@ -45,7 +45,7 @@ CSRCS = serloop_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/slcd/Makefile b/apps/examples/slcd/Makefile
index 464800690..4a633c8ea 100644
--- a/apps/examples/slcd/Makefile
+++ b/apps/examples/slcd/Makefile
@@ -51,7 +51,7 @@ CSRCS = slcd_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/smart/Makefile b/apps/examples/smart/Makefile
index 6a67d6138..250d0066e 100644
--- a/apps/examples/smart/Makefile
+++ b/apps/examples/smart/Makefile
@@ -45,7 +45,7 @@ CSRCS = smart_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/smart_test/Makefile b/apps/examples/smart_test/Makefile
index 469925648..a821948df 100644
--- a/apps/examples/smart_test/Makefile
+++ b/apps/examples/smart_test/Makefile
@@ -54,7 +54,7 @@ CSRCS = smart_test.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/tcpecho/Makefile b/apps/examples/tcpecho/Makefile
index 71534d9d3..01975fd02 100644
--- a/apps/examples/tcpecho/Makefile
+++ b/apps/examples/tcpecho/Makefile
@@ -52,7 +52,7 @@ CSRCS = tcpecho_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/telnetd/Makefile b/apps/examples/telnetd/Makefile
index 9c0f912bb..e54f163f6 100644
--- a/apps/examples/telnetd/Makefile
+++ b/apps/examples/telnetd/Makefile
@@ -45,7 +45,7 @@ CSRCS = telnetd.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/thttpd/Makefile b/apps/examples/thttpd/Makefile
index 26d860461..af6bf5378 100644
--- a/apps/examples/thttpd/Makefile
+++ b/apps/examples/thttpd/Makefile
@@ -45,7 +45,7 @@ CSRCS = thttpd_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/tiff/Makefile b/apps/examples/tiff/Makefile
index 769ac7cf1..e31883c13 100644
--- a/apps/examples/tiff/Makefile
+++ b/apps/examples/tiff/Makefile
@@ -45,7 +45,7 @@ CSRCS = tiff_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/touchscreen/Makefile b/apps/examples/touchscreen/Makefile
index 88eac7a92..5f0aa49e2 100644
--- a/apps/examples/touchscreen/Makefile
+++ b/apps/examples/touchscreen/Makefile
@@ -45,7 +45,7 @@ CSRCS = tc_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/usbserial/Makefile b/apps/examples/usbserial/Makefile
index 381b5783a..84ec60ea5 100644
--- a/apps/examples/usbserial/Makefile
+++ b/apps/examples/usbserial/Makefile
@@ -44,7 +44,7 @@ CSRCS = usbserial_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/usbterm/Makefile b/apps/examples/usbterm/Makefile
index 8ba9bc4a6..07b1f1f8a 100644
--- a/apps/examples/usbterm/Makefile
+++ b/apps/examples/usbterm/Makefile
@@ -45,7 +45,7 @@ CSRCS = usbterm_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/watchdog/Makefile b/apps/examples/watchdog/Makefile
index a5e1bb606..97ebdb8fc 100644
--- a/apps/examples/watchdog/Makefile
+++ b/apps/examples/watchdog/Makefile
@@ -45,7 +45,7 @@ CSRCS = watchdog_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/webserver/Makefile b/apps/examples/webserver/Makefile
index 85c5fbe49..87217f38f 100644
--- a/apps/examples/webserver/Makefile
+++ b/apps/examples/webserver/Makefile
@@ -45,7 +45,7 @@ CSRCS = webserver_main.c cgi.c httpd_fsdata.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/wget/Makefile b/apps/examples/wget/Makefile
index 92e15c106..9636b6e5a 100644
--- a/apps/examples/wget/Makefile
+++ b/apps/examples/wget/Makefile
@@ -45,7 +45,7 @@ CSRCS = target.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/wgetjson/Makefile b/apps/examples/wgetjson/Makefile
index b7431cf12..46c457aa5 100644
--- a/apps/examples/wgetjson/Makefile
+++ b/apps/examples/wgetjson/Makefile
@@ -45,7 +45,7 @@ CSRCS = wgetjson_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/examples/xmlrpc/Makefile b/apps/examples/xmlrpc/Makefile
index c2ce6aae9..57fd3552f 100644
--- a/apps/examples/xmlrpc/Makefile
+++ b/apps/examples/xmlrpc/Makefile
@@ -52,7 +52,7 @@ CSRCS = xmlrpc_main.c calls.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/graphics/screenshot/Makefile b/apps/graphics/screenshot/Makefile
index 31dcbba87..4786df1e4 100644
--- a/apps/graphics/screenshot/Makefile
+++ b/apps/graphics/screenshot/Makefile
@@ -49,7 +49,7 @@ CSRCS = screenshot_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/netutils/thttpd/Makefile b/apps/netutils/thttpd/Makefile
index 07492dced..62d0c83b4 100644
--- a/apps/netutils/thttpd/Makefile
+++ b/apps/netutils/thttpd/Makefile
@@ -49,7 +49,7 @@ endif
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/cdcacm/Makefile b/apps/system/cdcacm/Makefile
index be9ca2861..8084c4880 100644
--- a/apps/system/cdcacm/Makefile
+++ b/apps/system/cdcacm/Makefile
@@ -45,7 +45,7 @@ CSRCS = cdcacm_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/composite/Makefile b/apps/system/composite/Makefile
index bd233f4cc..6edc5f403 100644
--- a/apps/system/composite/Makefile
+++ b/apps/system/composite/Makefile
@@ -45,7 +45,7 @@ CSRCS = composite_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/flash_eraseall/Makefile b/apps/system/flash_eraseall/Makefile
index df521af35..40d0dc43b 100644
--- a/apps/system/flash_eraseall/Makefile
+++ b/apps/system/flash_eraseall/Makefile
@@ -59,7 +59,7 @@ CSRCS = flash_eraseall.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/free/Makefile b/apps/system/free/Makefile
index f155db19b..9f1edf527 100644
--- a/apps/system/free/Makefile
+++ b/apps/system/free/Makefile
@@ -55,7 +55,7 @@ CSRCS = free.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/hex2bin/Makefile b/apps/system/hex2bin/Makefile
index ffbfcf444..d77768778 100644
--- a/apps/system/hex2bin/Makefile
+++ b/apps/system/hex2bin/Makefile
@@ -53,7 +53,7 @@ endif
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/i2c/Makefile b/apps/system/i2c/Makefile
index 7c66dcf30..a72713298 100644
--- a/apps/system/i2c/Makefile
+++ b/apps/system/i2c/Makefile
@@ -45,7 +45,7 @@ CSRCS = i2c_bus.c i2c_common.c i2c_dev.c i2c_get.c i2c_main.c i2c_set.c i2c_verf
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/install/Makefile b/apps/system/install/Makefile
index df1ab3fe8..f664f21a1 100644
--- a/apps/system/install/Makefile
+++ b/apps/system/install/Makefile
@@ -59,7 +59,7 @@ CSRCS = install.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/mdio/Makefile b/apps/system/mdio/Makefile
index faff0e24d..4352a5b57 100644
--- a/apps/system/mdio/Makefile
+++ b/apps/system/mdio/Makefile
@@ -51,7 +51,7 @@ CSRCS = mdio_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/nxplayer/Makefile b/apps/system/nxplayer/Makefile
index 05a91ca1b..110319a78 100644
--- a/apps/system/nxplayer/Makefile
+++ b/apps/system/nxplayer/Makefile
@@ -61,7 +61,7 @@ endif
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/poweroff/Makefile b/apps/system/poweroff/Makefile
index 69a6c1734..cd1dc7d81 100644
--- a/apps/system/poweroff/Makefile
+++ b/apps/system/poweroff/Makefile
@@ -59,7 +59,7 @@ CSRCS = poweroff.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/prun/Makefile b/apps/system/prun/Makefile
index 8f640582c..48ba233f4 100644
--- a/apps/system/prun/Makefile
+++ b/apps/system/prun/Makefile
@@ -65,7 +65,7 @@ endif
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/ramtest/Makefile b/apps/system/ramtest/Makefile
index 6d2f9cc3e..b7ef04b39 100644
--- a/apps/system/ramtest/Makefile
+++ b/apps/system/ramtest/Makefile
@@ -52,7 +52,7 @@ CSRCS = ramtest.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/ramtron/Makefile b/apps/system/ramtron/Makefile
index 2ebdf9cf8..ad0579138 100644
--- a/apps/system/ramtron/Makefile
+++ b/apps/system/ramtron/Makefile
@@ -59,7 +59,7 @@ CSRCS = ramtron.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/sdcard/Makefile b/apps/system/sdcard/Makefile
index 91aa5268a..961cd54a5 100644
--- a/apps/system/sdcard/Makefile
+++ b/apps/system/sdcard/Makefile
@@ -59,7 +59,7 @@ CSRCS = sdcard.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/sudoku/Makefile b/apps/system/sudoku/Makefile
index cc16da134..6cca9af4d 100644
--- a/apps/system/sudoku/Makefile
+++ b/apps/system/sudoku/Makefile
@@ -55,7 +55,7 @@ CSRCS = sudoku.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/sysinfo/Makefile b/apps/system/sysinfo/Makefile
index 92e3725c8..ef5c6ca34 100644
--- a/apps/system/sysinfo/Makefile
+++ b/apps/system/sysinfo/Makefile
@@ -60,7 +60,7 @@ CSRCS = sysinfo.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/usbmsc/Makefile b/apps/system/usbmsc/Makefile
index 17b5ae295..2f62907cf 100644
--- a/apps/system/usbmsc/Makefile
+++ b/apps/system/usbmsc/Makefile
@@ -45,7 +45,7 @@ CSRCS = usbmsc_main.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/vi/Makefile b/apps/system/vi/Makefile
index d8111f722..eb1b10c69 100644
--- a/apps/system/vi/Makefile
+++ b/apps/system/vi/Makefile
@@ -56,7 +56,7 @@ CSRCS = vi.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
diff --git a/apps/system/zmodem/Makefile b/apps/system/zmodem/Makefile
index ded531381..f544bf309 100644
--- a/apps/system/zmodem/Makefile
+++ b/apps/system/zmodem/Makefile
@@ -55,7 +55,7 @@ CSRCS += zm_state.c zm_proto.c zm_watchdog.c zm_utils.c zm_dumpbuffer.c
AOBJS = $(ASRCS:.S=$(OBJEXT))
COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
+SRCS = $(ASRCS) $(CSRCS) $(MAINSRC)
OBJS = $(AOBJS) $(COBJS)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)