From 94a953d3e34bb2c9afcc5b7e42ccd4eef3098860 Mon Sep 17 00:00:00 2001
From: Michael Jacobsen <michael@Michaels-iMac.local>
Date: Fri, 21 Aug 2015 08:30:52 +0200
Subject: [PATCH] Header files re-arrangement

---
 common.mk                                               | 2 +-
 examples/cpp_01_tasks/Makefile                          | 2 ++
 examples/cpp_01_tasks/main.cpp                          | 6 +++---
 extras/cpp_support/component.mk                         | 8 ++++++++
 extras/{timer => cpp_support/include}/countdown.hpp     | 0
 extras/{cplusplus => cpp_support/include}/cplusplus.hpp | 0
 extras/{thread => cpp_support/include}/mutex.hpp        | 0
 extras/{thread => cpp_support/include}/queue.hpp        | 0
 extras/{thread => cpp_support/include}/task.hpp         | 0
 9 files changed, 14 insertions(+), 4 deletions(-)
 create mode 100644 extras/cpp_support/component.mk
 rename extras/{timer => cpp_support/include}/countdown.hpp (100%)
 rename extras/{cplusplus => cpp_support/include}/cplusplus.hpp (100%)
 rename extras/{thread => cpp_support/include}/mutex.hpp (100%)
 rename extras/{thread => cpp_support/include}/queue.hpp (100%)
 rename extras/{thread => cpp_support/include}/task.hpp (100%)

diff --git a/common.mk b/common.mk
index a73092c..342bae2 100644
--- a/common.mk
+++ b/common.mk
@@ -177,7 +177,7 @@ IMGTOOL_ARGS=-$(IMGTOOL_FLASH_SIZE) -$(FLASH_MODE) -$(FLASH_SPEED)
 # Placing $(PROGRAM_DIR) and $(PROGRAM_DIR)include first allows
 # programs to have their own copies of header config files for components
 # , which is useful for overriding things.
-INC_DIRS      = $(PROGRAM_DIR) $(PROGRAM_DIR)include $(ROOT)include $(ROOT)extras
+INC_DIRS      = $(PROGRAM_DIR) $(PROGRAM_DIR)include $(ROOT)include
 
 ifeq ($(OWN_LIBC),1)
     INC_DIRS += $(ROOT)libc/xtensa-lx106-elf/include
diff --git a/examples/cpp_01_tasks/Makefile b/examples/cpp_01_tasks/Makefile
index 458932f..f9254cf 100644
--- a/examples/cpp_01_tasks/Makefile
+++ b/examples/cpp_01_tasks/Makefile
@@ -1,3 +1,5 @@
 # Simple makefile for simple example
 PROGRAM=cpp_01_tasks
+OTA=0
+EXTRA_COMPONENTS=extras/cpp_support
 include ../../common.mk
diff --git a/examples/cpp_01_tasks/main.cpp b/examples/cpp_01_tasks/main.cpp
index 0b9fe1f..219be74 100644
--- a/examples/cpp_01_tasks/main.cpp
+++ b/examples/cpp_01_tasks/main.cpp
@@ -26,9 +26,9 @@
  * 
  */
 
-#include "cplusplus/cplusplus.hpp"
-#include "thread/task.hpp"
-#include "thread/queue.hpp"
+#include "cplusplus.hpp"
+#include "task.hpp"
+#include "queue.hpp"
 
 #include "espressif/esp_common.h"
 
diff --git a/extras/cpp_support/component.mk b/extras/cpp_support/component.mk
new file mode 100644
index 0000000..6bc4ada
--- /dev/null
+++ b/extras/cpp_support/component.mk
@@ -0,0 +1,8 @@
+# Component makefile for extras/cpp_support
+INC_DIRS += $(ROOT)extras/cpp_support/include
+
+# args for passing into compile rule generation
+# extras/mqtt-client_INC_DIR =  $(ROOT)extras/mqtt-client
+# extras/mqtt-client_SRC_DIR =  $(ROOT)extras/mqtt-client
+
+# $(eval $(call component_compile_rules,extras/mqtt-client))
diff --git a/extras/timer/countdown.hpp b/extras/cpp_support/include/countdown.hpp
similarity index 100%
rename from extras/timer/countdown.hpp
rename to extras/cpp_support/include/countdown.hpp
diff --git a/extras/cplusplus/cplusplus.hpp b/extras/cpp_support/include/cplusplus.hpp
similarity index 100%
rename from extras/cplusplus/cplusplus.hpp
rename to extras/cpp_support/include/cplusplus.hpp
diff --git a/extras/thread/mutex.hpp b/extras/cpp_support/include/mutex.hpp
similarity index 100%
rename from extras/thread/mutex.hpp
rename to extras/cpp_support/include/mutex.hpp
diff --git a/extras/thread/queue.hpp b/extras/cpp_support/include/queue.hpp
similarity index 100%
rename from extras/thread/queue.hpp
rename to extras/cpp_support/include/queue.hpp
diff --git a/extras/thread/task.hpp b/extras/cpp_support/include/task.hpp
similarity index 100%
rename from extras/thread/task.hpp
rename to extras/cpp_support/include/task.hpp