From a67546d23211739fe05370209b5dd25ccdc46e7e Mon Sep 17 00:00:00 2001
From: Daniel Agar <daniel@agar.ca>
Date: Sat, 12 Mar 2016 15:55:42 -0500
Subject: [PATCH] Makefile add package_firmware

---
 .travis.yml | 4 ++--
 Makefile    | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 8f9edfa714..3660b94f2c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -115,11 +115,11 @@ script:
 
 after_success:
   - if [[ "${TRAVIS_OS_NAME}" = "linux" && "${GCC_VER}" = "4.8" ]]; then
-         cp build_px4fmu-v1_default/src/firmware/nuttx/nuttx-px4fmu-v1-default.px4 px4fmu-v1_default.px4
+         make package_firmware
+      && cp build_px4fmu-v1_default/src/firmware/nuttx/nuttx-px4fmu-v1-default.px4 px4fmu-v1_default.px4
       && cp build_px4fmu-v2_default/src/firmware/nuttx/nuttx-px4fmu-v2-default.px4 px4fmu-v2_default.px4
       && cp build_px4fmu-v4_default/src/firmware/nuttx/nuttx-px4fmu-v4-default.px4 px4fmu-v4_default.px4
       && cp build_px4-stm32f4discovery_default/src/firmware/nuttx/nuttx-px4-stm32f4discovery-default.px4 px4-stm32f4discovery-default.px4
-      && zip Firmware.zip px4fmu-v1_default.px4 px4fmu-v2_default.px4 px4fmu-v4_default.px4 px4-stm32f4discovery-default.px4
       && ./CI-Tools/s3cmd-put px4fmu-v1_default.px4 px4fmu-v2_default.px4 px4fmu-v4_default.px4 px4-stm32f4discovery-default.px4 build_px4fmu-v2_default/parameters.xml build_px4fmu-v2_default/airframes.xml CI-Tools/directory/index.html Firmware/$TRAVIS_BRANCH/
       && ./CI-Tools/s3cmd-put Firmware.zip archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID/
       && ./CI-Tools/s3cmd-put CI-Tools/directory/index.html archives/Firmware/$TRAVIS_BRANCH/
diff --git a/Makefile b/Makefile
index 55e3ebbf22..124c37fdb0 100644
--- a/Makefile
+++ b/Makefile
@@ -203,6 +203,9 @@ check: px4fmu-v1_default px4fmu-v2_default px4fmu-v4_default px4-stm32f4discover
 tests: posix_sitl_default
 	@(cd unittests && ./run_tests.sh)
 
+package_firmware:
+	@zip --junk-paths Firmware.zip `find . -name \*.px4`
+
 clean:
 	@rm -rf build_*/
 	@(cd NuttX/nuttx && make clean)
-- 
GitLab