This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ad9525c3 Application: fix multiple main target mismatch during 
incremental compile
7ad9525c3 is described below

commit 7ad9525c357adee503bb68d9aeb1c1e08b8332f3
Author: chao an <[email protected]>
AuthorDate: Tue Feb 28 14:45:50 2023 +0800

    Application: fix multiple main target mismatch during incremental compile
    
    MAINSRC will fail to match with PROGNAME if one of main source is changed 
in incremental compilation
    this PR will correct this issue.
    
    Signed-off-by: chao an <[email protected]>
---
 Application.mk | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/Application.mk b/Application.mk
index c54829a13..265e34ba7 100644
--- a/Application.mk
+++ b/Application.mk
@@ -203,16 +203,16 @@ else
 MAINNAME := $(addsuffix _main,$(PROGNAME))
 
 $(MAINCXXOBJ): %$(CXXEXT)$(SUFFIX)$(OBJEXT): %$(CXXEXT)
-       $(eval $<_CXXFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(firstword 
$(MAINNAME))})
-       $(eval $<_CXXELFFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(firstword 
$(MAINNAME))})
-       $(eval MAINNAME=$(filter-out $(firstword $(MAINNAME)),$(MAINNAME)))
+       $(eval MAIN=$(word $(call GETINDEX,$<,$(MAINCXXSRCS)),$(MAINNAME)))
+       $(eval $<_CXXFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(MAIN)})
+       $(eval $<_CXXELFFLAGS += ${shell $(DEFINE) "$(CXX)" main=$(MAIN)})
        $(if $(and $(CONFIG_BUILD_LOADABLE),$(CXXELFFLAGS)), \
                $(call ELFCOMPILEXX, $<, $@), $(call COMPILEXX, $<, $@))
 
 $(MAINCOBJ): %.c$(SUFFIX)$(OBJEXT): %.c
-       $(eval $<_CFLAGS += ${DEFINE_PREFIX}main=$(firstword $(MAINNAME)))
-       $(eval $<_CELFFLAGS += ${DEFINE_PREFIX}main=$(firstword $(MAINNAME)))
-       $(eval MAINNAME=$(filter-out $(firstword $(MAINNAME)),$(MAINNAME)))
+       $(eval MAIN=$(word $(call GETINDEX,$<,$(MAINCSRCS)),$(MAINNAME)))
+       $(eval $<_CFLAGS += ${DEFINE_PREFIX}main=$(MAIN))
+       $(eval $<_CELFFLAGS += ${DEFINE_PREFIX}main=$(MAIN))
        $(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
                $(call ELFCOMPILE, $<, $@), $(call COMPILE, $<, $@))
 

Reply via email to