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 # mingw_install (Windows only - NOT USED for Qt-5.1.x)
13 # python_install (Windows only - NOT USED for Qt-5.1.x)
14 # nsis_install (Windows only)
15 # sdl_install (Windows only)
16 # openssl_install (Windows only)
17 # mesawin_install (Windows only)
26 # openocd_git_win_install
33 # help in the top Makefile
35 # This program is free software; you can redistribute it and/or modify
36 # it under the terms of the GNU General Public License as published by
37 # the Free Software Foundation; either version 3 of the License, or
38 # (at your option) any later version.
40 # This program is distributed in the hope that it will be useful, but
41 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
42 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
45 # You should have received a copy of the GNU General Public License along
46 # with this program; if not, write to the Free Software Foundation, Inc.,
47 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
50 ifndef OPENPILOT_IS_COOL
51 $(error
$(notdir $(lastword
$(MAKEFILE_LIST
))) should be included by the top level Makefile
)
54 ##############################
56 # Toolchain URLs and directories
58 ##############################
60 ifeq ($(UNAME
), Linux
)
61 ifeq ($(ARCH
), x86_64
)
62 ARM_SDK_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.8/4.8-2014-q1-update
/+download
/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.
tar.bz2
63 ARM_SDK_MD5_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.8/4.8-2014-q1-update
/+download
/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.
tar.bz2
/+md5
64 QT_SDK_URL
:= http
://download.qt-project.org
/official_releases
/qt
/5.2/5.2.1/qt-opensource-linux-x64-5.2
.1.run
65 QT_SDK_MD5_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/qt-opensource-linux-x64-5.2
.1.run.md5
68 ARM_SDK_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.8/4.8-2014-q1-update
/+download
/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.
tar.bz2
69 ARM_SDK_MD5_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.8/4.8-2014-q1-update
/+download
/gcc-arm-none-eabi-4_8-2014q1-20140314-linux.
tar.bz2
/+md5
70 QT_SDK_URL
:= http
://download.qt-project.org
/official_releases
/qt
/5.2/5.2.1/qt-opensource-linux-x86-5.2
.1.run
71 QT_SDK_MD5_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/qt-opensource-linux-x86-5.2
.1.run.md5
74 UNCRUSTIFY_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/uncrustify-0.60.
tar.gz
75 DOXYGEN_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/doxygen-1.8
.3.1.src.
tar.gz
76 else ifeq ($(UNAME
), Darwin
)
77 ARM_SDK_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.8/4.8-2014-q1-update
/+download
/gcc-arm-none-eabi-4_8-2014q1-20140314-mac.
tar.bz2
78 ARM_SDK_MD5_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.8/4.8-2014-q1-update
/+download
/gcc-arm-none-eabi-4_8-2014q1-20140314-mac.
tar.bz2
/+md5
79 QT_SDK_URL
:= "Please install native Qt 5.1.x SDK using package manager"
80 UNCRUSTIFY_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/uncrustify-0.60.
tar.gz
81 DOXYGEN_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/doxygen-1.8
.3.1.src.
tar.gz
82 else ifeq ($(UNAME
), Windows
)
83 ARM_SDK_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.8/4.8-2014-q1-update
/+download
/gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip
84 ARM_SDK_MD5_URL
:= https
://launchpad.net
/gcc-arm-embedded
/4.8/4.8-2014-q1-update
/+download
/gcc-arm-none-eabi-4_8-2014q1-20140314-win32.zip
/+md5
85 QT_SDK_URL
:= http
://download.qt-project.org
/official_releases
/qt
/5.2/5.2.1/qt-opensource-windows-x86-mingw48_opengl-5.2
.1.exe
86 QT_SDK_MD5_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/qt-opensource-windows-x86-mingw48_opengl-5.2
.1.exe.md5
87 QT_SDK_ARCH
:= mingw48_32
88 NSIS_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/nsis-2.46
-unicode.
tar.bz2
89 SDL_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/SDL-devel-1.2
.15-mingw32.
tar.gz
90 OPENSSL_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/openssl-1.0
.1e-win32.
tar.bz2
91 UNCRUSTIFY_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/uncrustify-0.60
-windows.
tar.bz2
92 DOXYGEN_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/doxygen-1.8
.3.1-windows.
tar.bz2
93 MESAWIN_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/mesawin.
tar.gz
96 GTEST_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/gtest-1.6
.0.zip
98 # Changing PYTHON_DIR, also update it in ground/openpilotgcs/src/python.pri
99 ARM_SDK_DIR
:= $(TOOLS_DIR
)/gcc-arm-none-eabi-4_8-2014q1
100 QT_SDK_DIR
:= $(TOOLS_DIR
)/qt-5.2
.1
101 MINGW_DIR
:= $(QT_SDK_DIR
)/Tools
/mingw48_32
102 PYTHON_DIR
:= $(QT_SDK_DIR
)/Tools
/mingw48_32
/opt
/bin
103 NSIS_DIR
:= $(TOOLS_DIR
)/nsis-2.46
-unicode
104 SDL_DIR
:= $(TOOLS_DIR
)/SDL-1.2
.15
105 OPENSSL_DIR
:= $(TOOLS_DIR
)/openssl-1.0
.1e-win32
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
109 MESAWIN_DIR
:= $(TOOLS_DIR
)/mesawin
111 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)
113 ##############################
115 # Build only and all toolchains available for the platform
117 ##############################
119 BUILD_SDK_TARGETS
:= arm_sdk qt_sdk
120 ifeq ($(UNAME
), Windows
)
121 BUILD_SDK_TARGETS
+= sdl nsis mesawin openssl
123 ALL_SDK_TARGETS
:= $(BUILD_SDK_TARGETS
) gtest uncrustify doxygen
125 define GROUP_SDK_TEMPLATE
126 .PHONY
: $(1)_install
$(1)_clean
$(1)_distclean
$(1)_version
127 $(1)_install
: $(addsuffix _install
,$(2))
128 $(1)_clean
: $(addsuffix _clean
,$(2))
129 $(1)_distclean
: $(addsuffix _distclean
,$(2))
130 $(1)_version
: $(addsuffix _version
,$(2))
133 $(eval
$(call GROUP_SDK_TEMPLATE
,build_sdk
,$(BUILD_SDK_TARGETS
)))
134 $(eval
$(call GROUP_SDK_TEMPLATE
,all_sdk
,$(ALL_SDK_TARGETS
)))
136 ##############################
140 ##############################
142 # Used by other makefiles
143 export MKDIR
:= mkdir
151 # Used only by this Makefile
162 ifneq ($(UNAME
), Windows
)
166 ifneq ($(shell $(SEVENZIP
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
167 # no $(SEVENZIP) found in path. hope is in bin...
168 SEVENZIP
= $(TOOLS_DIR
)/bin
/7za.exe
172 # Echo in recipes is a bit tricky in a Windows Git Bash window in some cases.
173 # It does not work if make started under msysGit installed into a path with spaces.
174 ifneq ($(UNAME
), Windows
)
177 # export ECHO := $(PYTHON) -c "import sys; print(' '.join(sys.argv[1:]))"
181 # Test if quotes are needed for the echo command
182 ifeq ($(shell $(ECHO
) "test"), test)
184 # This line is just to clear out the single quote above '
189 # Command to extract version info data from the repository and source tree
190 export VERSION_INFO
= $(PYTHON
) $(ROOT_DIR
)/make
/scripts
/version-info.py
--path
=$(ROOT_DIR
)
192 ##############################
196 ##############################
199 MSG_VERIFYING
= $(QUOTE
) VERIFY
$(QUOTE
)
200 MSG_DOWNLOADING
= $(QUOTE
) DOWNLOAD
$(QUOTE
)
201 MSG_CHECKSUMMING
= $(QUOTE
) MD5
$(QUOTE
)
202 MSG_EXTRACTING
= $(QUOTE
) EXTRACT
$(QUOTE
)
203 MSG_CONFIGURING
= $(QUOTE
) CONFIGURE
$(QUOTE
)
204 MSG_BUILDING
= $(QUOTE
) BUILD
$(QUOTE
)
205 MSG_INSTALLING
= $(QUOTE
) INSTALL
$(QUOTE
)
206 MSG_CLEANING
= $(QUOTE
) CLEAN
$(QUOTE
)
207 MSG_DISTCLEANING
= $(QUOTE
) DISTCLEAN
$(QUOTE
)
208 MSG_NOTICE
= $(QUOTE
) NOTE
$(QUOTE
)
215 MAKE_SILENT
:= --silent
221 CURL_OPTIONS
:= --silent
-L
226 # MSYS tar workaround
227 ifeq ($(UNAME
), Windows
)
228 TAR_OPTIONS
:= --force-local
233 # Print some useful notes for *_install targets
234 ifneq ($(strip $(filter $(addsuffix _install
,all_sdk
$(ALL_SDK_TARGETS
)),$(MAKECMDGOALS
))),)
235 ifneq ($(shell $(CURL
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
236 $(error Please
install curl first
('apt-get install curl' or similar
))
238 $(info $(EMPTY
) NOTE Use
'make all_sdk_distclean' to remove installation files
)
239 $(info $(EMPTY
) NOTE Use
'make all_sdk_version' to
check toolchain versions
)
240 $(info $(EMPTY
) NOTE Add
'V=1' to make command line to diagnose make problems
)
241 $(info $(EMPTY
) NOTE Add
'BATCH=1' to make command line to disable progress reporting during downloads
)
244 ##############################
246 # Cross-platform MD5 check template
247 # $(1) = file name without quotes
248 # $(2) = string compare operator, e.g. = or !=
250 ##############################
252 define MD5_CHECK_TEMPLATE
253 "`test -f \"$(1)\" && $(OPENSSL) dgst -md5 \"$(1)\" | $(CUT) -f2 -d' '`" $(2) "`$(CUT) -f1 -d' ' < \"$(1).md5\"`"
256 ##############################
258 # Cross platform download template
260 # $(2) = Package file
261 # $(3) = URL for .md5 file to be tested against Package
263 ##############################
265 define DOWNLOAD_TEMPLATE
266 @
$(ECHO
) $(MSG_VERIFYING
) $$(call toprel
, $(DL_DIR
)/$(2))
269 $(CURL
) $(CURL_OPTIONS
) --silent
-o
"$(DL_DIR)/$(2).md5" "$(3)" && \
270 if
[ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),!=) ]; then \
271 $(ECHO
) $(MSG_DOWNLOADING
) $(1) && \
272 $(CURL
) $(CURL_OPTIONS
) -o
"$(DL_DIR)/$(2)" "$(1)" && \
273 $(ECHO
) $(MSG_CHECKSUMMING
) $$(call toprel
, $(DL_DIR
)/$(2)) && \
274 [ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),=) ]; \
279 ##############################
281 # Common tool install template
283 # $(2) = tool extract/build directory
284 # $(3) = tool distribution URL
285 # $(4) = tool distribution MD5 URL
286 # $(5) = tool distribution file
287 # $(6) = optional extra build recipes template
288 # $(7) = optional extra clean recipes template
290 ##############################
294 define TOOL_INSTALL_TEMPLATE
296 .PHONY
: $(addprefix $(1)_
, install clean distclean)
298 $(1)_install
: $(1)_clean |
$(DL_DIR
) $(TOOLS_DIR
)
300 $(if
$(4), $(call DOWNLOAD_TEMPLATE
,$(3),$(5),$(4)),$(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(3).md5"))
302 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(2))
303 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
305 $(if
$(filter $(suffix $(5)), .zip
),
306 $(V1
) $(UNZIP
) $(UNZIP_SILENT
) -d
$$(call toprel
, $(dir $(2))) $$(call toprel
, $(DL_DIR
)/$(5)),
307 $(V1
) $(TAR
) $(TAR_OPTIONS
) -C
$$(call toprel
, $(dir $(2))) -xf
$$(call toprel
, $(DL_DIR
)/$(5))
313 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(2))
314 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
319 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
320 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
321 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
325 ##############################
327 # Windows QT install template
328 # $(1) = tool temp extract/build directory
329 # $(2) = tool install directory
330 # $(3) = tool distribution URL
331 # $(4) = tool distribution .md5 URL
332 # $(5) = tool distribution file
333 # $(6) = QT architecture
334 # $(7) = optional extra build recipes template
335 # $(8) = optional extra clean recipes template
337 ##############################
339 define WIN_QT_INSTALL_TEMPLATE
341 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
343 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
344 $(V1
) if
! $(SEVENZIP
) >/dev
/null
2>&1; then \
345 $(ECHO
) $(MSG_NOTICE
) "Missing 7zip. Run ./make/scripts/win_sdk_install.sh [<OpenPilot tools dir>] to get it." && \
348 $(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(4)")
349 # Explode .run file into install packages
350 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(1))
351 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(1)))
352 $(V1
) chmod
+x
$(DL_DIR
)/$(5)
353 $(V1
) $(DL_DIR
)/$(5) --dump-binary-data
-o
$(1)
354 # Extract packages under tool directory
355 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
356 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0qt-project-url.7z" | grep
-v Extracting
357 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt/1.0.0ThirdPartySoftware_Listing.7z" | grep
-v Extracting
358 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0readme.7z" | grep
-v Extracting
359 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.521.win32_mingw48.essentials/5.2.1mingw48_essentials.7z" | grep
-v Extracting
360 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.521.win32_mingw48.essentials/5.2.1x32-4.8.0-release-posix-dwarf-rev2-runtime.7z" | grep
-v Extracting
361 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.521.win32_mingw48.essentials/5.2.1icu_51_1_mingw_builds_4_8_0_posix_dwarf_32.7z" | grep
-v Extracting
362 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.521.win32_mingw48.addons/5.2.1mingw48_addons.7z" | grep
-v Extracting
363 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.tools.win32_mingw48/4.8.0-1-1x32-4.8.0-release-posix-dwarf-rev2.7z" | grep
-v Extracting
366 @
$(ECHO
) "Executing QtPatch in" $$(call toprel
, $(QT_SDK_PREFIX
))
367 $(V1
) $(CD
) $(QT_SDK_PREFIX
)
368 $(V1
) $(DL_DIR
)/$(5) --runoperation QtPatch windows
$(QT_SDK_PREFIX
) qt5
370 # Execute post build templates
373 # Clean up temporary files
374 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
375 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
378 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
379 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
380 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, "$(2)")
381 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
386 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
387 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
388 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
392 ##############################
394 # Linux QT install template
395 # $(1) = tool temp extract/build directory
396 # $(2) = tool install directory
397 # $(3) = tool distribution URL
398 # $(4) = tool distribution .md5 URL
399 # $(5) = tool distribution file
400 # $(6) = QT architecture
401 # $(7) = optional extra build recipes template
402 # $(8) = optional extra clean recipes template
404 ##############################
406 define LINUX_QT_INSTALL_TEMPLATE
408 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
410 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
411 $(V1
) if
! $(SEVENZIP
) >/dev
/null
2>&1; then \
412 $(ECHO
) $(MSG_NOTICE
) "Please install the p7zip for your distribution. i.e.: sudo apt-get install p7zip." && \
415 $(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(4)")
416 # Explode .run file into install packages
417 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(1))
418 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(1)))
419 $(V1
) chmod
+x
$(DL_DIR
)/$(5)
420 $(V1
) $(DL_DIR
)/$(5) --dump-binary-data
-o
$(1)
421 # Extract packages under tool directory
422 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
423 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0qt-project-url.7z" | grep
-v Extracting
424 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt/1.0.0ThirdPartySoftware_Listing.7z" | grep
-v Extracting
425 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0readme.7z" | grep
-v Extracting
426 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.521.$(6).essentials/5.2.1$(6)_qt5_essentials.7z" | grep
-v Extracting
427 $(V1
) if
[ -f
"$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_64.7z" ]; then
$(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_64.7z" | grep
-v Extracting
; fi
428 $(V1
) if
[ -f
"$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_32.7z" ]; then
$(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.521.$(6).essentials/5.2.1icu_51_1_ubuntu_11_10_32.7z" | grep
-v Extracting
; fi
429 # $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.521.$(6).essentials/5.2.1icu_path_patcher.sh.7z" | grep -v Extracting
430 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.521.$(6).addons/5.2.1$(6)_qt5_addons.7z" | grep
-v Extracting
431 # go to OpenPilot/tools/5.1.1/gcc_64 and call patcher.sh
433 @
$(ECHO
) "Running patcher in" $$(call toprel
, $(QT_SDK_PREFIX
))
434 $(V1
) $(CD
) $(QT_SDK_PREFIX
)
435 # $(V1) "$(QT_SDK_PREFIX)/patcher.sh" $(QT_SDK_PREFIX)
437 @
$(ECHO
) "Executing QtPatch in" $$(call toprel
, $(QT_SDK_PREFIX
))
438 $(V1
) $(DL_DIR
)/$(5) --runoperation QtPatch linux
$(QT_SDK_PREFIX
) qt5
440 # Execute post build templates
443 # Clean up temporary files
444 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
445 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
448 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
449 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
450 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, "$(2)")
451 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
456 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
457 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
458 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
462 ##############################
466 ##############################
467 ifeq ($(UNAME
), Windows
)
468 #unfortunately zip package for this release is missing root directory, so adding / at the end of the path
469 # so that template interpret last part as directory and use the full path
470 $(eval
$(call TOOL_INSTALL_TEMPLATE
,arm_sdk
,$(ARM_SDK_DIR
)/,$(ARM_SDK_URL
),$(ARM_SDK_MD5_URL
),$(notdir $(ARM_SDK_URL
))))
472 $(eval
$(call TOOL_INSTALL_TEMPLATE
,arm_sdk
,$(ARM_SDK_DIR
),$(ARM_SDK_URL
),$(ARM_SDK_MD5_URL
),$(notdir $(ARM_SDK_URL
))))
474 ifeq ($(shell [ -d
"$(ARM_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
475 export ARM_SDK_PREFIX
:= $(ARM_SDK_DIR
)/bin
/arm-none-eabi-
477 # not installed, hope it's in the path...
478 # $(info $(EMPTY) WARNING $(call toprel, $(ARM_SDK_DIR)) not found (make arm_sdk_install), using system PATH)
479 export ARM_SDK_PREFIX ?
= arm-none-eabi-
482 .PHONY
: arm_sdk_version
484 -$(V1
) $(ARM_SDK_PREFIX
)gcc
--version | head
-n1
486 # Template to check ARM toolchain version before building targets
487 define ARM_GCC_VERSION_CHECK_TEMPLATE
488 if
! $(ARM_SDK_PREFIX
)gcc
--version
--specs
=nano.specs
>/dev
/null
2>&1; then \
489 $(ECHO
) $(MSG_NOTICE
) Please
install ARM toolchain
4.8 2014q1 using
\'make arm_sdk_install
\' && \
490 $(ECHO
) $(MSG_NOTICE
) Older ARM SDKs do not support new
\'--specs
=nano.specs
\' option
&& \
495 ##############################
499 # Mac OS X: user should install native Qt SDK package
501 ##############################
503 ifeq ($(UNAME
), Windows
)
505 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)/5.2.1/$(QT_SDK_ARCH
)
507 # This additional configuration step should not be necessary
508 # but it is needed as a workaround to https://bugreports.qt-project.org/browse/QTBUG-33254
509 define QT_SDK_CONFIGURE_TEMPLATE
510 @
$(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(QT_SDK_DIR
))
511 $(V1
) $(ECHO
) $(QUOTE
)[Paths
]$(QUOTE
) > $(QT_SDK_PREFIX
)/bin
/qt.conf
512 $(V1
) $(ECHO
) $(QUOTE
)Prefix
= $(QT_SDK_PREFIX
)$(QUOTE
) >> $(QT_SDK_PREFIX
)/bin
/qt.conf
515 QT_BUILD_DIR
:= $(BUILD_DIR
)/QT_BUILD
516 $(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
)))
518 else ifeq ($(UNAME
), Linux
)
520 QT_SDK_PREFIX
:= "$(QT_SDK_DIR)/5.2.1/$(QT_SDK_ARCH)"
521 QT_BUILD_DIR
:= $(BUILD_DIR
)/QT_BUILD
522 $(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
)))
526 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)
528 .PHONY
: qt_sdk_install
530 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
531 @
$(ECHO
) $(MSG_NOTICE
) Please
install native Qt
5.2.x SDK using package manager
532 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
537 .PHONY
: qt_sdk_distclean
542 ifeq ($(shell [ -d
"$(QT_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
543 export QMAKE
:= $(QT_SDK_PREFIX
)/bin
/qmake
545 # set Qt library search path
546 ifeq ($(UNAME
), Windows
)
547 export PATH
:= $(QT_SDK_PREFIX
)/bin
:$(PATH
)
549 export LD_LIBRARY_PATH
:= $(QT_SDK_DIR
)/lib
:$(LD_LIBRARY_PATH
)
552 # not installed, hope it's in the path...
553 # $(info $(EMPTY) WARNING $(call toprel, $(QT_SDK_DIR)) not found (make qt_sdk_install), using system PATH)
557 .PHONY
: qt_sdk_version
559 -$(V1
) $(QMAKE
) --version | tail
-1
561 ##############################
565 ##############################
567 ifeq ($(UNAME
), Windows
)
569 ifeq ($(shell [ -d
"$(MINGW_DIR)" ] && $(ECHO
) "exists"), exists
)
570 # set MinGW binary and library paths (QTMINGW is used by qmake, do not rename)
571 export QTMINGW
:= $(MINGW_DIR
)/bin
572 export PATH
:= $(QTMINGW
):$(PATH
)
574 # not installed, use host gcc compiler
575 # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found, using system PATH)
578 .PHONY
: mingw_version
579 mingw_version
: gcc_version
583 all_sdk_version
: gcc_version
589 -$(V1
) gcc
--version | head
-n1
591 ##############################
595 ##############################
597 ifeq ($(shell [ -d
"$(PYTHON_DIR)" ] && $(ECHO
) "exists"), exists
)
598 export PYTHON
:= $(PYTHON_DIR
)/python
599 export PATH
:= $(PYTHON_DIR
):$(PATH
)
601 # not installed, hope it's in the path...
602 # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found, using system PATH)
603 export PYTHON
:= python
606 .PHONY
: python_version
608 -$(V1
) $(PYTHON
) --version
610 ##############################
612 # NSIS Unicode (Windows only)
614 ##############################
616 ifeq ($(UNAME
), Windows
)
618 $(eval
$(call TOOL_INSTALL_TEMPLATE
,nsis
,$(NSIS_DIR
),$(NSIS_URL
),,$(notdir $(NSIS_URL
))))
620 ifeq ($(shell [ -d
"$(NSIS_DIR)" ] && $(ECHO
) "exists"), exists
)
621 export NSIS
:= $(NSIS_DIR
)/makensis
623 # not installed, hope it's in the path...
624 # $(info $(EMPTY) WARNING $(call toprel, $(NSIS_DIR)) not found (make nsis_install), using system PATH)
625 export NSIS ?
= makensis
630 -$(V1
) $(NSIS
) | head
-n1
634 ##############################
638 ##############################
640 ifeq ($(UNAME
), Windows
)
642 $(eval
$(call TOOL_INSTALL_TEMPLATE
,sdl
,$(SDL_DIR
),$(SDL_URL
),,$(notdir $(SDL_URL
))))
644 ifeq ($(shell [ -d
"$(SDL_DIR)" ] && $(ECHO
) "exists"), exists
)
645 export SDL_DIR
:= $(SDL_DIR
)
647 # not installed, hope it's in the path...
648 $(info $(EMPTY
) WARNING
$(call toprel
, $(SDL_DIR
)) not found
(make sdl_install
), using system PATH
)
653 -$(V1
) $(ECHO
) "SDL 1.2.15"
657 ##################################
659 # Mesa OpenGL DLL (Windows only)
661 ##################################
663 ifeq ($(UNAME
), Windows
)
665 $(eval
$(call TOOL_INSTALL_TEMPLATE
,mesawin
,$(MESAWIN_DIR
),$(MESAWIN_URL
),,$(notdir $(MESAWIN_URL
))))
667 ifeq ($(shell [ -d
"$(MESAWIN_DIR)" ] && $(ECHO
) "exists"), exists
)
668 export MESAWIN_DIR
:= $(MESAWIN_DIR
)
670 # not installed, hope it's in the path...
671 #$(info $(EMPTY) WARNING $(call toprel, $(MESA_WIN_DIR)) not found (make mesawin_install), using system PATH)
674 .PHONY
: mesawin_version
676 -$(V1
) $(ECHO
) "MesaOpenGL vXX"
680 ##############################
682 # OpenSSL (Windows only)
684 ##############################
686 ifeq ($(UNAME
), Windows
)
688 $(eval
$(call TOOL_INSTALL_TEMPLATE
,openssl
,$(OPENSSL_DIR
),$(OPENSSL_URL
),,$(notdir $(OPENSSL_URL
))))
690 ifeq ($(shell [ -d
"$(OPENSSL_DIR)" ] && $(ECHO
) "exists"), exists
)
691 export OPENSSL
:= "$(OPENSSL_DIR)/bin/openssl"
692 export OPENSSL_DIR
:= "$(OPENSSL_DIR)"
694 # not installed, hope it's in the path...
695 # $(info $(EMPTY) WARNING $(call toprel, $(OPENSSL_DIR)) not found (make openssl_install), using system PATH)
698 .PHONY
: openssl_version
700 -$(V1
) $(ECHO
) "OpenSSL `$(OPENSSL) version`"
704 ##############################
708 ##############################
710 ifeq ($(UNAME
), Windows
)
712 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
))))
716 UNCRUSTIFY_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(UNCRUSTIFY_DIR
))
718 define UNCRUSTIFY_BUILD_TEMPLATE
720 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
721 cd
$(UNCRUSTIFY_BUILD_DIR
) && \
722 .
/configure
--prefix="$(UNCRUSTIFY_DIR)" && \
723 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
724 $(MAKE
) $(MAKE_SILENT
) && \
725 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(UNCRUSTIFY_DIR
)) && \
726 $(MAKE
) $(MAKE_SILENT
) install-strip \
728 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
))
729 -$(V1
) [ ! -d
"$(UNCRUSTIFY_BUILD_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_BUILD_DIR)"
732 define UNCRUSTIFY_CLEAN_TEMPLATE
733 -$(V1
) [ ! -d
"$(UNCRUSTIFY_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_DIR)"
736 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_BUILD_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
)),$(UNCRUSTIFY_BUILD_TEMPLATE
),$(UNCRUSTIFY_CLEAN_TEMPLATE
)))
740 ifeq ($(shell [ -d
"$(UNCRUSTIFY_DIR)" ] && $(ECHO
) "exists"), exists
)
741 export UNCRUSTIFY
:= $(UNCRUSTIFY_DIR
)/bin
/uncrustify
743 # not installed, hope it's in the path...
744 # $(info $(EMPTY) WARNING $(call toprel, $(UNCRUSTIFY_DIR)) not found (make uncrustify_install), using system PATH)
745 export UNCRUSTIFY
:= uncrustify
748 .PHONY
: uncrustify_version
750 -$(V1
) $(UNCRUSTIFY
) --version
752 ##############################
756 ##############################
758 ifeq ($(UNAME
), Windows
)
760 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
))))
764 DOXYGEN_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(DOXYGEN_DIR
))
766 define DOXYGEN_BUILD_TEMPLATE
768 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
769 cd
$(DOXYGEN_BUILD_DIR
) && \
770 .
/configure
--prefix "$(DOXYGEN_DIR)" --english-only
&& \
771 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
772 $(MAKE
) $(MAKE_SILENT
) && \
773 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(DOXYGEN_DIR
)) && \
774 $(MAKE
) $(MAKE_SILENT
) install \
776 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
))
777 -$(V1
) [ ! -d
"$(DOXYGEN_BUILD_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_BUILD_DIR)"
780 define DOXYGEN_CLEAN_TEMPLATE
781 -$(V1
) [ ! -d
"$(DOXYGEN_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_DIR)"
784 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_BUILD_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
)),$(DOXYGEN_BUILD_TEMPLATE
),$(DOXYGEN_CLEAN_TEMPLATE
)))
788 ifeq ($(shell [ -d
"$(DOXYGEN_DIR)" ] && $(ECHO
) "exists"), exists
)
789 export DOXYGEN
:= $(DOXYGEN_DIR
)/bin
/doxygen
791 # not installed, hope it's in the path...
792 # $(info $(EMPTY) WARNING $(call toprel, $(DOXYGEN_DIR)) not found (make doxygen_install), using system PATH)
793 export DOXYGEN
:= doxygen
796 .PHONY
: doxygen_version
798 -$(V1
) $(ECHO
) "Doxygen `$(DOXYGEN) --version`"
800 ##############################
804 ##############################
806 $(eval
$(call TOOL_INSTALL_TEMPLATE
,gtest
,$(GTEST_DIR
),$(GTEST_URL
),,$(notdir $(GTEST_URL
))))
810 .PHONY
: gtest_version
812 -$(V1
) $(SED
) -n
"s/^PACKAGE_STRING='\(.*\)'/\1/p" < $(GTEST_DIR
)/configure
818 ##############################
820 # TODO: code below is not revised yet
822 ##############################
824 # Set up openocd tools
825 OPENOCD_DIR
:= $(TOOLS_DIR
)/openocd
826 OPENOCD_WIN_DIR
:= $(TOOLS_DIR
)/openocd_win
827 OPENOCD_BUILD_DIR
:= $(DL_DIR
)/openocd-build
829 .PHONY
: openocd_install
830 openocd_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
831 openocd_install
: OPENOCD_URL
:= http
://sourceforge.net
/projects
/openocd
/files
/openocd
/0.6.1/openocd-0.6
.1.
tar.bz2
/download
832 openocd_install
: OPENOCD_FILE
:= openocd-0.6
.1.
tar.bz2
833 openocd_install
: openocd_clean
834 # download the source only if it's newer than what we already have
835 $(V1
) $(WGET
) -N
-P
"$(DL_DIR)" --trust-server-name
"$(OPENOCD_URL)"
838 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_BUILD_DIR)"
839 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
840 $(V1
) tar -C
$(OPENOCD_BUILD_DIR
) -xjf
"$(DL_DIR)/$(OPENOCD_FILE)"
843 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
845 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
846 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
847 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
851 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
853 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
854 .
/configure
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-stlink
; \
856 $(MAKE
) --silent
install ; \
859 # delete the extracted source when we're done
860 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
862 .PHONY
: ftd2xx_install
864 FTD2XX_DIR
:= $(DL_DIR
)/ftd2xx
866 ftd2xx_install
: |
$(DL_DIR
)
867 ftd2xx_install
: FTD2XX_URL
:= http
://www.ftdichip.com
/Drivers
/CDM
/Beta
/CDM20817.zip
868 ftd2xx_install
: FTD2XX_FILE
:= CDM20817.zip
869 ftd2xx_install
: ftd2xx_clean
870 # download the file only if it's newer than what we already have
871 $(V0
) @echo
" DOWNLOAD $(FTD2XX_URL)"
872 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" "$(FTD2XX_URL)"
875 $(V0
) @echo
" EXTRACT $(FTD2XX_FILE) -> $(FTD2XX_DIR)"
876 $(V1
) mkdir
-p
"$(FTD2XX_DIR)"
877 $(V1
) unzip
-q
-d
"$(FTD2XX_DIR)" "$(DL_DIR)/$(FTD2XX_FILE)"
881 $(V0
) @echo
" CLEAN $(FTD2XX_DIR)"
882 $(V1
) [ ! -d
"$(FTD2XX_DIR)" ] ||
$(RM
) -r
"$(FTD2XX_DIR)"
884 .PHONY
: ftd2xx_install
886 LIBUSB_WIN_DIR
:= $(DL_DIR
)/libusb-win32-bin-1.2
.6.0
888 libusb_win_install
: |
$(DL_DIR
)
889 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
890 libusb_win_install
: LIBUSB_WIN_FILE
:= libusb-win32-bin-1.2
.6.0.zip
891 libusb_win_install
: libusb_win_clean
892 # download the file only if it's newer than what we already have
893 $(V0
) @echo
" DOWNLOAD $(LIBUSB_WIN_URL)"
894 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" --trust-server-name
"$(LIBUSB_WIN_URL)"
897 $(V0
) @echo
" EXTRACT $(LIBUSB_WIN_FILE) -> $(LIBUSB_WIN_DIR)"
898 $(V1
) mkdir
-p
"$(LIBUSB_WIN_DIR)"
899 $(V1
) unzip
-q
-d
"$(DL_DIR)" "$(DL_DIR)/$(LIBUSB_WIN_FILE)"
901 # fixup .h file needed by openocd build
902 $(V0
) @echo
" FIXUP $(LIBUSB_WIN_DIR)"
903 $(V1
) ln
-s
"$(LIBUSB_WIN_DIR)/include/lusb0_usb.h" "$(LIBUSB_WIN_DIR)/include/usb.h"
905 .PHONY
: libusb_win_clean
907 $(V0
) @echo
" CLEAN $(LIBUSB_WIN_DIR)"
908 $(V1
) [ ! -d
"$(LIBUSB_WIN_DIR)" ] ||
$(RM
) -r
"$(LIBUSB_WIN_DIR)"
910 .PHONY
: openocd_git_win_install
912 openocd_git_win_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
913 openocd_git_win_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
914 openocd_git_win_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
915 openocd_git_win_install
: openocd_win_clean libusb_win_install ftd2xx_install
916 # download the source
917 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
918 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
919 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
920 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(DL_DIR)/openocd-build"
922 cd
$(OPENOCD_BUILD_DIR
) ; \
923 git checkout
-q
$(OPENOCD_REV
) ; \
927 $(V0
) @echo
" PATCH $(OPENOCD_BUILD_DIR)"
929 cd
$(OPENOCD_BUILD_DIR
) ; \
930 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
931 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
935 $(V0
) @echo
" BUILD $(OPENOCD_WIN_DIR)"
936 $(V1
) mkdir
-p
"$(OPENOCD_WIN_DIR)"
938 cd
$(OPENOCD_BUILD_DIR
) ; \
940 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_WIN_DIR)" \
941 --build
=i686-pc-linux-gnu
--host
=i586-mingw32msvc \
942 CPPFLAGS
=-I
$(LIBUSB_WIN_DIR
)/include \
943 LDFLAGS
=-L
$(LIBUSB_WIN_DIR
)/lib
/gcc \
944 --enable-ft2232_ftd2xx
--with-ftd2xx-win32-zipdir
=$(FTD2XX_DIR
) \
951 # delete the extracted source when we're done
952 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
954 .PHONY
: openocd_win_clean
956 $(V0
) @echo
" CLEAN $(OPENOCD_WIN_DIR)"
957 $(V1
) [ ! -d
"$(OPENOCD_WIN_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_WIN_DIR)"
959 .PHONY
: openocd_git_install
961 openocd_git_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
962 openocd_git_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
963 openocd_git_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
964 openocd_git_install
: openocd_clean
965 # download the source
966 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
967 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
968 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
969 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(OPENOCD_BUILD_DIR)"
971 cd
$(OPENOCD_BUILD_DIR
) ; \
972 git checkout
-q
$(OPENOCD_REV
) ; \
976 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
978 cd
$(OPENOCD_BUILD_DIR
) ; \
979 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
980 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
984 $(V0
) @echo
" BUILD $(OPENOCD_DIR)"
985 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
987 cd
$(OPENOCD_BUILD_DIR
) ; \
989 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-buspirate
--enable-stlink
; \
994 # delete the extracted source when we're done
995 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
997 .PHONY
: openocd_clean
999 $(V0
) @echo
" CLEAN $(OPENOCD_DIR)"
1000 $(V1
) [ ! -d
"$(OPENOCD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_DIR)"
1002 STM32FLASH_DIR
:= $(TOOLS_DIR
)/stm32flash
1004 .PHONY
: stm32flash_install
1005 stm32flash_install
: STM32FLASH_URL
:= http
://stm32flash.googlecode.com
/svn
/trunk
1006 stm32flash_install
: STM32FLASH_REV
:= 61
1007 stm32flash_install
: stm32flash_clean
1008 # download the source
1009 $(V0
) @echo
" DOWNLOAD $(STM32FLASH_URL) @ r$(STM32FLASH_REV)"
1010 $(V1
) svn
export -q
-r
"$(STM32FLASH_REV)" "$(STM32FLASH_URL)" "$(STM32FLASH_DIR)"
1013 $(V0
) @echo
" BUILD $(STM32FLASH_DIR)"
1014 $(V1
) $(MAKE
) --silent
-C
$(STM32FLASH_DIR
) all
1016 .PHONY
: stm32flash_clean
1018 $(V0
) @echo
" CLEAN $(STM32FLASH_DIR)"
1019 $(V1
) [ ! -d
"$(STM32FLASH_DIR)" ] ||
$(RM
) -r
"$(STM32FLASH_DIR)"
1021 DFUUTIL_DIR
:= $(TOOLS_DIR
)/dfu-util
1023 .PHONY
: dfuutil_install
1024 dfuutil_install
: DFUUTIL_URL
:= http
://dfu-util.gnumonks.org
/releases
/dfu-util-0.7.
tar.gz
1025 dfuutil_install
: DFUUTIL_FILE
:= $(notdir $(DFUUTIL_URL
))
1026 dfuutil_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1027 dfuutil_install
: dfuutil_clean
1028 # download the source
1029 $(V0
) @echo
" DOWNLOAD $(DFUUTIL_URL)"
1030 $(V1
) $(WGET
) -N
-P
"$(DL_DIR)" "$(DFUUTIL_URL)"
1032 # extract the source
1033 $(V0
) @echo
" EXTRACT $(DFUUTIL_FILE)"
1034 $(V1
) [ ! -d
"$(DL_DIR)/dfuutil-build" ] ||
$(RM
) -r
"$(DL_DIR)/dfuutil-build"
1035 $(V1
) mkdir
-p
"$(DL_DIR)/dfuutil-build"
1036 $(V1
) tar -C
$(DL_DIR
)/dfuutil-build
-xf
"$(DL_DIR)/$(DFUUTIL_FILE)"
1039 $(V0
) @echo
" BUILD $(DFUUTIL_DIR)"
1040 $(V1
) mkdir
-p
"$(DFUUTIL_DIR)"
1042 cd
$(DL_DIR
)/dfuutil-build
/dfu-util-0.7
; \
1043 .
/configure
--prefix="$(DFUUTIL_DIR)" ; \
1048 .PHONY
: dfuutil_clean
1050 $(V0
) @echo
" CLEAN $(DFUUTIL_DIR)"
1051 $(V1
) [ ! -d
"$(DFUUTIL_DIR)" ] ||
$(RM
) -r
"$(DFUUTIL_DIR)"
1053 # see http://developer.android.com/sdk/ for latest versions
1054 ANDROID_SDK_DIR
:= $(TOOLS_DIR
)/android-sdk-linux
1055 .PHONY
: android_sdk_install
1056 android_sdk_install
: ANDROID_SDK_URL
:= http
://dl.google.com
/android
/android-sdk_r20.0
.3-linux.tgz
1057 android_sdk_install
: ANDROID_SDK_FILE
:= $(notdir $(ANDROID_SDK_URL
))
1058 # order-only prereq on directory existance:
1059 android_sdk_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1060 android_sdk_install
: android_sdk_clean
1061 # download the source only if it's newer than what we already have
1062 $(V0
) @echo
" DOWNLOAD $(ANDROID_SDK_URL)"
1063 $(V1
) $(WGET
) --no-check-certificate
-N
-P
"$(DL_DIR)" "$(ANDROID_SDK_URL)"
1065 # binary only release so just extract it
1066 $(V0
) @echo
" EXTRACT $(ANDROID_SDK_FILE)"
1067 $(V1
) tar -C
$(TOOLS_DIR
) -xf
"$(DL_DIR)/$(ANDROID_SDK_FILE)"
1069 .PHONY
: android_sdk_clean
1071 $(V0
) @echo
" CLEAN $(ANDROID_SDK_DIR)"
1072 $(V1
) [ ! -d
"$(ANDROID_SDK_DIR)" ] ||
$(RM
) -r
$(ANDROID_SDK_DIR
)
1074 .PHONY
: android_sdk_update
1076 $(V0
) @echo
" UPDATE $(ANDROID_SDK_DIR)"
1077 $(ANDROID_SDK_DIR
)/tools
/android update sdk
--no-ui
-t platform-tools
,android-16
,addon-google_apis-google-16
1079 #Install git hooks under the right folder
1083 $(V0
) @echo
" Configuring GIT commit template"
1084 $(V1
) $(CD
) "$(ROOT_DIR)"
1085 $(V1
) $(GIT
) config commit.template .commit-template
1087 .PHONY
: prepare_clean
1089 $(V0
) @echo
" Cleanup GIT commit template configuration"
1090 $(V1
) $(CD
) "$(ROOT_DIR)"
1091 $(V1
) $(GIT
) config
--unset commit.template
1093 ##############################
1095 # TODO: these defines will go to tool install sections
1097 ##############################
1099 ifeq ($(shell [ -d
"$(OPENOCD_DIR)" ] && $(ECHO
) "exists"), exists
)
1100 export OPENOCD
:= $(OPENOCD_DIR
)/bin
/openocd
1102 # not installed, hope it's in the path...
1103 export OPENOCD ?
= openocd
1106 ifeq ($(shell [ -d
"$(ANDROID_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
1107 ANDROID
:= $(ANDROID_SDK_DIR
)/tools
/android
1108 ANDROID_DX
:= $(ANDROID_SDK_DIR
)/platform-tools
/dx
1110 # not installed, hope it's in the path...