You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2020/01/17 19:26:59 UTC

[incubator-nuttx-apps] branch master updated: apps/Makefile: Fix APPDIR path for native build.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 367b4d7  apps/Makefile:  Fix APPDIR path for native build.
367b4d7 is described below

commit 367b4d7e5b14611b52106bd1d867f7b241b01b3f
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Fri Jan 17 16:22:54 2020 -0300

    apps/Makefile:  Fix APPDIR path for native build.
    
        A recent change gets the APPSDIR root directory path from:
    
            APPSDIR = $(CURDIR)
    
        Where CURDIR is a special variable maintained by GNU make.  In the native build, GNU make is provided by GNUWin32.  The value of CURDIR provided by the GNUWin32 CURDIR is not POSIX, but not quite windows compatible either.  It does return paths that start with C: or D:, but uses forward slashes for path segment delimiters, not backsalshes as required by Windows tools.
    
        This fix here is to use $(CURDIR) to get the APPSDIR path for file inclusions, that part is fine.  But then, if we find out we are doing a native build, the update the APPSDIR using shell %CD% environment variable which is the authoritative source of the current working directory under Windows.
---
 Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Makefile b/Makefile
index 8d59176..e0ad31f 100644
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,16 @@ TOPDIR ?= $(APPDIR)/import
 -include $(TOPDIR)/Make.defs
 -include $(APPDIR)/Make.defs
 
+# The GNU make CURDIR will always be a POSIX-like path with forward slashes
+# as path segment separators.  This is fine for the above inclusions but
+# will cause problems later for the native build.  If we know that this is
+# a native build, then we need to fix up the APPDIR path for subsequent
+# use
+
+ifeq ($(CONFIG_WINDOWS_NATIVE),y)
+APPDIR := ${shell echo %CD%}
+endif
+
 # Symbol table for loadable apps.
 
 SYMTABSRC = symtab_apps.c