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:21:01 UTC

[incubator-nuttx-apps] 01/02: 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 pr21
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 7e3cd91c2648d71da53e1749abe8836130afd682
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Fri Jan 17 12:53:31 2020 -0600

    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 | 9 +++++++++
 1 file changed, 9 insertions(+)

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