From b937618e59a888f653d8f1e1b6b38d5228efdaff Mon Sep 17 00:00:00 2001
From: Lorenz Meier <lm@inf.ethz.ch>
Date: Fri, 11 Mar 2016 11:59:49 +0100
Subject: [PATCH] Improved CMAKE return value checking and ensured that fresh
 checkouts initialize the GIT submodules correctly

---
 Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index fcbbaea789..cd408c35bb 100644
--- a/Makefile
+++ b/Makefile
@@ -109,7 +109,7 @@ endif
 # describe how to build a cmake config
 define cmake-build
 +@if [ $(PX4_CMAKE_GENERATOR) = "Ninja" ] && [ -e $(PWD)/build_$@/Makefile ]; then rm -rf $(PWD)/build_$@; fi
-+@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G$(PX4_CMAKE_GENERATOR) -DCONFIG=$(1); fi
++@if [ ! -e $(PWD)/build_$@/CMakeCache.txt ]; then Tools/check_submodules.sh && mkdir -p $(PWD)/build_$@ && cd $(PWD)/build_$@ && cmake .. -G$(PX4_CMAKE_GENERATOR) -DCONFIG=$(1) || (cd .. && rm -rf $(PWD)/build_$@); fi
 +Tools/check_submodules.sh
 +$(PX4_MAKE) -C $(PWD)/build_$@ $(PX4_MAKE_ARGS) $(ARGS)
 endef
@@ -196,9 +196,7 @@ check_format:
 
 clean:
 	@rm -rf build_*/
-	@(cd NuttX && git clean -d -f -x)
-	@(cd src/modules/uavcan/libuavcan && git clean -d -f -x)
-	@(git submodule sync --recursive)
+	@(cd NuttX/nuttx && make clean)
 
 # targets handled by cmake
 cmake_targets = test upload package package_source debug debug_tui debug_ddd debug_io debug_io_tui debug_io_ddd check_weak \
-- 
GitLab