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.3.x)
13 # python_install (Windows only - NOT USED for Qt-5.3.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.3/5.3.1/qt-opensource-linux-x64-5.3
.1.run
65 QT_SDK_MD5_URL
:= http
://download.qt-project.org
/official_releases
/qt
/5.3/5.3.1/qt-opensource-linux-x64-5.3
.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.3/5.3.1/qt-opensource-linux-x86-5.3
.1.run
71 QT_SDK_MD5_URL
:= http
://download.qt-project.org
/official_releases
/qt
/5.3/5.3.1/qt-opensource-linux-x86-5.3
.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
:= http
://download.qt-project.org
/official_releases
/qt
/5.3/5.3.1/qt-opensource-mac-x64-clang-5.3
.1.dmg
80 QT_SDK_MD5_URL
:= http
://download.qt-project.org
/official_releases
/qt
/5.3/5.3.1/qt-opensource-mac-x64-clang-5.3
.1.dmg.md5
81 QT_SDK_ARCH
:= clang_64
82 QT_SDK_MAINTENANCE_TOOL
:= /Volumes
/qt-opensource-mac-x64-clang-5.3
.1/qt-opensource-mac-x64-clang-5.3
.1.app
/Contents
/MacOS
/qt-opensource-mac-x64-clang-5.3
.1
83 QT_SDK_MOUNT_DIR
:= /Volumes
/qt-opensource-mac-x64-clang-5.3
.1
84 QT_SDK_INSTALLER_DAT
:= /Volumes
/qt-opensource-mac-x64-clang-5.3
.1/qt-opensource-mac-x64-clang-5.3
.1.app
/Contents
/Resources
/installer.dat
85 UNCRUSTIFY_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/uncrustify-0.60.
tar.gz
86 DOXYGEN_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/doxygen-1.8
.3.1.src.
tar.gz
87 else ifeq ($(UNAME
), Windows
)
88 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
89 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
90 QT_SDK_URL
:= http
://download.qt-project.org
/official_releases
/qt
/5.3/5.3.1/qt-opensource-windows-x86-mingw482_opengl-5.3
.1.exe
91 QT_SDK_MD5_URL
:= http
://download.qt-project.org
/official_releases
/qt
/5.3/5.3.1/qt-opensource-windows-x86-mingw482_opengl-5.3
.1.exe.md5
92 QT_SDK_ARCH
:= mingw482_32
93 NSIS_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/nsis-2.46
-unicode.
tar.bz2
94 SDL_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/SDL-devel-1.2
.15-mingw32.
tar.gz
95 OPENSSL_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/openssl-1.0
.1e-win32.
tar.bz2
96 UNCRUSTIFY_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/uncrustify-0.60
-windows.
tar.bz2
97 DOXYGEN_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/doxygen-1.8
.3.1-windows.
tar.bz2
98 MESAWIN_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/mesawin.
tar.gz
101 GTEST_URL
:= http
://wiki.openpilot.org
/download
/attachments
/18612236/gtest-1.6
.0.zip
103 # Changing PYTHON_DIR, also update it in ground/openpilotgcs/src/python.pri
104 ARM_SDK_DIR
:= $(TOOLS_DIR
)/gcc-arm-none-eabi-4_8-2014q1
105 QT_SDK_DIR
:= $(TOOLS_DIR
)/qt-5.3
.1
106 MINGW_DIR
:= $(QT_SDK_DIR
)/Tools
/mingw48_32
107 PYTHON_DIR
:= $(QT_SDK_DIR
)/Tools
/mingw48_32
/opt
/bin
108 NSIS_DIR
:= $(TOOLS_DIR
)/nsis-2.46
-unicode
109 SDL_DIR
:= $(TOOLS_DIR
)/SDL-1.2
.15
110 OPENSSL_DIR
:= $(TOOLS_DIR
)/openssl-1.0
.1e-win32
111 UNCRUSTIFY_DIR
:= $(TOOLS_DIR
)/uncrustify-0.60
112 DOXYGEN_DIR
:= $(TOOLS_DIR
)/doxygen-1.8
.3.1
113 GTEST_DIR
:= $(TOOLS_DIR
)/gtest-1.6
.0
115 ifeq ($(UNAME
), Windows
)
116 MINGW_DIR
:= $(QT_SDK_DIR
)/Tools
/$(QT_SDK_ARCH
)
117 PYTHON_DIR
:= $(QT_SDK_DIR
)/Tools
/$(QT_SDK_ARCH
)/opt
/bin
118 NSIS_DIR
:= $(TOOLS_DIR
)/nsis-2.46
-unicode
119 SDL_DIR
:= $(TOOLS_DIR
)/SDL-1.2
.15
120 OPENSSL_DIR
:= $(TOOLS_DIR
)/openssl-1.0
.1e-win32
121 MESAWIN_DIR
:= $(TOOLS_DIR
)/mesawin
124 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)
126 ##############################
128 # Build only and all toolchains available for the platform
130 ##############################
132 BUILD_SDK_TARGETS
:= arm_sdk qt_sdk
133 ifeq ($(UNAME
), Windows
)
134 BUILD_SDK_TARGETS
+= sdl nsis mesawin openssl
136 ALL_SDK_TARGETS
:= $(BUILD_SDK_TARGETS
) gtest uncrustify doxygen
138 define GROUP_SDK_TEMPLATE
139 .PHONY
: $(1)_install
$(1)_clean
$(1)_distclean
$(1)_version
140 $(1)_install
: $(addsuffix _install
,$(2))
141 $(1)_clean
: $(addsuffix _clean
,$(2))
142 $(1)_distclean
: $(addsuffix _distclean
,$(2))
143 $(1)_version
: $(addsuffix _version
,$(2))
146 $(eval
$(call GROUP_SDK_TEMPLATE
,build_sdk
,$(BUILD_SDK_TARGETS
)))
147 $(eval
$(call GROUP_SDK_TEMPLATE
,all_sdk
,$(ALL_SDK_TARGETS
)))
149 ##############################
153 ##############################
155 # Used by other makefiles
156 export MKDIR
:= mkdir
164 # Used only by this Makefile
175 ifneq ($(UNAME
), Windows
)
179 ifneq ($(shell $(SEVENZIP
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
180 # no $(SEVENZIP) found in path. hope is in bin...
181 SEVENZIP
= $(TOOLS_DIR
)/bin
/7za.exe
185 # Echo in recipes is a bit tricky in a Windows Git Bash window in some cases.
186 # It does not work if make started under msysGit installed into a path with spaces.
187 ifneq ($(UNAME
), Windows
)
190 # export ECHO := $(PYTHON) -c "import sys; print(' '.join(sys.argv[1:]))"
194 # Test if quotes are needed for the echo command
195 ifeq ($(shell $(ECHO
) "test"), test)
197 # This line is just to clear out the single quote above '
202 # Command to extract version info data from the repository and source tree
203 export VERSION_INFO
= $(PYTHON
) $(ROOT_DIR
)/make
/scripts
/version-info.py
--path
=$(ROOT_DIR
)
205 ##############################
209 ##############################
212 MSG_VERIFYING
= $(QUOTE
) VERIFY
$(QUOTE
)
213 MSG_DOWNLOADING
= $(QUOTE
) DOWNLOAD
$(QUOTE
)
214 MSG_CHECKSUMMING
= $(QUOTE
) MD5
$(QUOTE
)
215 MSG_EXTRACTING
= $(QUOTE
) EXTRACT
$(QUOTE
)
216 MSG_CONFIGURING
= $(QUOTE
) CONFIGURE
$(QUOTE
)
217 MSG_BUILDING
= $(QUOTE
) BUILD
$(QUOTE
)
218 MSG_INSTALLING
= $(QUOTE
) INSTALL
$(QUOTE
)
219 MSG_CLEANING
= $(QUOTE
) CLEAN
$(QUOTE
)
220 MSG_DISTCLEANING
= $(QUOTE
) DISTCLEAN
$(QUOTE
)
221 MSG_NOTICE
= $(QUOTE
) NOTE
$(QUOTE
)
228 MAKE_SILENT
:= --silent
234 CURL_OPTIONS
:= --silent
-L
239 # MSYS tar workaround
240 ifeq ($(UNAME
), Windows
)
241 TAR_OPTIONS
:= --force-local
246 # Print some useful notes for *_install targets
247 ifneq ($(strip $(filter $(addsuffix _install
,all_sdk
$(ALL_SDK_TARGETS
)),$(MAKECMDGOALS
))),)
248 ifneq ($(shell $(CURL
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
249 $(error Please
install curl first
('apt-get install curl' or similar
))
251 $(info $(EMPTY
) NOTE Use
'make all_sdk_distclean' to remove installation files
)
252 $(info $(EMPTY
) NOTE Use
'make all_sdk_version' to
check toolchain versions
)
253 $(info $(EMPTY
) NOTE Add
'V=1' to make command line to diagnose make problems
)
254 $(info $(EMPTY
) NOTE Add
'BATCH=1' to make command line to disable progress reporting during downloads
)
257 ##############################
259 # Cross-platform MD5 check template
260 # $(1) = file name without quotes
261 # $(2) = string compare operator, e.g. = or !=
263 ##############################
265 define MD5_CHECK_TEMPLATE
266 "`test -f \"$(1)\" && $(OPENSSL) dgst -md5 \"$(1)\" | $(CUT) -f2 -d' '`" $(2) "`$(CUT) -f1 -d' ' < \"$(1).md5\"`"
269 ##############################
271 # Cross platform download template
273 # $(2) = Package file
274 # $(3) = URL for .md5 file to be tested against Package
276 ##############################
278 define DOWNLOAD_TEMPLATE
279 @
$(ECHO
) $(MSG_VERIFYING
) $$(call toprel
, $(DL_DIR
)/$(2))
282 $(CURL
) $(CURL_OPTIONS
) --silent
-o
"$(DL_DIR)/$(2).md5" "$(3)" && \
283 if
[ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),!=) ]; then \
284 $(ECHO
) $(MSG_DOWNLOADING
) $(1) && \
285 $(CURL
) $(CURL_OPTIONS
) -o
"$(DL_DIR)/$(2)" "$(1)" && \
286 $(ECHO
) $(MSG_CHECKSUMMING
) $$(call toprel
, $(DL_DIR
)/$(2)) && \
287 [ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),=) ]; \
292 ##############################
294 # Common tool install template
296 # $(2) = tool extract/build directory
297 # $(3) = tool distribution URL
298 # $(4) = tool distribution MD5 URL
299 # $(5) = tool distribution file
300 # $(6) = optional extra build recipes template
301 # $(7) = optional extra clean recipes template
303 ##############################
307 define TOOL_INSTALL_TEMPLATE
309 .PHONY
: $(addprefix $(1)_
, install clean distclean)
311 $(1)_install
: $(1)_clean |
$(DL_DIR
) $(TOOLS_DIR
)
313 $(if
$(4), $(call DOWNLOAD_TEMPLATE
,$(3),$(5),$(4)),$(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(3).md5"))
315 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(2))
316 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
318 $(if
$(filter $(suffix $(5)), .zip
),
319 $(V1
) $(UNZIP
) $(UNZIP_SILENT
) -d
$$(call toprel
, $(dir $(2))) $$(call toprel
, $(DL_DIR
)/$(5)),
320 $(V1
) $(TAR
) $(TAR_OPTIONS
) -C
$$(call toprel
, $(dir $(2))) -xf
$$(call toprel
, $(DL_DIR
)/$(5))
326 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(2))
327 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
332 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
333 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
334 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
338 ##############################
340 # Windows QT install template
341 # $(1) = tool temp extract/build directory
342 # $(2) = tool install directory
343 # $(3) = tool distribution URL
344 # $(4) = tool distribution .md5 URL
345 # $(5) = tool distribution file
346 # $(6) = QT architecture
347 # $(7) = optional extra build recipes template
348 # $(8) = optional extra clean recipes template
350 ##############################
352 define WIN_QT_INSTALL_TEMPLATE
354 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
356 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
357 $(V1
) if
! $(SEVENZIP
) >/dev
/null
2>&1; then \
358 $(ECHO
) $(MSG_NOTICE
) "Missing 7zip. Run ./make/scripts/win_sdk_install.sh [<OpenPilot tools dir>] to get it." && \
361 $(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(4)")
362 # Explode .run file into install packages
363 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(1))
364 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(1)))
365 $(V1
) chmod
+x
$(DL_DIR
)/$(5)
366 $(V1
) $(DL_DIR
)/$(5) --dump-binary-data
-o
$(1)
367 # Extract packages under tool directory
368 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
369 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0-0qt-project-url.7z" | grep
-v Extracting
370 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt/5.3.1ThirdPartySoftware_Listing.7z" | grep
-v Extracting
371 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0-0readme.7z" | grep
-v Extracting
372 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.win32_mingw482/5.3.1-0qt5_essentials.7z" | grep
-v Extracting
373 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.win32_mingw482/5.3.1-0i686-4.8.2-release-posix-dwarf-rt_v3-rev3-runtime.7z" | grep
-v Extracting
374 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.win32_mingw482/5.3.1-0icu_52_1_mingw_builds_32_4_8_2_posix_dwarf.7z" | grep
-v Extracting
375 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.win32_mingw482/5.3.1-0qt5_addons.7z" | grep
-v Extracting
376 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.tools.win32_mingw482/4.8.2i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z" | grep
-v Extracting
379 @
$(ECHO
) "Executing QtPatch in" $$(call toprel
, $(QT_SDK_PREFIX
))
380 $(V1
) $(CD
) $(QT_SDK_PREFIX
)
381 $(V1
) $(DL_DIR
)/$(5) --runoperation QtPatch windows
$(QT_SDK_PREFIX
) qt5
383 # Execute post build templates
386 # Clean up temporary files
387 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
388 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
391 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
392 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
393 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, "$(2)")
394 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
399 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
400 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
401 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
405 ##############################
407 # Linux QT install template
408 # $(1) = tool temp extract/build directory
409 # $(2) = tool install directory
410 # $(3) = tool distribution URL
411 # $(4) = tool distribution .md5 URL
412 # $(5) = tool distribution file
413 # $(6) = QT architecture
414 # $(7) = optional extra build recipes template
415 # $(8) = optional extra clean recipes template
417 ##############################
419 define LINUX_QT_INSTALL_TEMPLATE
421 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
423 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
424 $(V1
) if
! $(SEVENZIP
) >/dev
/null
2>&1; then \
425 $(ECHO
) $(MSG_NOTICE
) "Please install the p7zip for your distribution. i.e.: sudo apt-get install p7zip-full" && \
428 $(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(4)")
429 # Explode .run file into install packages
430 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(1))
431 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(1)))
432 $(V1
) chmod
+x
$(DL_DIR
)/$(5)
433 $(V1
) $(DL_DIR
)/$(5) --dump-binary-data
-o
$(1)
434 # Extract packages under tool directory
435 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
436 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0-0qt-project-url.7z" | grep
-v Extracting
437 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt/5.3.1ThirdPartySoftware_Listing.7z" | grep
-v Extracting
438 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0-0readme.7z" | grep
-v Extracting
439 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.$(6)/5.3.1-0qt5_essentials.7z" | grep
-v Extracting
440 $(V1
) if
[ -f
"$(1)/qt.53.$(6)/5.3.1-0icu_52_1_ubuntu_11_10_64.7z" ]; then
$(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.$(6)/5.3.1-0icu_52_1_ubuntu_11_10_64.7z" | grep
-v Extracting
; fi
441 $(V1
) if
[ -f
"$(1)/qt.53.$(6)/5.3.1-0icu_52_1_ubuntu_11_10_32.7z" ]; then
$(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.$(6)/5.3.1-0icu_52_1_ubuntu_11_10_32.7z" | grep
-v Extracting
; fi
442 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.$(6)/5.3.1-0qt5_addons.7z" | grep
-v Extracting
443 # go to OpenPilot/tools/5.3.1/gcc_64 and call patcher.sh
445 @
$(ECHO
) "Running patcher in" $$(call toprel
, $(QT_SDK_PREFIX
))
446 $(V1
) $(CD
) $(QT_SDK_PREFIX
)
447 # $(V1) "$(QT_SDK_PREFIX)/patcher.sh" $(QT_SDK_PREFIX)
449 @
$(ECHO
) "Executing QtPatch in" $$(call toprel
, $(QT_SDK_PREFIX
))
450 $(V1
) $(DL_DIR
)/$(5) --runoperation QtPatch linux
$(QT_SDK_PREFIX
) qt5
452 # Execute post build templates
455 # Clean up temporary files
456 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
457 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
460 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
461 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
462 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, "$(2)")
463 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
468 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
469 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
470 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
475 ##############################
477 # Mac QT install template
478 # $(1) = tool temp extract/build directory
479 # $(2) = tool install directory
480 # $(3) = tool distribution URL
481 # $(4) = tool distribution .md5 URL
482 # $(5) = tool distribution file
483 # $(6) = QT architecture
484 # $(7) = optional extra build recipes template
485 # $(8) = optional extra clean recipes template
487 ##############################
489 define MAC_QT_INSTALL_TEMPLATE
491 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
493 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
494 $(V1
) if
! $(SEVENZIP
) >/dev
/null
2>&1; then \
495 $(ECHO
) $(MSG_NOTICE
) "Please install the p7zip for your distribution. i.e.: brew install p7zip." && \
498 $(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(4)")
500 $(V1
) hdiutil attach
-nobrowse
$(DL_DIR
)/$(5)
501 # Explode .dmg file into install packages
502 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(1))
503 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(1)))
504 $(V1
) $(QT_SDK_MAINTENANCE_TOOL
) --dump-binary-data
-i
$(QT_SDK_INSTALLER_DAT
) -o
$(1)
505 # Extract packages under tool directory
506 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
507 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0-0qt-project-url.7z" | grep
-v Extracting
508 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt/5.3.1ThirdPartySoftware_Listing.7z" | grep
-v Extracting
509 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.readme/1.0.0-0readme.7z" | grep
-v Extracting
510 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.$(6)/5.3.1-0qt5_essentials.7z" | grep
-v Extracting
511 # $(V1) $(SEVENZIP) -y -o$(2) x "$(1)/qt.53.$(6).essentials/5.3.1icu_path_patcher.sh.7z" | grep -v Extracting
512 $(V1
) $(SEVENZIP
) -y
-o
$(2) x
"$(1)/qt.53.$(6)/5.3.1-0qt5_addons.7z" | grep
-v Extracting
513 # go to OpenPilot/tools/5.3.1/gcc_64 and call patcher.sh
515 @
$(ECHO
) "Running patcher in" $$(call toprel
, $(QT_SDK_PREFIX
))
516 $(V1
) $(CD
) $(QT_SDK_PREFIX
)
517 # $(V1) "$(QT_SDK_PREFIX)/patcher.sh" $(QT_SDK_PREFIX)
519 @
$(ECHO
) "Executing QtPatch in" $$(call toprel
, $(QT_SDK_PREFIX
))
520 $(V1
) $(QT_SDK_MAINTENANCE_TOOL
) --runoperation QtPatch mac
$(QT_SDK_PREFIX
) qt5
522 #Unmount the .dmg file
523 $(V1
) hdiutil detach
$(QT_SDK_MOUNT_DIR
)
525 # Execute post build templates
528 # Clean up temporary files
529 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
530 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
533 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
534 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
535 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, "$(2)")
536 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
541 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
542 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
543 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
547 ##############################
551 ##############################
552 ifeq ($(UNAME
), Windows
)
553 #unfortunately zip package for this release is missing root directory, so adding / at the end of the path
554 # so that template interpret last part as directory and use the full path
555 $(eval
$(call TOOL_INSTALL_TEMPLATE
,arm_sdk
,$(ARM_SDK_DIR
)/,$(ARM_SDK_URL
),$(ARM_SDK_MD5_URL
),$(notdir $(ARM_SDK_URL
))))
557 $(eval
$(call TOOL_INSTALL_TEMPLATE
,arm_sdk
,$(ARM_SDK_DIR
),$(ARM_SDK_URL
),$(ARM_SDK_MD5_URL
),$(notdir $(ARM_SDK_URL
))))
559 ifeq ($(shell [ -d
"$(ARM_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
560 export ARM_SDK_PREFIX
:= $(ARM_SDK_DIR
)/bin
/arm-none-eabi-
562 # not installed, hope it's in the path...
563 # $(info $(EMPTY) WARNING $(call toprel, $(ARM_SDK_DIR)) not found (make arm_sdk_install), using system PATH)
564 export ARM_SDK_PREFIX ?
= arm-none-eabi-
567 .PHONY
: arm_sdk_version
569 -$(V1
) $(ARM_SDK_PREFIX
)gcc
--version | head
-n1
571 # Template to check ARM toolchain version before building targets
572 define ARM_GCC_VERSION_CHECK_TEMPLATE
573 if
! $(ARM_SDK_PREFIX
)gcc
--version
--specs
=nano.specs
>/dev
/null
2>&1; then \
574 $(ECHO
) $(MSG_NOTICE
) Please
install ARM toolchain
4.8 2014q1 using
\'make arm_sdk_install
\' && \
575 $(ECHO
) $(MSG_NOTICE
) Older ARM SDKs do not support new
\'--specs
=nano.specs
\' option
&& \
580 ##############################
584 ##############################
586 ifeq ($(UNAME
), Windows
)
588 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)/5.3/$(QT_SDK_ARCH
)
590 # This additional configuration step should not be necessary
591 # but it is needed as a workaround to https://bugreports.qt-project.org/browse/QTBUG-33254
592 define QT_SDK_CONFIGURE_TEMPLATE
593 @
$(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(QT_SDK_DIR
))
594 $(V1
) $(ECHO
) $(QUOTE
)[Paths
]$(QUOTE
) > $(QT_SDK_PREFIX
)/bin
/qt.conf
595 $(V1
) $(ECHO
) $(QUOTE
)Prefix
= $(QT_SDK_PREFIX
)$(QUOTE
) >> $(QT_SDK_PREFIX
)/bin
/qt.conf
598 QT_BUILD_DIR
:= $(BUILD_DIR
)/QT_BUILD
599 $(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
)))
601 else ifeq ($(UNAME
), Linux
)
603 QT_SDK_PREFIX
:= "$(QT_SDK_DIR)/5.3/$(QT_SDK_ARCH)"
604 QT_BUILD_DIR
:= $(BUILD_DIR
)/QT_BUILD
605 $(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
)))
607 else ifeq ($(UNAME
), Darwin
)
609 QT_SDK_PREFIX
:= "$(QT_SDK_DIR)/5.3/$(QT_SDK_ARCH)"
610 QT_BUILD_DIR
:= $(BUILD_DIR
)/QT_BUILD
611 $(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
)))
615 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)
617 .PHONY
: qt_sdk_install
619 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
620 @
$(ECHO
) $(MSG_NOTICE
) Please
install native Qt
5.3.x SDK using package manager
621 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
626 .PHONY
: qt_sdk_distclean
631 ifeq ($(shell [ -d
"$(QT_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
632 export QMAKE
:= $(QT_SDK_PREFIX
)/bin
/qmake
634 # set Qt library search path
635 ifeq ($(UNAME
), Windows
)
636 export PATH
:= $(QT_SDK_PREFIX
)/bin
:$(PATH
)
638 export LD_LIBRARY_PATH
:= $(QT_SDK_DIR
)/lib
:$(LD_LIBRARY_PATH
)
641 # not installed, hope it's in the path...
642 # $(info $(EMPTY) WARNING $(call toprel, $(QT_SDK_DIR)) not found (make qt_sdk_install), using system PATH)
646 .PHONY
: qt_sdk_version
648 -$(V1
) $(QMAKE
) --version | tail
-1
650 ##############################
654 ##############################
656 ifeq ($(UNAME
), Windows
)
658 ifeq ($(shell [ -d
"$(MINGW_DIR)" ] && $(ECHO
) "exists"), exists
)
659 # set MinGW binary and library paths (QTMINGW is used by qmake, do not rename)
660 export QTMINGW
:= $(MINGW_DIR
)/bin
661 export PATH
:= $(QTMINGW
):$(PATH
)
663 # not installed, use host gcc compiler
664 # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found, using system PATH)
667 .PHONY
: mingw_version
668 mingw_version
: gcc_version
672 all_sdk_version
: gcc_version
678 -$(V1
) gcc
--version | head
-n1
680 ##############################
684 ##############################
686 ifeq ($(shell [ -d
"$(PYTHON_DIR)" ] && $(ECHO
) "exists"), exists
)
687 export PYTHON
:= $(PYTHON_DIR
)/python
688 export PATH
:= $(PYTHON_DIR
):$(PATH
)
690 # not installed, hope it's in the path...
691 # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found, using system PATH)
692 ifeq ($(findstring Python
2,$(shell python
--version
2>&1)), Python
2)
693 export PYTHON
:= python
695 export PYTHON
:= python2
699 .PHONY
: python_version
701 -$(V1
) $(PYTHON
) --version
703 ##############################
705 # NSIS Unicode (Windows only)
707 ##############################
709 ifeq ($(UNAME
), Windows
)
711 $(eval
$(call TOOL_INSTALL_TEMPLATE
,nsis
,$(NSIS_DIR
),$(NSIS_URL
),,$(notdir $(NSIS_URL
))))
713 ifeq ($(shell [ -d
"$(NSIS_DIR)" ] && $(ECHO
) "exists"), exists
)
714 export NSIS
:= $(NSIS_DIR
)/makensis
716 # not installed, hope it's in the path...
717 # $(info $(EMPTY) WARNING $(call toprel, $(NSIS_DIR)) not found (make nsis_install), using system PATH)
718 export NSIS ?
= makensis
723 -$(V1
) $(NSIS
) | head
-n1
727 ##############################
731 ##############################
733 ifeq ($(UNAME
), Windows
)
735 $(eval
$(call TOOL_INSTALL_TEMPLATE
,sdl
,$(SDL_DIR
),$(SDL_URL
),,$(notdir $(SDL_URL
))))
737 ifeq ($(shell [ -d
"$(SDL_DIR)" ] && $(ECHO
) "exists"), exists
)
738 export SDL_DIR
:= $(SDL_DIR
)
740 # not installed, hope it's in the path...
741 $(info $(EMPTY
) WARNING
$(call toprel
, $(SDL_DIR
)) not found
(make sdl_install
), using system PATH
)
746 -$(V1
) $(ECHO
) "SDL 1.2.15"
750 ##################################
752 # Mesa OpenGL DLL (Windows only)
754 ##################################
756 ifeq ($(UNAME
), Windows
)
758 $(eval
$(call TOOL_INSTALL_TEMPLATE
,mesawin
,$(MESAWIN_DIR
),$(MESAWIN_URL
),,$(notdir $(MESAWIN_URL
))))
760 ifeq ($(shell [ -d
"$(MESAWIN_DIR)" ] && $(ECHO
) "exists"), exists
)
761 export MESAWIN_DIR
:= $(MESAWIN_DIR
)
763 # not installed, hope it's in the path...
764 #$(info $(EMPTY) WARNING $(call toprel, $(MESA_WIN_DIR)) not found (make mesawin_install), using system PATH)
767 .PHONY
: mesawin_version
769 -$(V1
) $(ECHO
) "MesaOpenGL vXX"
773 ##############################
775 # OpenSSL (Windows only)
777 ##############################
779 ifeq ($(UNAME
), Windows
)
781 $(eval
$(call TOOL_INSTALL_TEMPLATE
,openssl
,$(OPENSSL_DIR
),$(OPENSSL_URL
),,$(notdir $(OPENSSL_URL
))))
783 ifeq ($(shell [ -d
"$(OPENSSL_DIR)" ] && $(ECHO
) "exists"), exists
)
784 export OPENSSL
:= "$(OPENSSL_DIR)/bin/openssl"
785 export OPENSSL_DIR
:= "$(OPENSSL_DIR)"
787 # not installed, hope it's in the path...
788 # $(info $(EMPTY) WARNING $(call toprel, $(OPENSSL_DIR)) not found (make openssl_install), using system PATH)
791 .PHONY
: openssl_version
793 -$(V1
) $(ECHO
) "OpenSSL `$(OPENSSL) version`"
797 ##############################
801 ##############################
803 ifeq ($(UNAME
), Windows
)
805 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
))))
809 UNCRUSTIFY_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(UNCRUSTIFY_DIR
))
811 define UNCRUSTIFY_BUILD_TEMPLATE
813 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
814 cd
$(UNCRUSTIFY_BUILD_DIR
) && \
815 .
/configure
--prefix="$(UNCRUSTIFY_DIR)" && \
816 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
817 $(MAKE
) $(MAKE_SILENT
) && \
818 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(UNCRUSTIFY_DIR
)) && \
819 $(MAKE
) $(MAKE_SILENT
) install-strip \
821 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
))
822 -$(V1
) [ ! -d
"$(UNCRUSTIFY_BUILD_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_BUILD_DIR)"
825 define UNCRUSTIFY_CLEAN_TEMPLATE
826 -$(V1
) [ ! -d
"$(UNCRUSTIFY_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_DIR)"
829 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_BUILD_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
)),$(UNCRUSTIFY_BUILD_TEMPLATE
),$(UNCRUSTIFY_CLEAN_TEMPLATE
)))
833 ifeq ($(shell [ -d
"$(UNCRUSTIFY_DIR)" ] && $(ECHO
) "exists"), exists
)
834 export UNCRUSTIFY
:= $(UNCRUSTIFY_DIR
)/bin
/uncrustify
836 # not installed, hope it's in the path...
837 # $(info $(EMPTY) WARNING $(call toprel, $(UNCRUSTIFY_DIR)) not found (make uncrustify_install), using system PATH)
838 export UNCRUSTIFY
:= uncrustify
841 .PHONY
: uncrustify_version
843 -$(V1
) $(UNCRUSTIFY
) --version
845 ##############################
849 ##############################
851 ifeq ($(UNAME
), Windows
)
853 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
))))
857 DOXYGEN_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(DOXYGEN_DIR
))
859 define DOXYGEN_BUILD_TEMPLATE
861 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
862 cd
$(DOXYGEN_BUILD_DIR
) && \
863 .
/configure
--prefix "$(DOXYGEN_DIR)" --english-only
&& \
864 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
865 $(MAKE
) $(MAKE_SILENT
) && \
866 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(DOXYGEN_DIR
)) && \
867 $(MAKE
) $(MAKE_SILENT
) install \
869 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
))
870 -$(V1
) [ ! -d
"$(DOXYGEN_BUILD_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_BUILD_DIR)"
873 define DOXYGEN_CLEAN_TEMPLATE
874 -$(V1
) [ ! -d
"$(DOXYGEN_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_DIR)"
877 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_BUILD_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
)),$(DOXYGEN_BUILD_TEMPLATE
),$(DOXYGEN_CLEAN_TEMPLATE
)))
881 ifeq ($(shell [ -d
"$(DOXYGEN_DIR)" ] && $(ECHO
) "exists"), exists
)
882 export DOXYGEN
:= $(DOXYGEN_DIR
)/bin
/doxygen
884 # not installed, hope it's in the path...
885 # $(info $(EMPTY) WARNING $(call toprel, $(DOXYGEN_DIR)) not found (make doxygen_install), using system PATH)
886 export DOXYGEN
:= doxygen
889 .PHONY
: doxygen_version
891 -$(V1
) $(ECHO
) "Doxygen `$(DOXYGEN) --version`"
893 ##############################
897 ##############################
899 $(eval
$(call TOOL_INSTALL_TEMPLATE
,gtest
,$(GTEST_DIR
),$(GTEST_URL
),,$(notdir $(GTEST_URL
))))
903 .PHONY
: gtest_version
905 -$(V1
) $(SED
) -n
"s/^PACKAGE_STRING='\(.*\)'/\1/p" < $(GTEST_DIR
)/configure
911 ##############################
913 # TODO: code below is not revised yet
915 ##############################
917 # Set up openocd tools
918 OPENOCD_DIR
:= $(TOOLS_DIR
)/openocd
919 OPENOCD_WIN_DIR
:= $(TOOLS_DIR
)/openocd_win
920 OPENOCD_BUILD_DIR
:= $(DL_DIR
)/openocd-build
922 .PHONY
: openocd_install
923 openocd_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
924 openocd_install
: OPENOCD_URL
:= http
://sourceforge.net
/projects
/openocd
/files
/openocd
/0.6.1/openocd-0.6
.1.
tar.bz2
/download
925 openocd_install
: OPENOCD_FILE
:= openocd-0.6
.1.
tar.bz2
926 openocd_install
: openocd_clean
927 # download the source only if it's newer than what we already have
928 $(V1
) $(WGET
) -N
-P
"$(DL_DIR)" --trust-server-name
"$(OPENOCD_URL)"
931 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_BUILD_DIR)"
932 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
933 $(V1
) tar -C
$(OPENOCD_BUILD_DIR
) -xjf
"$(DL_DIR)/$(OPENOCD_FILE)"
936 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
938 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
939 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
940 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
944 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
946 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
947 .
/configure
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-stlink
; \
949 $(MAKE
) --silent
install ; \
952 # delete the extracted source when we're done
953 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
955 .PHONY
: ftd2xx_install
957 FTD2XX_DIR
:= $(DL_DIR
)/ftd2xx
959 ftd2xx_install
: |
$(DL_DIR
)
960 ftd2xx_install
: FTD2XX_URL
:= http
://www.ftdichip.com
/Drivers
/CDM
/Beta
/CDM20817.zip
961 ftd2xx_install
: FTD2XX_FILE
:= CDM20817.zip
962 ftd2xx_install
: ftd2xx_clean
963 # download the file only if it's newer than what we already have
964 $(V0
) @echo
" DOWNLOAD $(FTD2XX_URL)"
965 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" "$(FTD2XX_URL)"
968 $(V0
) @echo
" EXTRACT $(FTD2XX_FILE) -> $(FTD2XX_DIR)"
969 $(V1
) mkdir
-p
"$(FTD2XX_DIR)"
970 $(V1
) unzip
-q
-d
"$(FTD2XX_DIR)" "$(DL_DIR)/$(FTD2XX_FILE)"
974 $(V0
) @echo
" CLEAN $(FTD2XX_DIR)"
975 $(V1
) [ ! -d
"$(FTD2XX_DIR)" ] ||
$(RM
) -r
"$(FTD2XX_DIR)"
977 .PHONY
: ftd2xx_install
979 LIBUSB_WIN_DIR
:= $(DL_DIR
)/libusb-win32-bin-1.2
.6.0
981 libusb_win_install
: |
$(DL_DIR
)
982 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
983 libusb_win_install
: LIBUSB_WIN_FILE
:= libusb-win32-bin-1.2
.6.0.zip
984 libusb_win_install
: libusb_win_clean
985 # download the file only if it's newer than what we already have
986 $(V0
) @echo
" DOWNLOAD $(LIBUSB_WIN_URL)"
987 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" --trust-server-name
"$(LIBUSB_WIN_URL)"
990 $(V0
) @echo
" EXTRACT $(LIBUSB_WIN_FILE) -> $(LIBUSB_WIN_DIR)"
991 $(V1
) mkdir
-p
"$(LIBUSB_WIN_DIR)"
992 $(V1
) unzip
-q
-d
"$(DL_DIR)" "$(DL_DIR)/$(LIBUSB_WIN_FILE)"
994 # fixup .h file needed by openocd build
995 $(V0
) @echo
" FIXUP $(LIBUSB_WIN_DIR)"
996 $(V1
) ln
-s
"$(LIBUSB_WIN_DIR)/include/lusb0_usb.h" "$(LIBUSB_WIN_DIR)/include/usb.h"
998 .PHONY
: libusb_win_clean
1000 $(V0
) @echo
" CLEAN $(LIBUSB_WIN_DIR)"
1001 $(V1
) [ ! -d
"$(LIBUSB_WIN_DIR)" ] ||
$(RM
) -r
"$(LIBUSB_WIN_DIR)"
1003 .PHONY
: openocd_git_win_install
1005 openocd_git_win_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1006 openocd_git_win_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
1007 openocd_git_win_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
1008 openocd_git_win_install
: openocd_win_clean libusb_win_install ftd2xx_install
1009 # download the source
1010 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
1011 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1012 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
1013 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(DL_DIR)/openocd-build"
1015 cd
$(OPENOCD_BUILD_DIR
) ; \
1016 git checkout
-q
$(OPENOCD_REV
) ; \
1020 $(V0
) @echo
" PATCH $(OPENOCD_BUILD_DIR)"
1022 cd
$(OPENOCD_BUILD_DIR
) ; \
1023 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
1024 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
1028 $(V0
) @echo
" BUILD $(OPENOCD_WIN_DIR)"
1029 $(V1
) mkdir
-p
"$(OPENOCD_WIN_DIR)"
1031 cd
$(OPENOCD_BUILD_DIR
) ; \
1033 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_WIN_DIR)" \
1034 --build
=i686-pc-linux-gnu
--host
=i586-mingw32msvc \
1035 CPPFLAGS
=-I
$(LIBUSB_WIN_DIR
)/include \
1036 LDFLAGS
=-L
$(LIBUSB_WIN_DIR
)/lib
/gcc \
1037 --enable-ft2232_ftd2xx
--with-ftd2xx-win32-zipdir
=$(FTD2XX_DIR
) \
1044 # delete the extracted source when we're done
1045 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1047 .PHONY
: openocd_win_clean
1049 $(V0
) @echo
" CLEAN $(OPENOCD_WIN_DIR)"
1050 $(V1
) [ ! -d
"$(OPENOCD_WIN_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_WIN_DIR)"
1052 .PHONY
: openocd_git_install
1054 openocd_git_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1055 openocd_git_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
1056 openocd_git_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
1057 openocd_git_install
: openocd_clean
1058 # download the source
1059 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
1060 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1061 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
1062 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(OPENOCD_BUILD_DIR)"
1064 cd
$(OPENOCD_BUILD_DIR
) ; \
1065 git checkout
-q
$(OPENOCD_REV
) ; \
1069 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
1071 cd
$(OPENOCD_BUILD_DIR
) ; \
1072 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
1073 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
1077 $(V0
) @echo
" BUILD $(OPENOCD_DIR)"
1078 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
1080 cd
$(OPENOCD_BUILD_DIR
) ; \
1082 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-buspirate
--enable-stlink
; \
1087 # delete the extracted source when we're done
1088 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1090 .PHONY
: openocd_clean
1092 $(V0
) @echo
" CLEAN $(OPENOCD_DIR)"
1093 $(V1
) [ ! -d
"$(OPENOCD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_DIR)"
1095 STM32FLASH_DIR
:= $(TOOLS_DIR
)/stm32flash
1097 .PHONY
: stm32flash_install
1098 stm32flash_install
: STM32FLASH_URL
:= http
://stm32flash.googlecode.com
/svn
/trunk
1099 stm32flash_install
: STM32FLASH_REV
:= 61
1100 stm32flash_install
: stm32flash_clean
1101 # download the source
1102 $(V0
) @echo
" DOWNLOAD $(STM32FLASH_URL) @ r$(STM32FLASH_REV)"
1103 $(V1
) svn
export -q
-r
"$(STM32FLASH_REV)" "$(STM32FLASH_URL)" "$(STM32FLASH_DIR)"
1106 $(V0
) @echo
" BUILD $(STM32FLASH_DIR)"
1107 $(V1
) $(MAKE
) --silent
-C
$(STM32FLASH_DIR
) all
1109 .PHONY
: stm32flash_clean
1111 $(V0
) @echo
" CLEAN $(STM32FLASH_DIR)"
1112 $(V1
) [ ! -d
"$(STM32FLASH_DIR)" ] ||
$(RM
) -r
"$(STM32FLASH_DIR)"
1114 DFUUTIL_DIR
:= $(TOOLS_DIR
)/dfu-util
1116 .PHONY
: dfuutil_install
1117 dfuutil_install
: DFUUTIL_URL
:= http
://dfu-util.gnumonks.org
/releases
/dfu-util-0.7.
tar.gz
1118 dfuutil_install
: DFUUTIL_FILE
:= $(notdir $(DFUUTIL_URL
))
1119 dfuutil_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1120 dfuutil_install
: dfuutil_clean
1121 # download the source
1122 $(V0
) @echo
" DOWNLOAD $(DFUUTIL_URL)"
1123 $(V1
) $(WGET
) -N
-P
"$(DL_DIR)" "$(DFUUTIL_URL)"
1125 # extract the source
1126 $(V0
) @echo
" EXTRACT $(DFUUTIL_FILE)"
1127 $(V1
) [ ! -d
"$(DL_DIR)/dfuutil-build" ] ||
$(RM
) -r
"$(DL_DIR)/dfuutil-build"
1128 $(V1
) mkdir
-p
"$(DL_DIR)/dfuutil-build"
1129 $(V1
) tar -C
$(DL_DIR
)/dfuutil-build
-xf
"$(DL_DIR)/$(DFUUTIL_FILE)"
1132 $(V0
) @echo
" BUILD $(DFUUTIL_DIR)"
1133 $(V1
) mkdir
-p
"$(DFUUTIL_DIR)"
1135 cd
$(DL_DIR
)/dfuutil-build
/dfu-util-0.7
; \
1136 .
/configure
--prefix="$(DFUUTIL_DIR)" ; \
1141 .PHONY
: dfuutil_clean
1143 $(V0
) @echo
" CLEAN $(DFUUTIL_DIR)"
1144 $(V1
) [ ! -d
"$(DFUUTIL_DIR)" ] ||
$(RM
) -r
"$(DFUUTIL_DIR)"
1146 # see http://developer.android.com/sdk/ for latest versions
1147 ANDROID_SDK_DIR
:= $(TOOLS_DIR
)/android-sdk-linux
1148 .PHONY
: android_sdk_install
1149 android_sdk_install
: ANDROID_SDK_URL
:= http
://dl.google.com
/android
/android-sdk_r20.0
.3-linux.tgz
1150 android_sdk_install
: ANDROID_SDK_FILE
:= $(notdir $(ANDROID_SDK_URL
))
1151 # order-only prereq on directory existance:
1152 android_sdk_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1153 android_sdk_install
: android_sdk_clean
1154 # download the source only if it's newer than what we already have
1155 $(V0
) @echo
" DOWNLOAD $(ANDROID_SDK_URL)"
1156 $(V1
) $(WGET
) --no-check-certificate
-N
-P
"$(DL_DIR)" "$(ANDROID_SDK_URL)"
1158 # binary only release so just extract it
1159 $(V0
) @echo
" EXTRACT $(ANDROID_SDK_FILE)"
1160 $(V1
) tar -C
$(TOOLS_DIR
) -xf
"$(DL_DIR)/$(ANDROID_SDK_FILE)"
1162 .PHONY
: android_sdk_clean
1164 $(V0
) @echo
" CLEAN $(ANDROID_SDK_DIR)"
1165 $(V1
) [ ! -d
"$(ANDROID_SDK_DIR)" ] ||
$(RM
) -r
$(ANDROID_SDK_DIR
)
1167 .PHONY
: android_sdk_update
1169 $(V0
) @echo
" UPDATE $(ANDROID_SDK_DIR)"
1170 $(ANDROID_SDK_DIR
)/tools
/android update sdk
--no-ui
-t platform-tools
,android-16
,addon-google_apis-google-16
1172 #Install git hooks under the right folder
1176 $(V0
) @echo
" Configuring GIT commit template"
1177 $(V1
) $(CD
) "$(ROOT_DIR)"
1178 $(V1
) $(GIT
) config commit.template .commit-template
1180 .PHONY
: prepare_clean
1182 $(V0
) @echo
" Cleanup GIT commit template configuration"
1183 $(V1
) $(CD
) "$(ROOT_DIR)"
1184 $(V1
) $(GIT
) config
--unset commit.template
1186 ##############################
1188 # TODO: these defines will go to tool install sections
1190 ##############################
1192 ifeq ($(shell [ -d
"$(OPENOCD_DIR)" ] && $(ECHO
) "exists"), exists
)
1193 export OPENOCD
:= $(OPENOCD_DIR
)/bin
/openocd
1195 # not installed, hope it's in the path...
1196 export OPENOCD ?
= openocd
1199 ifeq ($(shell [ -d
"$(ANDROID_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
1200 ANDROID
:= $(ANDROID_SDK_DIR
)/tools
/android
1201 ANDROID_DX
:= $(ANDROID_SDK_DIR
)/platform-tools
/dx
1203 # not installed, hope it's in the path...