2 # Installers for tools required by the OpenPilot build system.
3 # Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
5 # NOTE: install targets are not tied to the default goals and must
6 # be invoked manually. But tool paths set by this file are used
7 # across the build system.
12 # nsis_install (Windows only)
13 # sdl_install (Windows only)
14 # openssl_install (Windows only)
15 # mesawin_install (Windows only)
24 # openocd_git_win_install
31 # help in the top Makefile
33 # This program is free software; you can redistribute it and/or modify
34 # it under the terms of the GNU General Public License as published by
35 # the Free Software Foundation; either version 3 of the License, or
36 # (at your option) any later version.
38 # This program is distributed in the hope that it will be useful, but
39 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
40 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
43 # You should have received a copy of the GNU General Public License along
44 # with this program; if not, write to the Free Software Foundation, Inc.,
45 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
48 ifndef OPENPILOT_IS_COOL
49 $(error
$(notdir $(lastword
$(MAKEFILE_LIST
))) should be included by the top level Makefile
)
52 ##############################
54 # Toolchain URLs and directories
56 ##############################
58 ifeq ($(UNAME
), Linux
)
59 ifeq ($(ARCH
), x86_64
)
60 ARM_SDK_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.9/4.9-2014-q4-major
/+download
/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.
tar.bz2
61 ARM_SDK_MD5_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.9/4.9-2014-q4-major
/+download
/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.
tar.bz2
/+md5
62 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/5.4/5.4.1/qt-opensource-linux-x64-5.4
.1.run
63 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/5.4/5.4.1/qt-opensource-linux-x64-5.4
.1.run.md5
66 ARM_SDK_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.9/4.9-2014-q4-major
/+download
/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.
tar.bz2
67 ARM_SDK_MD5_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.9/4.9-2014-q4-major
/+download
/gcc-arm-none-eabi-4_9-2014q4-20141203-linux.
tar.bz2
/+md5
68 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/5.4/5.4.1/qt-opensource-linux-x86-5.4
.1.run
69 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/5.4/5.4.1/qt-opensource-linux-x86-5.4
.1.run.md5
72 UNCRUSTIFY_URL
:= http
://librepilot.github.io
/tools
/uncrustify-0.60.
tar.gz
73 DOXYGEN_URL
:= http
://librepilot.github.io
/tools
/doxygen-1.8
.3.1.src.
tar.gz
74 else ifeq ($(UNAME
), Darwin
)
75 ARM_SDK_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.9/4.9-2014-q4-major
/+download
/gcc-arm-none-eabi-4_9-2014q4-20141203-mac.
tar.bz2
76 ARM_SDK_MD5_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.9/4.9-2014-q4-major
/+download
/gcc-arm-none-eabi-4_9-2014q4-20141203-mac.
tar.bz2
/+md5
77 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/5.4/5.4.1/qt-opensource-mac-x64-clang-5.4
.1.dmg
78 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/5.4/5.4.1/qt-opensource-mac-x64-clang-5.4
.1.dmg.md5
79 QT_SDK_ARCH
:= clang_64
80 QT_SDK_MAINTENANCE_TOOL
:= /Volumes
/qt-opensource-mac-x64-clang-5.4
.1/qt-opensource-mac-x64-clang-5.4
.1.app
/Contents
/MacOS
/qt-opensource-mac-x64-clang-5.4
.1
81 QT_SDK_MOUNT_DIR
:= /Volumes
/qt-opensource-mac-x64-clang-5.4
.1
82 QT_SDK_INSTALLER_DAT
:= /Volumes
/qt-opensource-mac-x64-clang-5.4
.1/qt-opensource-mac-x64-clang-5.4
.1.app
/Contents
/Resources
/installer.dat
83 UNCRUSTIFY_URL
:= http
://librepilot.github.io
/tools
/uncrustify-0.60.
tar.gz
84 DOXYGEN_URL
:= http
://librepilot.github.io
/tools
/doxygen-1.8
.3.1.src.
tar.gz
85 else ifeq ($(UNAME
), Windows
)
86 ARM_SDK_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.9/4.9-2014-q4-major
/+download
/gcc-arm-none-eabi-4_9-2014q4-20141203-win32.zip
87 ARM_SDK_MD5_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.9/4.9-2014-q4-major
/+download
/gcc-arm-none-eabi-4_9-2014q4-20141203-win32.zip
/+md5
88 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/5.4/5.4.1/qt-opensource-windows-x86-mingw491_opengl-5.4
.1.exe
89 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/5.4/5.4.1/qt-opensource-windows-x86-mingw491_opengl-5.4
.1.exe.md5
90 QT_SDK_ARCH
:= mingw491_32
91 NSIS_URL
:= http
://librepilot.github.io
/tools
/nsis-2.46
-unicode.
tar.bz2
92 SDL_URL
:= http
://librepilot.github.io
/tools
/SDL-devel-1.2
.15-mingw32.
tar.gz
93 OPENSSL_URL
:= http
://librepilot.github.io
/tools
/openssl-1.0
.1e-win32.
tar.bz2
94 UNCRUSTIFY_URL
:= http
://librepilot.github.io
/tools
/uncrustify-0.60
-windows.
tar.bz2
95 DOXYGEN_URL
:= http
://librepilot.github.io
/tools
/doxygen-1.8
.3.1-windows.
tar.bz2
96 MESAWIN_URL
:= http
://librepilot.github.io
/tools
/mesawin.
tar.gz
97 CMAKE_URL
:= http
://www.cmake.org
/files
/v2.8
/cmake-2.8
.12.2-win32-x86.zip
98 CMAKE_MD5_URL
:= http
://librepilot.github.io
/tools
/cmake-2.8
.12.2-win32-x86.zip.md5
99 MSYS_URL
:= http
://librepilot.github.io
/tools
/MSYS-1.0
.11.zip
102 GTEST_URL
:= http
://librepilot.github.io
/tools
/gtest-1.6
.0.zip
104 ARM_SDK_DIR
:= $(TOOLS_DIR
)/gcc-arm-none-eabi-4_9-2014q4
105 QT_SDK_DIR
:= $(TOOLS_DIR
)/qt-5.4
.1
106 UNCRUSTIFY_DIR
:= $(TOOLS_DIR
)/uncrustify-0.60
107 DOXYGEN_DIR
:= $(TOOLS_DIR
)/doxygen-1.8
.3.1
108 GTEST_DIR
:= $(TOOLS_DIR
)/gtest-1.6
.0
110 ifeq ($(UNAME
), Linux
)
111 else ifeq ($(UNAME
), Darwin
)
112 else ifeq ($(UNAME
), Windows
)
113 MINGW_DIR
:= $(QT_SDK_DIR
)/Tools
/$(QT_SDK_ARCH
)
114 # When changing PYTHON_DIR, you must also update it in ground/openpilotgcs/src/python.pri
115 PYTHON_DIR
:= $(QT_SDK_DIR
)/Tools
/$(QT_SDK_ARCH
)/opt
/bin
116 NSIS_DIR
:= $(TOOLS_DIR
)/nsis-2.46
-unicode
117 # When changing SDL_DIR or OPENSSL_DIR, you must also update them in ground/openpilotgcs/openpilotgcs.pri
118 SDL_DIR
:= $(TOOLS_DIR
)/SDL-1.2
.15
119 OPENSSL_DIR
:= $(TOOLS_DIR
)/openssl-1.0
.1e-win32
120 MESAWIN_DIR
:= $(TOOLS_DIR
)/mesawin
121 CMAKE_DIR
:= $(TOOLS_DIR
)/cmake-2.8
.12.2-win32-x86
122 MSYS_DIR
:= $(TOOLS_DIR
)/msys
125 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)
127 ##############################
129 # Build only and all toolchains available for the platform
131 ##############################
133 BUILD_SDK_TARGETS
:= arm_sdk qt_sdk
134 ifeq ($(UNAME
), Windows
)
135 BUILD_SDK_TARGETS
+= sdl nsis mesawin openssl
137 ALL_SDK_TARGETS
:= $(BUILD_SDK_TARGETS
) gtest uncrustify doxygen
139 define GROUP_SDK_TEMPLATE
140 .PHONY
: $(1)_install
$(1)_clean
$(1)_distclean
$(1)_version
141 $(1)_install
: $(addsuffix _install
,$(2))
142 $(1)_clean
: $(addsuffix _clean
,$(2))
143 $(1)_distclean
: $(addsuffix _distclean
,$(2))
144 $(1)_version
: $(addsuffix _version
,$(2))
147 $(eval
$(call GROUP_SDK_TEMPLATE
,build_sdk
,$(BUILD_SDK_TARGETS
)))
148 $(eval
$(call GROUP_SDK_TEMPLATE
,all_sdk
,$(ALL_SDK_TARGETS
)))
150 ##############################
154 ##############################
156 # Used by other makefiles
157 export MKDIR
:= mkdir
165 # Used only by this Makefile
177 ifneq ($(UNAME
), Windows
)
181 ifneq ($(shell $(SEVENZIP
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
182 # no $(SEVENZIP) found in path. hope is in bin...
183 SEVENZIP
= $(TOOLS_DIR
)/bin
/7za.exe
187 # Echo in recipes is a bit tricky in a Windows Git Bash window in some cases.
188 # It does not work if make started under msysGit installed into a path with spaces.
189 ifneq ($(UNAME
), Windows
)
192 # export ECHO := $(PYTHON) -c "import sys; print(' '.join(sys.argv[1:]))"
196 # Test if quotes are needed for the echo command
197 ifeq ($(shell $(ECHO
) "test"), test)
199 # This line is just to clear out the single quote above '
204 # Command to extract version info data from the repository and source tree
205 export VERSION_INFO
= $(PYTHON
) $(ROOT_DIR
)/make
/scripts
/version-info.py
--path
=$(ROOT_DIR
)
207 ##############################
211 ##############################
214 MSG_VERIFYING
= $(QUOTE
) VERIFY
$(QUOTE
)
215 MSG_DOWNLOADING
= $(QUOTE
) DOWNLOAD
$(QUOTE
)
216 MSG_CHECKSUMMING
= $(QUOTE
) MD5
$(QUOTE
)
217 MSG_EXTRACTING
= $(QUOTE
) EXTRACT
$(QUOTE
)
218 MSG_CONFIGURING
= $(QUOTE
) CONFIGURE
$(QUOTE
)
219 MSG_BUILDING
= $(QUOTE
) BUILD
$(QUOTE
)
220 MSG_INSTALLING
= $(QUOTE
) INSTALL
$(QUOTE
)
221 MSG_CLEANING
= $(QUOTE
) CLEAN
$(QUOTE
)
222 MSG_DISTCLEANING
= $(QUOTE
) DISTCLEAN
$(QUOTE
)
223 MSG_NOTICE
= $(QUOTE
) NOTE
$(QUOTE
)
230 MAKE_SILENT
:= --silent
236 CURL_OPTIONS
:= --silent
-L
241 # MSYS tar workaround
242 ifeq ($(UNAME
), Windows
)
243 TAR_OPTIONS
:= --force-local
248 # Print some useful notes for *_install targets
249 ifneq ($(strip $(filter $(addsuffix _install
,all_sdk
$(ALL_SDK_TARGETS
)),$(MAKECMDGOALS
))),)
250 ifneq ($(shell $(CURL
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
251 $(error Please
install curl first
('apt-get install curl' or similar
))
253 $(info $(EMPTY
) NOTE Use
'make all_sdk_distclean' to remove installation files
)
254 $(info $(EMPTY
) NOTE Use
'make all_sdk_version' to
check toolchain versions
)
255 $(info $(EMPTY
) NOTE Add
'V=1' to make command line to diagnose make problems
)
256 $(info $(EMPTY
) NOTE Add
'BATCH=1' to make command line to disable progress reporting during downloads
)
259 ##############################
261 # Cross-platform MD5 check template
262 # $(1) = file name without quotes
263 # $(2) = string compare operator, e.g. = or !=
265 ##############################
267 define MD5_CHECK_TEMPLATE
268 "`test -f \"$(1)\" && $(OPENSSL) dgst -md5 \"$(1)\" | $(CUT) -f2 -d' '`" $(2) "`$(CUT) -f1 -d' ' < \"$(1).md5\"`"
271 ##############################
273 # Cross-platform MD5 generation template
274 # $(1) = file name without quotes
276 ##############################
278 ifeq ($(UNAME
), Darwin
)
280 define MD5_GEN_TEMPLATE
281 md5
-r
$(1) > $(1).md5
286 define MD5_GEN_TEMPLATE
287 $(OPENSSL
) dgst
-r
-md5
$(1) > $(1).md5
292 ##############################
294 # Cross platform download template
296 # $(2) = Package file
297 # $(3) = URL for .md5 file to be tested against Package
299 ##############################
301 define DOWNLOAD_TEMPLATE
302 @
$(ECHO
) $(MSG_VERIFYING
) $$(call toprel
, $(DL_DIR
)/$(2))
305 $(CURL
) $(CURL_OPTIONS
) --silent
-o
"$(DL_DIR)/$(2).md5" "$(3)" && \
306 if
[ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),!=) ]; then \
307 $(ECHO
) $(MSG_DOWNLOADING
) $(1) && \
308 $(CURL
) $(CURL_OPTIONS
) -o
"$(DL_DIR)/$(2)" "$(1)" && \
309 $(ECHO
) $(MSG_CHECKSUMMING
) $$(call toprel
, $(DL_DIR
)/$(2)) && \
310 [ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),=) ]; \
315 ##############################
317 # Common tool install template
319 # $(2) = tool extract/build directory
320 # $(3) = tool distribution URL
321 # $(4) = tool distribution MD5 URL
322 # $(5) = tool distribution file
323 # $(6) = optional extra build recipes template
324 # $(7) = optional extra clean recipes template
326 ##############################
328 define TOOL_INSTALL_TEMPLATE
330 .PHONY
: $(addprefix $(1)_
, install clean distclean)
332 $(1)_install
: $(1)_clean |
$(DL_DIR
) $(TOOLS_DIR
)
334 $(if
$(4), $(call DOWNLOAD_TEMPLATE
,$(3),$(5),$(4)),$(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(3).md5"))
336 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(2))
337 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
339 $(if
$(filter $(suffix $(5)), .zip
),
340 $(V1
) $(UNZIP
) $(UNZIP_SILENT
) -d
$$(call toprel
, $(dir $(2))) $$(call toprel
, $(DL_DIR
)/$(5)),
341 $(V1
) $(TAR
) $(TAR_OPTIONS
) -C
$$(call toprel
, $(dir $(2))) -xf
$$(call toprel
, $(DL_DIR
)/$(5))
347 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(2))
348 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
353 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
354 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
355 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
359 ##############################
361 # Windows QT install template
362 # $(1) = tool temp extract/build directory
363 # $(2) = tool install directory
364 # $(3) = tool distribution URL
365 # $(4) = tool distribution .md5 URL
366 # $(5) = tool distribution file
367 # $(6) = QT architecture
368 # $(7) = optional extra build recipes template
369 # $(8) = optional extra clean recipes template
371 ##############################
373 define WIN_QT_INSTALL_TEMPLATE
375 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
377 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
378 $(V1
) if
! $(SEVENZIP
) >/dev
/null
2>&1; then \
379 $(ECHO
) $(MSG_NOTICE
) "Missing 7zip. Run ./make/scripts/win_sdk_install.sh [<OpenPilot tools dir>] to get it." && \
382 $(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(4)")
383 # Explode .run file into install packages
384 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(1))
385 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(1)))
386 $(V1
) chmod
+x
$(DL_DIR
)/$(5)
387 $(V1
) $(DL_DIR
)/$(5) --dump-binary-data
-o
$(1)
388 # Extract packages under tool directory
389 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
390 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.win32_mingw491/5.4.1-0qt5_essentials.7z" | grep
-v Extracting
391 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.win32_mingw491/5.4.1-0i686-4.9.1-release-posix-dwarf-rt_v3-rev2-runtime.7z" | grep
-v Extracting
392 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.win32_mingw491/5.4.1-0icu_53_1_mingw_builds_4_9_1_posix_dwarf_32.7z" | grep
-v Extracting
393 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.win32_mingw491/5.4.1-0qt5_addons.7z" | grep
-v Extracting
394 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.tools.win32_mingw491/4.9.1-2i686-4.9.1-release-posix-dwarf-rt_v3-rev2.7z" | grep
-v Extracting
397 @
$(ECHO
) "Executing QtPatch in" $$(call toprel
, $(QT_SDK_PREFIX
))
398 $(V1
) $(CD
) $(QT_SDK_PREFIX
)
399 $(V1
) $(DL_DIR
)/$(5) --runoperation QtPatch windows
$(QT_SDK_PREFIX
) qt5
401 # Execute post build templates
404 # Clean up temporary files
405 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
406 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
409 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
410 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
411 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, "$(2)")
412 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
417 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
418 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
419 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
423 ##############################
425 # Linux QT install template
426 # $(1) = tool temp extract/build directory
427 # $(2) = tool install directory
428 # $(3) = tool distribution URL
429 # $(4) = tool distribution .md5 URL
430 # $(5) = tool distribution file
431 # $(6) = QT architecture
432 # $(7) = optional extra build recipes template
433 # $(8) = optional extra clean recipes template
435 ##############################
437 define LINUX_QT_INSTALL_TEMPLATE
439 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
441 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
442 $(V1
) if
! $(SEVENZIP
) >/dev
/null
2>&1; then \
443 $(ECHO
) $(MSG_NOTICE
) "Please install the p7zip for your distribution. i.e.: sudo apt-get install p7zip-full" && \
446 $(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(4)")
447 # Explode .run file into install packages
448 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(1))
449 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(1)))
450 $(V1
) chmod
+x
$(DL_DIR
)/$(5)
451 $(V1
) $(DL_DIR
)/$(5) --dump-binary-data
-o
$(1)
452 # Extract packages under tool directory
453 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
454 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.$(6)/5.4.1-0qt5_essentials.7z" | grep
-v Extracting
455 $(V1
) if
[ -f
"$(1)/qt.54.$(6)/5.4.1-0icu_53_1_ubuntu_11_10_64.7z" ]; then
$(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.$(6)/5.4.1-0icu_53_1_ubuntu_11_10_64.7z" | grep
-v Extracting
; fi
456 $(V1
) if
[ -f
"$(1)/qt.54.$(6)/5.4.1-0icu_53_1_ubuntu_11_10_32.7z" ]; then
$(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.$(6)/5.4.1-0icu_53_1_ubuntu_11_10_32.7z" | grep
-v Extracting
; fi
457 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.$(6)/5.4.1-0qt5_addons.7z" | grep
-v Extracting
460 @
$(ECHO
) "Executing QtPatch in" $$(call toprel
, $(QT_SDK_PREFIX
))
461 $(V1
) $(CD
) $(QT_SDK_PREFIX
)
462 $(V1
) $(DL_DIR
)/$(5) --runoperation QtPatch linux
$(QT_SDK_PREFIX
) qt5
464 # Execute post build templates
467 # Clean up temporary files
468 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
469 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
472 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
473 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
474 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, "$(2)")
475 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
480 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
481 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
482 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
486 ##############################
488 # Mac QT install template
489 # $(1) = tool temp extract/build directory
490 # $(2) = tool install directory
491 # $(3) = tool distribution URL
492 # $(4) = tool distribution .md5 URL
493 # $(5) = tool distribution file
494 # $(6) = QT architecture
495 # $(7) = optional extra build recipes template
496 # $(8) = optional extra clean recipes template
498 ##############################
500 define MAC_QT_INSTALL_TEMPLATE
502 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
504 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
505 $(V1
) if
! $(SEVENZIP
) >/dev
/null
2>&1; then \
506 $(ECHO
) $(MSG_NOTICE
) "Please install the p7zip for your distribution. i.e.: brew install p7zip." && \
509 $(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(4)")
511 $(V1
) hdiutil attach
-nobrowse
$(DL_DIR
)/$(5)
512 # Explode .dmg file into install packages
513 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(1))
514 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(1)))
515 $(V1
) $(QT_SDK_MAINTENANCE_TOOL
) --dump-binary-data
-i
$(QT_SDK_INSTALLER_DAT
) -o
$(1)
516 # Extract packages under tool directory
517 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
518 #$(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0-0qt-project-url.7z" | grep -v Extracting
519 #$(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt/5.4.1ThirdPartySoftware_Listing.7z" | grep -v Extracting
520 #$(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.readme/1.0.0-0readme.7z" | grep -v Extracting
521 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.$(6)/5.4.1-0qt5_essentials.7z" | grep
-v Extracting
522 # $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.54.$(6).essentials/5.4.1icu_path_patcher.sh.7z" | grep -v Extracting
523 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.54.$(6)/5.4.1-0qt5_addons.7z" | grep
-v Extracting
526 # go to OpenPilot/tools/5.4/gcc_64 and call patcher.sh
528 @
$(ECHO
) "Running patcher in" $$(call toprel
, $(QT_SDK_PREFIX
))
529 $(V1
) $(CD
) $(QT_SDK_PREFIX
)
530 # $(V1) "$(QT_SDK_PREFIX)/patcher.sh" $(QT_SDK_PREFIX)
532 @
$(ECHO
) "Executing QtPatch in" $$(call toprel
, $(QT_SDK_PREFIX
))
533 $(V1
) $(QT_SDK_MAINTENANCE_TOOL
) --runoperation QtPatch mac
$(QT_SDK_PREFIX
) qt5
535 #Unmount the .dmg file
536 $(V1
) hdiutil detach
$(QT_SDK_MOUNT_DIR
)
538 # Execute post build templates
541 # Clean up temporary files
542 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
543 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
546 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
547 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
548 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, "$(2)")
549 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
554 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
555 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
556 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
560 ##############################
564 ##############################
566 ifeq ($(UNAME
), Windows
)
568 # unfortunately zip package for this release is missing root directory, so adding / at the end of the path
569 # so that template interpret last part as directory and use the full path
570 $(eval
$(call TOOL_INSTALL_TEMPLATE
,arm_sdk
,$(ARM_SDK_DIR
)/,$(ARM_SDK_URL
),$(ARM_SDK_MD5_URL
),$(notdir $(ARM_SDK_URL
))))
574 $(eval
$(call TOOL_INSTALL_TEMPLATE
,arm_sdk
,$(ARM_SDK_DIR
),$(ARM_SDK_URL
),$(ARM_SDK_MD5_URL
),$(notdir $(ARM_SDK_URL
))))
578 ifeq ($(shell [ -d
"$(ARM_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
579 export ARM_SDK_PREFIX
:= $(ARM_SDK_DIR
)/bin
/arm-none-eabi-
581 # not installed, hope it's in the path...
582 # $(info $(EMPTY) WARNING $(call toprel, $(ARM_SDK_DIR)) not found (make arm_sdk_install), using system PATH)
583 export ARM_SDK_PREFIX ?
= arm-none-eabi-
586 .PHONY
: arm_sdk_version
588 -$(V1
) $(ARM_SDK_PREFIX
)gcc
--version | head
-n1
590 # Template to check ARM toolchain version before building targets
591 define ARM_GCC_VERSION_CHECK_TEMPLATE
592 if
! $(ARM_SDK_PREFIX
)gcc
--version
--specs
=nano.specs
>/dev
/null
2>&1; then \
593 $(ECHO
) $(MSG_NOTICE
) Please
install ARM toolchain
4.8 2014q1 using
\'make arm_sdk_install
\' && \
594 $(ECHO
) $(MSG_NOTICE
) Older ARM SDKs do not support new
\'--specs
=nano.specs
\' option
&& \
599 ##############################
603 ##############################
605 ifeq ($(UNAME
), Windows
)
607 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)/5.4/$(QT_SDK_ARCH
)
609 # This additional configuration step should not be necessary
610 # but it is needed as a workaround to https://bugreports.qt-project.org/browse/QTBUG-33254
611 define QT_SDK_CONFIGURE_TEMPLATE
612 @
$(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(QT_SDK_DIR
))
613 $(V1
) $(ECHO
) $(QUOTE
)[Paths
]$(QUOTE
) > $(QT_SDK_PREFIX
)/bin
/qt.conf
614 $(V1
) $(ECHO
) $(QUOTE
)Prefix
= $(QT_SDK_PREFIX
)$(QUOTE
) >> $(QT_SDK_PREFIX
)/bin
/qt.conf
617 QT_BUILD_DIR
:= $(BUILD_DIR
)/QT_BUILD
618 $(eval
$(call WIN_QT_INSTALL_TEMPLATE
,$(QT_BUILD_DIR
),$(QT_SDK_DIR
),$(QT_SDK_URL
),$(QT_SDK_MD5_URL
),$(notdir $(QT_SDK_URL
)),$(QT_SDK_ARCH
),$(QT_SDK_CONFIGURE_TEMPLATE
)))
620 else ifeq ($(UNAME
), Linux
)
622 QT_SDK_PREFIX
:= "$(QT_SDK_DIR)/5.4/$(QT_SDK_ARCH)"
623 QT_BUILD_DIR
:= $(BUILD_DIR
)/QT_BUILD
624 $(eval
$(call LINUX_QT_INSTALL_TEMPLATE
,$(QT_BUILD_DIR
),$(QT_SDK_DIR
),$(QT_SDK_URL
),$(QT_SDK_MD5_URL
),$(notdir $(QT_SDK_URL
)),$(QT_SDK_ARCH
)))
626 else ifeq ($(UNAME
), Darwin
)
628 QT_SDK_PREFIX
:= "$(QT_SDK_DIR)/5.4/$(QT_SDK_ARCH)"
629 QT_BUILD_DIR
:= $(BUILD_DIR
)/QT_BUILD
630 $(eval
$(call MAC_QT_INSTALL_TEMPLATE
,$(QT_BUILD_DIR
),$(QT_SDK_DIR
),$(QT_SDK_URL
),$(QT_SDK_MD5_URL
),$(notdir $(QT_SDK_URL
)),$(QT_SDK_ARCH
)))
634 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)
636 .PHONY
: qt_sdk_install
638 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
639 @
$(ECHO
) $(MSG_NOTICE
) Please
install native Qt
5.4.x SDK using package manager
640 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
645 .PHONY
: qt_sdk_distclean
650 ifeq ($(shell [ -d
"$(QT_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
651 export QMAKE
:= $(QT_SDK_PREFIX
)/bin
/qmake
653 # set Qt library search path
654 ifeq ($(UNAME
), Windows
)
655 export PATH
:= $(QT_SDK_PREFIX
)/bin
:$(PATH
)
657 export LD_LIBRARY_PATH
:= $(QT_SDK_DIR
)/lib
:$(LD_LIBRARY_PATH
)
660 # not installed, hope it's in the path...
661 # $(info $(EMPTY) WARNING $(call toprel, $(QT_SDK_DIR)) not found (make qt_sdk_install), using system PATH)
665 .PHONY
: qt_sdk_version
667 -$(V1
) $(QMAKE
) --version | tail
-1
669 ##############################
673 ##############################
675 ifeq ($(UNAME
), Windows
)
677 ifeq ($(shell [ -d
"$(MINGW_DIR)" ] && $(ECHO
) "exists"), exists
)
678 # set MinGW binary and library paths (QTMINGW is used by qmake, do not rename)
679 export QTMINGW
:= $(MINGW_DIR
)/bin
680 export PATH
:= $(QTMINGW
):$(PATH
)
682 # not installed, use host gcc compiler
683 # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found, using system PATH)
686 .PHONY
: mingw_version
687 mingw_version
: gcc_version
691 all_sdk_version
: gcc_version
697 -$(V1
) gcc
--version | head
-n1
699 ##############################
703 ##############################
705 ifeq ($(shell [ -d
"$(PYTHON_DIR)" ] && $(ECHO
) "exists"), exists
)
706 export PYTHON
:= $(PYTHON_DIR
)/python
707 export PATH
:= $(PYTHON_DIR
):$(PATH
)
709 # not installed, hope it's in the path...
710 # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found, using system PATH)
711 ifeq ($(findstring Python
2,$(shell python
--version
2>&1)), Python
2)
712 export PYTHON
:= python
714 export PYTHON
:= python2
718 .PHONY
: python_version
720 -$(V1
) $(PYTHON
) --version
722 ##############################
724 # NSIS Unicode (Windows only)
726 ##############################
728 ifeq ($(UNAME
), Windows
)
730 $(eval
$(call TOOL_INSTALL_TEMPLATE
,nsis
,$(NSIS_DIR
),$(NSIS_URL
),,$(notdir $(NSIS_URL
))))
732 ifeq ($(shell [ -d
"$(NSIS_DIR)" ] && $(ECHO
) "exists"), exists
)
733 export NSIS
:= $(NSIS_DIR
)/makensis
735 # not installed, hope it's in the path...
736 # $(info $(EMPTY) WARNING $(call toprel, $(NSIS_DIR)) not found (make nsis_install), using system PATH)
737 export NSIS ?
= makensis
742 -$(V1
) $(NSIS
) | head
-n1
746 ##############################
750 ##############################
752 ifeq ($(UNAME
), Windows
)
754 $(eval
$(call TOOL_INSTALL_TEMPLATE
,sdl
,$(SDL_DIR
),$(SDL_URL
),,$(notdir $(SDL_URL
))))
756 ifeq ($(shell [ -d
"$(SDL_DIR)" ] && $(ECHO
) "exists"), exists
)
757 export SDL_DIR
:= $(SDL_DIR
)
759 # not installed, hope it's in the path...
760 $(info $(EMPTY
) WARNING
$(call toprel
, $(SDL_DIR
)) not found
(make sdl_install
), using system PATH
)
765 -$(V1
) $(ECHO
) "SDL 1.2.15"
769 ##################################
771 # Mesa OpenGL DLL (Windows only)
773 ##################################
775 ifeq ($(UNAME
), Windows
)
777 $(eval
$(call TOOL_INSTALL_TEMPLATE
,mesawin
,$(MESAWIN_DIR
),$(MESAWIN_URL
),,$(notdir $(MESAWIN_URL
))))
779 ifeq ($(shell [ -d
"$(MESAWIN_DIR)" ] && $(ECHO
) "exists"), exists
)
780 export MESAWIN_DIR
:= $(MESAWIN_DIR
)
782 # not installed, hope it's in the path...
783 #$(info $(EMPTY) WARNING $(call toprel, $(MESA_WIN_DIR)) not found (make mesawin_install), using system PATH)
786 .PHONY
: mesawin_version
788 -$(V1
) $(ECHO
) "MesaOpenGL vXX"
792 ##############################
794 # OpenSSL (Windows only)
796 ##############################
798 ifeq ($(UNAME
), Windows
)
800 $(eval
$(call TOOL_INSTALL_TEMPLATE
,openssl
,$(OPENSSL_DIR
),$(OPENSSL_URL
),,$(notdir $(OPENSSL_URL
))))
802 ifeq ($(shell [ -d
"$(OPENSSL_DIR)" ] && $(ECHO
) "exists"), exists
)
803 export OPENSSL
:= $(OPENSSL_DIR
)/bin
/openssl
804 export OPENSSL_CONF
:= $(OPENSSL_DIR
)/bin
/openssl.cfg
807 # not installed, hope it's in the path...
808 # $(info $(EMPTY) WARNING $(call toprel, $(OPENSSL_DIR)) not found (make openssl_install), using system PATH)
811 .PHONY
: openssl_version
813 -$(V1
) $(ECHO
) "OpenSSL `$(OPENSSL) version`"
817 ##############################
821 ##############################
823 ifeq ($(UNAME
), Windows
)
825 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
))))
829 UNCRUSTIFY_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(UNCRUSTIFY_DIR
))
831 define UNCRUSTIFY_BUILD_TEMPLATE
833 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
834 cd
$(UNCRUSTIFY_BUILD_DIR
) && \
835 .
/configure
--prefix="$(UNCRUSTIFY_DIR)" && \
836 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
837 $(MAKE
) $(MAKE_SILENT
) && \
838 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(UNCRUSTIFY_DIR
)) && \
839 $(MAKE
) $(MAKE_SILENT
) install-strip \
841 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
))
842 -$(V1
) [ ! -d
"$(UNCRUSTIFY_BUILD_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_BUILD_DIR)"
845 define UNCRUSTIFY_CLEAN_TEMPLATE
846 -$(V1
) [ ! -d
"$(UNCRUSTIFY_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_DIR)"
849 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_BUILD_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
)),$(UNCRUSTIFY_BUILD_TEMPLATE
),$(UNCRUSTIFY_CLEAN_TEMPLATE
)))
853 ifeq ($(shell [ -d
"$(UNCRUSTIFY_DIR)" ] && $(ECHO
) "exists"), exists
)
854 export UNCRUSTIFY
:= $(UNCRUSTIFY_DIR
)/bin
/uncrustify
856 # not installed, hope it's in the path...
857 # $(info $(EMPTY) WARNING $(call toprel, $(UNCRUSTIFY_DIR)) not found (make uncrustify_install), using system PATH)
858 export UNCRUSTIFY
:= uncrustify
861 .PHONY
: uncrustify_version
863 -$(V1
) $(UNCRUSTIFY
) --version
865 ##############################
869 ##############################
871 ifeq ($(UNAME
), Windows
)
873 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
))))
877 DOXYGEN_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(DOXYGEN_DIR
))
879 define DOXYGEN_BUILD_TEMPLATE
881 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
882 cd
$(DOXYGEN_BUILD_DIR
) && \
883 .
/configure
--prefix "$(DOXYGEN_DIR)" --english-only
&& \
884 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
885 $(MAKE
) $(MAKE_SILENT
) && \
886 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(DOXYGEN_DIR
)) && \
887 $(MAKE
) $(MAKE_SILENT
) install \
889 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
))
890 -$(V1
) [ ! -d
"$(DOXYGEN_BUILD_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_BUILD_DIR)"
893 define DOXYGEN_CLEAN_TEMPLATE
894 -$(V1
) [ ! -d
"$(DOXYGEN_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_DIR)"
897 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_BUILD_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
)),$(DOXYGEN_BUILD_TEMPLATE
),$(DOXYGEN_CLEAN_TEMPLATE
)))
901 ifeq ($(shell [ -d
"$(DOXYGEN_DIR)" ] && $(ECHO
) "exists"), exists
)
902 export DOXYGEN
:= $(DOXYGEN_DIR
)/bin
/doxygen
904 # not installed, hope it's in the path...
905 # $(info $(EMPTY) WARNING $(call toprel, $(DOXYGEN_DIR)) not found (make doxygen_install), using system PATH)
906 export DOXYGEN
:= doxygen
909 .PHONY
: doxygen_version
911 -$(V1
) $(ECHO
) "Doxygen `$(DOXYGEN) --version`"
913 ##############################
917 ##############################
919 $(eval
$(call TOOL_INSTALL_TEMPLATE
,gtest
,$(GTEST_DIR
),$(GTEST_URL
),,$(notdir $(GTEST_URL
))))
923 .PHONY
: gtest_version
925 -$(V1
) $(SED
) -n
"s/^PACKAGE_STRING='\(.*\)'/\1/p" < $(GTEST_DIR
)/configure
927 ##############################
931 ##############################
933 $(eval
$(call TOOL_INSTALL_TEMPLATE
,cmake
,$(CMAKE_DIR
),$(CMAKE_URL
),$(CMAKE_MD5_URL
),$(notdir $(CMAKE_URL
))))
935 ifeq ($(shell [ -d
"$(CMAKE_DIR)" ] && $(ECHO
) "exists"), exists
)
936 export CMAKE
:= $(CMAKE_DIR
)/bin
/cmake
937 export PATH
:= $(CMAKE_DIR
)/bin
:$(PATH
)
939 # not installed, hope it's in the path...
940 #$(info $(EMPTY) WARNING $(call toprel, $(CMAKE_DIR)) not found (make cmake_install), using system PATH)
941 export CMAKE
:= cmake
944 .PHONY
: cmake_version
946 -$(V1
) $(CMAKE
) --version
948 ##############################
952 ##############################
954 ifeq ($(UNAME
), Windows
)
956 $(eval
$(call TOOL_INSTALL_TEMPLATE
,msys
,$(MSYS_DIR
),$(MSYS_URL
),,$(notdir $(MSYS_URL
))))
958 ifeq ($(shell [ -d
"$(MSYS_DIR)" ] && $(ECHO
) "exists"), exists
)
961 # not installed, hope it's in the path...
962 #$(info $(EMPTY) WARNING $(call toprel, $(MSYS_DIR)) not found (make msys_install), using system PATH)
974 ##############################
976 # TODO: code below is not revised yet
978 ##############################
980 # Set up openocd tools
981 OPENOCD_DIR
:= $(TOOLS_DIR
)/openocd
982 OPENOCD_WIN_DIR
:= $(TOOLS_DIR
)/openocd_win
983 OPENOCD_BUILD_DIR
:= $(DL_DIR
)/openocd-build
985 .PHONY
: openocd_install
986 openocd_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
987 openocd_install
: OPENOCD_URL
:= http
://sourceforge.net
/projects
/openocd
/files
/openocd
/0.6.1/openocd-0.6
.1.
tar.bz2
/download
988 openocd_install
: OPENOCD_FILE
:= openocd-0.6
.1.
tar.bz2
989 openocd_install
: openocd_clean
990 # download the source only if it's newer than what we already have
991 $(V1
) $(WGET
) -N
-P
"$(DL_DIR)" --trust-server-name
"$(OPENOCD_URL)"
994 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_BUILD_DIR)"
995 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
996 $(V1
) tar -C
$(OPENOCD_BUILD_DIR
) -xjf
"$(DL_DIR)/$(OPENOCD_FILE)"
999 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
1001 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
1002 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
1003 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
1007 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
1009 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
1010 .
/configure
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-stlink
; \
1011 $(MAKE
) --silent
; \
1012 $(MAKE
) --silent
install ; \
1015 # delete the extracted source when we're done
1016 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1018 .PHONY
: ftd2xx_install
1020 FTD2XX_DIR
:= $(DL_DIR
)/ftd2xx
1022 ftd2xx_install
: |
$(DL_DIR
)
1023 ftd2xx_install
: FTD2XX_URL
:= http
://www.ftdichip.com
/Drivers
/CDM
/Beta
/CDM20817.zip
1024 ftd2xx_install
: FTD2XX_FILE
:= CDM20817.zip
1025 ftd2xx_install
: ftd2xx_clean
1026 # download the file only if it's newer than what we already have
1027 $(V0
) @echo
" DOWNLOAD $(FTD2XX_URL)"
1028 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" "$(FTD2XX_URL)"
1030 # extract the source
1031 $(V0
) @echo
" EXTRACT $(FTD2XX_FILE) -> $(FTD2XX_DIR)"
1032 $(V1
) mkdir
-p
"$(FTD2XX_DIR)"
1033 $(V1
) unzip
-q
-d
"$(FTD2XX_DIR)" "$(DL_DIR)/$(FTD2XX_FILE)"
1035 .PHONY
: ftd2xx_clean
1037 $(V0
) @echo
" CLEAN $(FTD2XX_DIR)"
1038 $(V1
) [ ! -d
"$(FTD2XX_DIR)" ] ||
$(RM
) -r
"$(FTD2XX_DIR)"
1040 .PHONY
: ftd2xx_install
1042 LIBUSB_WIN_DIR
:= $(DL_DIR
)/libusb-win32-bin-1.2
.6.0
1044 libusb_win_install
: |
$(DL_DIR
)
1045 libusb_win_install
: LIBUSB_WIN_URL
:= http
://sourceforge.net
/projects
/libusb-win32
/files
/libusb-win32-releases
/1.2.6.0/libusb-win32-bin-1.2
.6.0.zip
/download
1046 libusb_win_install
: LIBUSB_WIN_FILE
:= libusb-win32-bin-1.2
.6.0.zip
1047 libusb_win_install
: libusb_win_clean
1048 # download the file only if it's newer than what we already have
1049 $(V0
) @echo
" DOWNLOAD $(LIBUSB_WIN_URL)"
1050 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" --trust-server-name
"$(LIBUSB_WIN_URL)"
1052 # extract the source
1053 $(V0
) @echo
" EXTRACT $(LIBUSB_WIN_FILE) -> $(LIBUSB_WIN_DIR)"
1054 $(V1
) mkdir
-p
"$(LIBUSB_WIN_DIR)"
1055 $(V1
) unzip
-q
-d
"$(DL_DIR)" "$(DL_DIR)/$(LIBUSB_WIN_FILE)"
1057 # fixup .h file needed by openocd build
1058 $(V0
) @echo
" FIXUP $(LIBUSB_WIN_DIR)"
1059 $(V1
) ln
-s
"$(LIBUSB_WIN_DIR)/include/lusb0_usb.h" "$(LIBUSB_WIN_DIR)/include/usb.h"
1061 .PHONY
: libusb_win_clean
1063 $(V0
) @echo
" CLEAN $(LIBUSB_WIN_DIR)"
1064 $(V1
) [ ! -d
"$(LIBUSB_WIN_DIR)" ] ||
$(RM
) -r
"$(LIBUSB_WIN_DIR)"
1066 .PHONY
: openocd_git_win_install
1068 openocd_git_win_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1069 openocd_git_win_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
1070 openocd_git_win_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
1071 openocd_git_win_install
: openocd_win_clean libusb_win_install ftd2xx_install
1072 # download the source
1073 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
1074 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1075 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
1076 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(DL_DIR)/openocd-build"
1078 cd
$(OPENOCD_BUILD_DIR
) ; \
1079 git checkout
-q
$(OPENOCD_REV
) ; \
1083 $(V0
) @echo
" PATCH $(OPENOCD_BUILD_DIR)"
1085 cd
$(OPENOCD_BUILD_DIR
) ; \
1086 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
1087 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
1091 $(V0
) @echo
" BUILD $(OPENOCD_WIN_DIR)"
1092 $(V1
) mkdir
-p
"$(OPENOCD_WIN_DIR)"
1094 cd
$(OPENOCD_BUILD_DIR
) ; \
1096 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_WIN_DIR)" \
1097 --build
=i686-pc-linux-gnu
--host
=i586-mingw32msvc \
1098 CPPFLAGS
=-I
$(LIBUSB_WIN_DIR
)/include \
1099 LDFLAGS
=-L
$(LIBUSB_WIN_DIR
)/lib
/gcc \
1100 --enable-ft2232_ftd2xx
--with-ftd2xx-win32-zipdir
=$(FTD2XX_DIR
) \
1107 # delete the extracted source when we're done
1108 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1110 .PHONY
: openocd_win_clean
1112 $(V0
) @echo
" CLEAN $(OPENOCD_WIN_DIR)"
1113 $(V1
) [ ! -d
"$(OPENOCD_WIN_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_WIN_DIR)"
1115 .PHONY
: openocd_git_install
1117 openocd_git_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1118 openocd_git_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
1119 openocd_git_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
1120 openocd_git_install
: openocd_clean
1121 # download the source
1122 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
1123 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1124 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
1125 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(OPENOCD_BUILD_DIR)"
1127 cd
$(OPENOCD_BUILD_DIR
) ; \
1128 git checkout
-q
$(OPENOCD_REV
) ; \
1132 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
1134 cd
$(OPENOCD_BUILD_DIR
) ; \
1135 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
1136 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
1140 $(V0
) @echo
" BUILD $(OPENOCD_DIR)"
1141 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
1143 cd
$(OPENOCD_BUILD_DIR
) ; \
1145 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-buspirate
--enable-stlink
; \
1150 # delete the extracted source when we're done
1151 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1153 .PHONY
: openocd_clean
1155 $(V0
) @echo
" CLEAN $(OPENOCD_DIR)"
1156 $(V1
) [ ! -d
"$(OPENOCD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_DIR)"
1158 STM32FLASH_DIR
:= $(TOOLS_DIR
)/stm32flash
1159 ifeq ($(UNAME
), Windows
)
1160 STM32FLASH_BUILD_OPTIONS
:= "CC=GCC"
1162 .PHONY
: stm32flash_install
1163 stm32flash_install
: STM32FLASH_URL
:= https
://code.google.com
/p
/stm32flash
/
1164 stm32flash_install
: STM32FLASH_REV
:= a358bd1f025d
1165 stm32flash_install
: stm32flash_clean
1166 # download the source
1167 $(V0
) @
$(ECHO
) " DOWNLOAD $(STM32FLASH_URL) @ r$(STM32FLASH_REV)"
1168 $(V1
) [ ! -d
"$(STM32FLASH_DIR)" ] ||
$(RM
) -rf
"$(STM32FLASH_DIR)"
1169 $(V1
) $(MKDIR
) -p
"$(STM32FLASH_DIR)"
1170 $(V1
) $(GIT
) clone
--no-checkout
$(STM32FLASH_URL
) "$(STM32FLASH_DIR)"
1172 $(CD
) $(STM32FLASH_DIR
) ; \
1173 $(GIT
) checkout
-q
$(STM32FLASH_REV
) ; \
1176 $(V0
) @
$(ECHO
) " BUILD $(STM32FLASH_DIR)"
1177 $(V1
) $(MAKE
) --silent
-C
$(STM32FLASH_DIR
) all $(STM32FLASH_BUILD_OPTIONS
)
1179 .PHONY
: stm32flash_clean
1181 $(V0
) @
$(ECHO
) " CLEAN $(STM32FLASH_DIR)"
1182 $(V1
) [ ! -d
"$(STM32FLASH_DIR)" ] ||
$(RM
) -rf
"$(STM32FLASH_DIR)"
1184 DFUUTIL_DIR
:= $(TOOLS_DIR
)/dfu-util
1186 .PHONY
: dfuutil_install
1187 dfuutil_install
: DFUUTIL_URL
:= http
://dfu-util.sourceforge.net
/releases
/dfu-util-0.8.
tar.gz
1188 dfuutil_install
: DFUUTIL_FILE
:= $(notdir $(DFUUTIL_URL
))
1189 dfuutil_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1190 dfuutil_install
: dfuutil_clean
1191 # download the source
1192 $(V0
) @echo
" DOWNLOAD $(DFUUTIL_URL)"
1193 $(V1
) $(CURL
) $(CURL_OPTIONS
) -o
"$(DL_DIR)/$(DFUUTIL_FILE)" "$(DFUUTIL_URL)"
1195 # extract the source
1196 $(V0
) @echo
" EXTRACT $(DFUUTIL_FILE)"
1197 $(V1
) [ ! -d
"$(DL_DIR)/dfuutil-build" ] ||
$(RM
) -r
"$(DL_DIR)/dfuutil-build"
1198 $(V1
) mkdir
-p
"$(DL_DIR)/dfuutil-build"
1199 $(V1
) tar -C
$(DL_DIR
)/dfuutil-build
-xf
"$(DL_DIR)/$(DFUUTIL_FILE)"
1202 $(V0
) @echo
" BUILD $(DFUUTIL_DIR)"
1203 $(V1
) mkdir
-p
"$(DFUUTIL_DIR)"
1205 cd
$(DL_DIR
)/dfuutil-build
/dfu-util-0.8
; \
1206 .
/configure
--prefix="$(DFUUTIL_DIR)" ; \
1211 .PHONY
: dfuutil_clean
1213 $(V0
) @echo
" CLEAN $(DFUUTIL_DIR)"
1214 $(V1
) [ ! -d
"$(DFUUTIL_DIR)" ] ||
$(RM
) -r
"$(DFUUTIL_DIR)"
1216 # see http://developer.android.com/sdk/ for latest versions
1217 ANDROID_SDK_DIR
:= $(TOOLS_DIR
)/android-sdk-linux
1218 .PHONY
: android_sdk_install
1219 android_sdk_install
: ANDROID_SDK_URL
:= http
://dl.google.com
/android
/android-sdk_r20.0
.3-linux.tgz
1220 android_sdk_install
: ANDROID_SDK_FILE
:= $(notdir $(ANDROID_SDK_URL
))
1221 # order-only prereq on directory existance:
1222 android_sdk_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1223 android_sdk_install
: android_sdk_clean
1224 # download the source only if it's newer than what we already have
1225 $(V0
) @echo
" DOWNLOAD $(ANDROID_SDK_URL)"
1226 $(V1
) $(WGET
) --no-check-certificate
-N
-P
"$(DL_DIR)" "$(ANDROID_SDK_URL)"
1228 # binary only release so just extract it
1229 $(V0
) @echo
" EXTRACT $(ANDROID_SDK_FILE)"
1230 $(V1
) tar -C
$(TOOLS_DIR
) -xf
"$(DL_DIR)/$(ANDROID_SDK_FILE)"
1232 .PHONY
: android_sdk_clean
1234 $(V0
) @echo
" CLEAN $(ANDROID_SDK_DIR)"
1235 $(V1
) [ ! -d
"$(ANDROID_SDK_DIR)" ] ||
$(RM
) -r
$(ANDROID_SDK_DIR
)
1237 .PHONY
: android_sdk_update
1239 $(V0
) @echo
" UPDATE $(ANDROID_SDK_DIR)"
1240 $(ANDROID_SDK_DIR
)/tools
/android update sdk
--no-ui
-t platform-tools
,android-16
,addon-google_apis-google-16
1242 #Install git hooks under the right folder
1246 $(V0
) @echo
" Configuring GIT commit template"
1247 $(V1
) $(CD
) "$(ROOT_DIR)"
1248 $(V1
) $(GIT
) config commit.template .commit-template
1250 .PHONY
: prepare_clean
1252 $(V0
) @echo
" Cleanup GIT commit template configuration"
1253 $(V1
) $(CD
) "$(ROOT_DIR)"
1254 $(V1
) $(GIT
) config
--unset commit.template
1256 ##############################
1258 # TODO: these defines will go to tool install sections
1260 ##############################
1262 ifeq ($(shell [ -d
"$(OPENOCD_DIR)" ] && $(ECHO
) "exists"), exists
)
1263 export OPENOCD
:= $(OPENOCD_DIR
)/bin
/openocd
1265 # not installed, hope it's in the path...
1266 export OPENOCD ?
= openocd
1269 ifeq ($(shell [ -d
"$(ANDROID_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
1270 ANDROID
:= $(ANDROID_SDK_DIR
)/tools
/android
1271 ANDROID_DX
:= $(ANDROID_SDK_DIR
)/platform-tools
/dx
1273 # not installed, hope it's in the path...