From 132ecbec2f73e96d9c7691477f089fbe57477da8 Mon Sep 17 00:00:00 2001
From: Deomid Ryabkov <rojer@cesanta.com>
Date: Wed, 28 Mar 2018 13:25:30 +0100
Subject: [PATCH] Fix Mongoose and Frozen include paths

In preparation for making moving to lib.
Reduce amount of makefile copypasta a bit.

CL: none

PUBLISHED_FROM=70a016491f9605e37708385bdd698f48a8d64119
---
 src/common/platforms/esp8266/esp_crypto.c | 2 +-
 tools/amalgam.py                          | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/common/platforms/esp8266/esp_crypto.c b/src/common/platforms/esp8266/esp_crypto.c
index 822dab198..3d2afa144 100644
--- a/src/common/platforms/esp8266/esp_crypto.c
+++ b/src/common/platforms/esp8266/esp_crypto.c
@@ -7,7 +7,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 
-#include "mongoose/mongoose.h"
+#include "mongoose.h"
 
 #ifdef RTOS_SDK
 #include "esp_libc.h"
diff --git a/tools/amalgam.py b/tools/amalgam.py
index 3776d12a3..f40ca7cd5 100755
--- a/tools/amalgam.py
+++ b/tools/amalgam.py
@@ -57,7 +57,7 @@ parser.add_argument('--norel', action='store_true',
                     help="do not try to compute a friendly relative path")
 parser.add_argument('--exportable-headers', dest="export", action='store_true',
                     help='allow exporting internal headers')
-parser.add_argument('-I', default=".", dest='include_path', help='include path')
+parser.add_argument('-I', default=['.'], dest='include_path', help='include path', action='append')
 parser.add_argument('sources', nargs='*', help='sources')
 
 class File(object):
@@ -97,10 +97,13 @@ def resolve(path, parent_name):
     elif path_from_parent != None and os.path.exists(path_from_parent):
         p = path_from_parent
     else:
-        p = os.path.join(args.include_path, path)
+        for ip in args.include_path:
+            p = os.path.join(ip, path)
+            if os.path.exists(p):
+                break
     if os.path.exists(p) and not args.norel:
         p = os.path.realpath(p).replace('%s%s' % (os.getcwd(), os.sep), '')
-    # print >>sys.stderr, '%s -> %s (cwd %s)' % (path, p, os.getcwd())
+    # print >>sys.stderr, '%s %s -> %s (cwd %s)' % (path, parent_name, p, os.getcwd())
     return p.replace(os.sep, '/')
 
 def emit_line_directive(out, name, parent_name):
-- 
GitLab