2 # Installers for tools required by the build system.
3 # Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
4 # Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
6 # NOTE: install targets are not tied to the default goals and must
7 # be invoked manually. But tool paths set by this file are used
8 # across the build system.
13 # nsis_install (Windows only)
14 # 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 TOP_LEVEL_MAKEFILE
49 $(error
$(notdir $(lastword
$(MAKEFILE_LIST
))) should be included by the top level Makefile
)
52 ##############################
54 # Already installed tools modules
56 ##############################
57 -include $(wildcard $(TOOLS_DIR
)/*.mk
)
59 TOOL_INSTALL
:= $(ROOT_DIR
)/tool_install.sh
60 TOOL_TARGETS
:= gcc-arm-none-eabi
62 TOOL_INSTALL_TARGETS
:= $(addsuffix _install
,$(TOOL_TARGETS
))
63 TOOL_FORCE_INSTALL_TARGETS
:= $(addsuffix _force_install
,$(TOOL_TARGETS
))
64 TOOL_REMOVE_TARGETS
:= $(addsuffix _remove
,$(TOOL_TARGETS
))
66 .PHONY
: $(TOOL_INSTALL_TARGETS
)
67 $(TOOL_INSTALL_TARGETS
):
68 @
$(ECHO
) $(MSG_INSTALLING
) $(@
:_install
=)
69 $(V1
) $(TOOL_INSTALL
) -n
$(@
:_install
=)
71 .PHONY
: $(TOOL_FORCE_INSTALL_TARGETS
)
72 $(TOOL_FORCE_INSTALL_TARGETS
):
73 @
$(ECHO
) $(MSG_INSTALLING
) $(@
:_install
=)
74 $(V1
) $(TOOL_INSTALL
) -n
-f
$(@
:_force_install
=)
76 .PHONY
: $(TOOL_REMOVE_TARGETS
)
77 $(TOOL_REMOVE_TARGETS
):
78 @
$(ECHO
) $(MSG_CLEANING
) $(@
:_install
=)
79 $(V1
) $(TOOL_INSTALL
) -n
-r
$(@
:_remove
=)
81 ##############################
83 # Toolchain URLs and directories
85 ##############################
87 TOOLS_URL
:= http
://librepilot.github.io
/tools
89 QT_SHORT_VERSION
:= 5.6
92 ifeq ($(UNAME
), Linux
)
93 ifeq ($(ARCH
), x86_64
)
95 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/qt-opensource-linux-x64-
$(QT_VERSION
).run
96 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/md5sums.txt
97 OSG_URL
:= $(TOOLS_URL
)/osg-3.5
.3-linux-x64-qt-
$(QT_VERSION
).
tar.gz
98 OSGEARTH_URL
:= $(TOOLS_URL
)/osgearth-2.7
-linux-x64-qt-
$(QT_VERSION
).
tar.gz
100 # x32 for linux no longer provided as pre-built binaries.
102 UNCRUSTIFY_URL
:= $(TOOLS_URL
)/uncrustify-0.60.
tar.gz
103 DOXYGEN_URL
:= $(TOOLS_URL
)/doxygen-1.8
.3.1.src.
tar.gz
104 else ifeq ($(UNAME
), Darwin
)
105 QT_SDK_ARCH
:= clang_64
106 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/qt-opensource-mac-x64-clang-
$(QT_VERSION
).dmg
107 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/md5sums.txt
108 QT_SDK_MOUNT_DIR
:= /Volumes
/qt-opensource-mac-x64-clang-
$(QT_VERSION
)
109 QT_SDK_MAINTENANCE_TOOL
:= /Volumes
/qt-opensource-mac-x64-clang-
$(QT_VERSION
)/qt-opensource-mac-x64-clang-
$(QT_VERSION
).app
/Contents
/MacOS
/qt-opensource-mac-x64-clang-
$(QT_VERSION
)
110 UNCRUSTIFY_URL
:= $(TOOLS_URL
)/uncrustify-0.60.
tar.gz
111 DOXYGEN_URL
:= $(TOOLS_URL
)/doxygen-1.8
.3.1.src.
tar.gz
112 OSG_URL
:= $(TOOLS_URL
)/osg-3.5
.3-clang_64-qt-
$(QT_VERSION
).
tar.gz
113 OSGEARTH_URL
:= $(TOOLS_URL
)/osgearth-2.7
-clang_64-qt-
$(QT_VERSION
).
tar.gz
114 else ifeq ($(UNAME
), Windows
)
115 QT_SDK_ARCH
:= mingw492_32
116 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/qt-opensource-windows-x86-mingw492-
$(QT_VERSION
).exe
117 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/md5sums.txt
118 NSIS_URL
:= $(TOOLS_URL
)/nsis-2.46
-unicode.
tar.bz2
119 MESAWIN_URL
:= $(TOOLS_URL
)/mesawin.
tar.gz
120 UNCRUSTIFY_URL
:= $(TOOLS_URL
)/uncrustify-0.60
-windows.
tar.bz2
121 DOXYGEN_URL
:= $(TOOLS_URL
)/doxygen-1.8
.3.1-windows.
tar.bz2
124 GTEST_URL
:= $(TOOLS_URL
)/gtest-1.7
.0.zip
125 CCACHE_URL
:= http
://samba.org
/ftp
/ccache
/ccache-3.2
.2.
tar.bz2
126 CCACHE_MD5_URL
:= $(TOOLS_URL
)/ccache-3.2
.2.
tar.bz2.md5
128 QT_SDK_DIR
:= $(TOOLS_DIR
)/qt-
$(QT_VERSION
)
129 UNCRUSTIFY_DIR
:= $(TOOLS_DIR
)/uncrustify-0.60
130 DOXYGEN_DIR
:= $(TOOLS_DIR
)/doxygen-1.8
.3.1
131 GTEST_DIR
:= $(TOOLS_DIR
)/gtest-1.7
.0
132 CCACHE_DIR
:= $(TOOLS_DIR
)/ccache
134 ifeq ($(UNAME
), Linux
)
135 ifeq ($(ARCH
), x86_64
)
136 OSG_SDK_DIR
:= $(TOOLS_DIR
)/osg-3.5
.3-linux-x64-qt-
$(QT_VERSION
)
137 OSGEARTH_SDK_DIR
:= $(TOOLS_DIR
)/osgearth-2.7
-linux-x64-qt-
$(QT_VERSION
)
139 OSG_SDK_DIR
:= $(TOOLS_DIR
)/osg-3.5
.3-linux-x86-qt-
$(QT_VERSION
)
140 OSGEARTH_SDK_DIR
:= $(TOOLS_DIR
)/osgearth-2.7
-linux-x86-qt-
$(QT_VERSION
)
142 else ifeq ($(UNAME
), Darwin
)
143 OSG_SDK_DIR
:= $(TOOLS_DIR
)/osg-3.5
.3-clang_64-qt-
$(QT_VERSION
)
144 OSGEARTH_SDK_DIR
:= $(TOOLS_DIR
)/osgearth-2.7
-clang_64-qt-
$(QT_VERSION
)
145 else ifeq ($(UNAME
), Windows
)
146 ifeq ($(ARCH
), x86_64
)
147 MINGW_DIR
:= /mingw64
149 MINGW_DIR
:= /mingw32
151 # When changing PYTHON_DIR, you must also update it in ground/gcs/src/python.pri
152 PYTHON_DIR
:= $(MINGW_DIR
)/bin
153 OSG_SDK_DIR
:= $(MINGW_DIR
)
154 OSGEARTH_SDK_DIR
:= $(MINGW_DIR
)
155 NSIS_DIR
:= $(TOOLS_DIR
)/nsis-2.46
-unicode
156 MESAWIN_DIR
:= $(TOOLS_DIR
)/mesawin
159 ##############################
161 # Build only and all toolchains available for the platform
163 ##############################
165 BUILD_SDK_TARGETS
:= arm_sdk
166 ifeq ($(UNAME
), Windows
)
167 BUILD_SDK_TARGETS
+= nsis mesawin
169 ifeq ($(UNAME
), Darwin
)
170 BUILD_SDK_TARGETS
+= qt_sdk osg
172 ALL_SDK_TARGETS
:= $(BUILD_SDK_TARGETS
) gtest uncrustify doxygen
174 define GROUP_SDK_TEMPLATE
175 .PHONY
: $(1)_install
$(1)_clean
$(1)_distclean
$(1)_version
176 $(1)_install
: $(addsuffix _install
,$(2))
177 $(1)_clean
: $(addsuffix _clean
,$(2))
178 $(1)_distclean
: $(addsuffix _distclean
,$(2))
179 $(1)_version
: $(addsuffix _version
,$(2))
182 $(eval
$(call GROUP_SDK_TEMPLATE
,build_sdk
,$(BUILD_SDK_TARGETS
)))
183 $(eval
$(call GROUP_SDK_TEMPLATE
,all_sdk
,$(ALL_SDK_TARGETS
)))
185 ##############################
189 ##############################
191 # Used by other makefiles
192 export MKDIR
:= mkdir
200 # Used only by this Makefile
213 ifneq ($(UNAME
), Windows
)
217 ifneq ($(shell $(SEVENZIP
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
218 # no $(SEVENZIP) found in path. hope is in bin...
219 SEVENZIP
= $(TOOLS_DIR
)/bin
/7za.exe
222 ifneq ($(UNAME
), Windows
)
228 # Echo in recipes is a bit tricky in a Windows Git Bash window in some cases.
229 # It does not work if make started under msysGit installed into a path with spaces.
230 ifneq ($(UNAME
), Windows
)
233 # export ECHO := $(PYTHON) -c "import sys; print(' '.join(sys.argv[1:]))"
237 # Test if quotes are needed for the echo command
238 ifeq ($(shell $(ECHO
) "test"), test)
240 # This line is just to clear out the single quote above '
245 # Command to extract version info data from the repository and source tree
246 export VERSION_INFO
= $(PYTHON
) $(ROOT_DIR
)/make
/scripts
/version-info.py
--path
=$(ROOT_DIR
)
250 ##############################
254 ##############################
257 MSG_VERIFYING
= $(QUOTE
) VERIFY
$(QUOTE
)
258 MSG_DOWNLOADING
= $(QUOTE
) DOWNLOAD
$(QUOTE
)
259 MSG_CHECKSUMMING
= $(QUOTE
) MD5
$(QUOTE
)
260 MSG_EXTRACTING
= $(QUOTE
) EXTRACT
$(QUOTE
)
261 MSG_CONFIGURING
= $(QUOTE
) CONFIGURE
$(QUOTE
)
262 MSG_BUILDING
= $(QUOTE
) BUILD
$(QUOTE
)
263 MSG_INSTALLING
= $(QUOTE
) INSTALL
$(QUOTE
)
264 MSG_CLEANING
= $(QUOTE
) CLEAN
$(QUOTE
)
265 MSG_DISTCLEANING
= $(QUOTE
) DISTCLEAN
$(QUOTE
)
266 MSG_NOTICE
= $(QUOTE
) NOTE
$(QUOTE
)
273 MAKE_SILENT
:= --silent
279 CURL_OPTIONS
:= --silent
-L
284 # MSYS tar workaround
285 ifeq ($(UNAME
), Windows
)
286 TAR_OPTIONS
:= --force-local
291 # Print some useful notes for *_install targets
292 ifneq ($(strip $(filter $(addsuffix _install
,all_sdk
$(ALL_SDK_TARGETS
)),$(MAKECMDGOALS
))),)
293 ifneq ($(shell $(CURL
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
294 $(error Please
install curl first
('apt-get install curl' or similar
))
296 $(info $(EMPTY
) NOTE Use
'make all_sdk_distclean' to remove installation files
)
297 $(info $(EMPTY
) NOTE Use
'make all_sdk_version' to
check toolchain versions
)
298 $(info $(EMPTY
) NOTE Add
'V=1' to make command line to diagnose make problems
)
299 $(info $(EMPTY
) NOTE Add
'BATCH=1' to make command line to disable progress reporting during downloads
)
302 ##############################
304 # Cross-platform MD5 check template
305 # $(1) = file name without quotes
306 # $(2) = string compare operator, e.g. = or !=
308 ##############################
310 define MD5_CHECK_TEMPLATE
311 "`test -f \"$(1)\" && $(OPENSSL) dgst -md5 \"$(1)\" | $(CUT) -f2 -d' '`" $(2) "`$(GREP) $(notdir $(1)) $(1).md5 | $(CUT) -f1 -d' '`"
314 ##############################
316 # Cross-platform MD5 generation template
317 # $(1) = file name without quotes
319 ##############################
321 ifeq ($(UNAME
), Darwin
)
323 define MD5_GEN_TEMPLATE
324 md5
-r
$(1) > $(1).md5
329 define MD5_GEN_TEMPLATE
330 $(OPENSSL
) dgst
-r
-md5
$(1) > $(1).md5
335 ##############################
337 # Cross platform download template
339 # $(2) = Package file
340 # $(3) = URL for .md5 file to be tested against Package
342 ##############################
344 define DOWNLOAD_TEMPLATE
345 @
$(ECHO
) $(MSG_VERIFYING
) $$(call toprel
, $(DL_DIR
)/$(2))
348 $(CURL
) $(CURL_OPTIONS
) --silent
-o
"$(DL_DIR)/$(2).md5" "$(3)" && \
349 if
[ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),!=) ]; then \
350 $(ECHO
) $(MSG_DOWNLOADING
) $(1) && \
351 $(CURL
) $(CURL_OPTIONS
) -o
"$(DL_DIR)/$(2)" "$(1)" && \
352 $(ECHO
) $(MSG_CHECKSUMMING
) $$(call toprel
, $(DL_DIR
)/$(2)) && \
353 [ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),=) ]; \
358 ##############################
360 # Common tool install template
362 # $(2) = tool extract/build directory
363 # $(3) = tool distribution URL
364 # $(4) = tool distribution MD5 URL
365 # $(5) = tool distribution file
366 # $(6) = optional extra build recipes template
367 # $(7) = optional extra clean recipes template
369 ##############################
371 define TOOL_INSTALL_TEMPLATE
373 .PHONY
: $(addprefix $(1)_
, install clean distclean)
375 $(1)_install
: $(1)_clean |
$(DL_DIR
) $(TOOLS_DIR
)
377 $(if
$(4), $(call DOWNLOAD_TEMPLATE
,$(3),$(5),$(4)),$(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(3).md5"))
379 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(2))
380 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
382 $(if
$(filter $(suffix $(5)), .zip
),
383 $(V1
) $(UNZIP
) $(UNZIP_SILENT
) -d
$$(call toprel
, $(dir $(2))) $$(call toprel
, $(DL_DIR
)/$(5)),
384 $(V1
) $(TAR
) $(TAR_OPTIONS
) -C
$$(call toprel
, $(dir $(2))) -xf
$$(call toprel
, $(DL_DIR
)/$(5))
390 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(2))
391 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
396 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
397 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
398 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
402 ##############################
406 ##############################
407 export ARM_SDK_PREFIX
:= arm-none-eabi-
408 ARM_SDK_TOOL
:= gcc-arm-none-eabi
410 .PHONY
: arm_sdk_install
411 arm_sdk_install
: $(ARM_SDK_TOOL
)_install
413 .PHONY
: arm_sdk_clean
414 arm_sdk_clean
: $(ARM_SDK_TOOL
)_remove
416 .PHONY
: arm_sdk_version
418 -$(V1
) $(ARM_SDK_PREFIX
)gcc
--version | head
-n1
420 # Template to check ARM toolchain version before building targets
421 define ARM_GCC_VERSION_CHECK_TEMPLATE
422 if
! $(ARM_SDK_PREFIX
)gcc
--version
--specs
=nano.specs
>/dev
/null
2>&1; then \
423 $(ECHO
) $(MSG_NOTICE
) Please
install ARM toolchain
4.8 2014q1 using
\'make arm_sdk_install
\' && \
424 $(ECHO
) $(MSG_NOTICE
) Older ARM SDKs do not support new
\'--specs
=nano.specs
\' option
&& \
429 ##############################
431 # Qt install template
432 # $(1) = tool install directory
433 # $(2) = tool distribution URL
434 # $(3) = tool distribution .md5 URL
435 # $(4) = tool distribution file
436 # $(5) = Qt architecture
437 # $(6) = optional extra build recipes template
438 # $(7) = optional extra clean recipes template
440 ##############################
442 define QT_INSTALL_TEMPLATE
444 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
446 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
447 $(call DOWNLOAD_TEMPLATE
,$(2),$(4),"$(3)")
448 # Silently install Qt under tools directory
449 @
$(ECHO
) $(MSG_EXTRACTING
) $(4) to
$$(call toprel
, $(1))
450 $(V1
) ( export QT_INSTALL_TARGET_DIR
=$(1) && \
451 chmod
+x
$(DL_DIR
)/$(4) && \
452 $(DL_DIR
)/$(4) --script
$(ROOT_DIR
)/make
/tool_install
/qt-install.qs
; \
454 # Execute post build templates
458 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
459 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
463 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(4))
464 $(V1
) [ ! -f
"$(DL_DIR)/$(4)" ] ||
$(RM
) "$(DL_DIR)/$(4)"
465 $(V1
) [ ! -f
"$(DL_DIR)/$(4).md5" ] ||
$(RM
) "$(DL_DIR)/$(4).md5"
469 ##############################
471 # Mac QT install template
472 # $(1) = tool install directory
473 # $(2) = tool distribution URL
474 # $(3) = tool distribution .md5 URL
475 # $(4) = tool distribution file
476 # $(5) = QT architecture
477 # $(6) = optional extra build recipes template
478 # $(7) = optional extra clean recipes template
480 ##############################
482 define MAC_QT_INSTALL_TEMPLATE
484 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
486 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
487 $(call DOWNLOAD_TEMPLATE
,$(2),$(4),"$(3)")
489 $(V1
) hdiutil attach
-nobrowse
$(DL_DIR
)/$(4)
490 # Silently install Qt under tools directory
491 @
$(ECHO
) $(MSG_EXTRACTING
) $(4) to
$$(call toprel
, $(1))
492 $(V1
) ( export QT_INSTALL_TARGET_DIR
=$(1) && \
493 $(QT_SDK_MAINTENANCE_TOOL
) --script
$(ROOT_DIR
)/make
/tool_install
/qt-install.qs
; \
495 # Unmount the .dmg file
496 $(V1
) hdiutil detach
$(QT_SDK_MOUNT_DIR
)
497 # Execute post build templates
501 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
502 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
507 ##############################
511 ##############################
513 ifeq ($(UNAME
), Windows
)
515 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)/$(QT_SHORT_VERSION
)/$(QT_SDK_ARCH
)
516 $(eval
$(call QT_INSTALL_TEMPLATE
,$(QT_SDK_DIR
),$(QT_SDK_URL
),$(QT_SDK_MD5_URL
),$(notdir $(QT_SDK_URL
)),$(QT_SDK_ARCH
)))
518 else ifeq ($(UNAME
), Linux
)
520 QT_SDK_PREFIX
:= "$(QT_SDK_DIR)/$(QT_SHORT_VERSION)/$(QT_SDK_ARCH)"
521 $(eval
$(call QT_INSTALL_TEMPLATE
,$(QT_SDK_DIR
),$(QT_SDK_URL
),$(QT_SDK_MD5_URL
),$(notdir $(QT_SDK_URL
)),$(QT_SDK_ARCH
)))
523 else ifeq ($(UNAME
), Darwin
)
525 QT_SDK_PREFIX
:= "$(QT_SDK_DIR)/$(QT_SHORT_VERSION)/$(QT_SDK_ARCH)"
526 $(eval
$(call MAC_QT_INSTALL_TEMPLATE
,$(QT_SDK_DIR
),$(QT_SDK_URL
),$(QT_SDK_MD5_URL
),$(notdir $(QT_SDK_URL
)),$(QT_SDK_ARCH
)))
530 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)
532 .PHONY
: qt_sdk_install
534 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
535 @
$(ECHO
) $(MSG_NOTICE
) Please
install native Qt
5.6.x SDK using package manager
536 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
541 .PHONY
: qt_sdk_distclean
546 ifeq ($(shell [ -d
"$(QT_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
547 export QMAKE
:= $(QT_SDK_PREFIX
)/bin
/qmake
549 # set Qt library search path
550 ifeq ($(UNAME
), Windows
)
551 export PATH
:= $(QT_SDK_PREFIX
)/bin
:$(PATH
)
553 export LD_LIBRARY_PATH
:= $(QT_SDK_DIR
)/lib
:$(LD_LIBRARY_PATH
)
557 OPT_QT_ENV_SH
:= /opt
/$(OPT_QT
)/bin
/$(OPT_QT
)-env.sh
558 ifneq ($(wildcard $(OPT_QT_ENV_SH
)),)
560 QMAKE
:= .
$(OPT_QT_ENV_SH
) && qmake
562 # not installed, hope it's in the path...
567 .PHONY
: qt_sdk_version
569 -$(V1
) $(QMAKE
) --version | tail
-1
571 ##############################
575 ##############################
577 ifeq ($(UNAME
), Windows
)
579 ifeq ($(shell [ -d
"$(MINGW_DIR)" ] && $(ECHO
) "exists"), exists
)
580 # set MinGW binary and library paths (QTMINGW is used by qmake, do not rename)
581 export QTMINGW
:= $(MINGW_DIR
)/bin
582 export PATH
:= $(QTMINGW
):$(PATH
)
584 # not installed, use host gcc compiler
585 # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found, using system PATH)
588 .PHONY
: mingw_version
589 mingw_version
: gcc_version
595 -$(V1
) gcc
--version | head
-n1
597 all_sdk_version
: gcc_version
599 ##############################
603 ##############################
605 ifeq ($(shell [ -d
"$(PYTHON_DIR)" ] && $(ECHO
) "exists"), exists
)
606 export PYTHON
:= $(PYTHON_DIR
)/python
607 export PATH
:= $(PYTHON_DIR
):$(PATH
)
609 # not installed, hope it's in the path...
610 # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found, using system PATH)
611 ifeq ($(findstring Python
2,$(shell python
--version
2>&1)), Python
2)
612 export PYTHON
:= python
614 export PYTHON
:= python2
618 .PHONY
: python_version
620 -$(V1
) $(PYTHON
) --version
622 ##############################
624 # NSIS Unicode (Windows only)
626 ##############################
628 ifeq ($(UNAME
), Windows
)
630 $(eval
$(call TOOL_INSTALL_TEMPLATE
,nsis
,$(NSIS_DIR
),$(NSIS_URL
),,$(notdir $(NSIS_URL
))))
632 ifeq ($(shell [ -d
"$(NSIS_DIR)" ] && $(ECHO
) "exists"), exists
)
633 export NSIS
:= $(NSIS_DIR
)/makensis
635 # not installed, hope it's in the path...
636 # $(info $(EMPTY) WARNING $(call toprel, $(NSIS_DIR)) not found (make nsis_install), using system PATH)
637 export NSIS ?
= makensis
642 -$(V1
) $(NSIS
) | head
-n1
646 ##################################
648 # Mesa OpenGL DLL (Windows only)
650 ##################################
652 ifeq ($(UNAME
), Windows
)
654 $(eval
$(call TOOL_INSTALL_TEMPLATE
,mesawin
,$(MESAWIN_DIR
),$(MESAWIN_URL
),,$(notdir $(MESAWIN_URL
))))
656 ifeq ($(shell [ -d
"$(MESAWIN_DIR)" ] && $(ECHO
) "exists"), exists
)
657 export MESAWIN_DIR
:= $(MESAWIN_DIR
)
659 # not installed, hope it's in the path...
660 #$(info $(EMPTY) WARNING $(call toprel, $(MESA_WIN_DIR)) not found (make mesawin_install), using system PATH)
663 .PHONY
: mesawin_version
665 -$(V1
) $(ECHO
) "MesaOpenGL vXX"
669 ##############################
673 ##############################
675 ifeq ($(UNAME
), Windows
)
677 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
))))
681 UNCRUSTIFY_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(UNCRUSTIFY_DIR
))
683 define UNCRUSTIFY_BUILD_TEMPLATE
685 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
686 cd
$(UNCRUSTIFY_BUILD_DIR
) && \
687 .
/configure
--prefix="$(UNCRUSTIFY_DIR)" && \
688 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
689 $(MAKE
) $(MAKE_SILENT
) && \
690 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(UNCRUSTIFY_DIR
)) && \
691 $(MAKE
) $(MAKE_SILENT
) install-strip \
693 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
))
694 -$(V1
) [ ! -d
"$(UNCRUSTIFY_BUILD_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_BUILD_DIR)"
697 define UNCRUSTIFY_CLEAN_TEMPLATE
698 -$(V1
) [ ! -d
"$(UNCRUSTIFY_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_DIR)"
701 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_BUILD_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
)),$(UNCRUSTIFY_BUILD_TEMPLATE
),$(UNCRUSTIFY_CLEAN_TEMPLATE
)))
705 ifeq ($(shell [ -d
"$(UNCRUSTIFY_DIR)" ] && $(ECHO
) "exists"), exists
)
706 export UNCRUSTIFY
:= $(UNCRUSTIFY_DIR
)/bin
/uncrustify
708 # not installed, hope it's in the path...
709 # $(info $(EMPTY) WARNING $(call toprel, $(UNCRUSTIFY_DIR)) not found (make uncrustify_install), using system PATH)
710 export UNCRUSTIFY
:= uncrustify
713 .PHONY
: uncrustify_version
715 -$(V1
) $(UNCRUSTIFY
) --version
717 ##############################
721 ##############################
723 ifeq ($(UNAME
), Windows
)
725 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
))))
729 DOXYGEN_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(DOXYGEN_DIR
))
731 define DOXYGEN_BUILD_TEMPLATE
733 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
734 cd
$(DOXYGEN_BUILD_DIR
) && \
735 .
/configure
--prefix "$(DOXYGEN_DIR)" --english-only
&& \
736 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
737 $(MAKE
) $(MAKE_SILENT
) && \
738 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(DOXYGEN_DIR
)) && \
739 $(MAKE
) $(MAKE_SILENT
) install \
741 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
))
742 -$(V1
) [ ! -d
"$(DOXYGEN_BUILD_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_BUILD_DIR)"
745 define DOXYGEN_CLEAN_TEMPLATE
746 -$(V1
) [ ! -d
"$(DOXYGEN_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_DIR)"
749 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_BUILD_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
)),$(DOXYGEN_BUILD_TEMPLATE
),$(DOXYGEN_CLEAN_TEMPLATE
)))
753 ifeq ($(shell [ -d
"$(DOXYGEN_DIR)" ] && $(ECHO
) "exists"), exists
)
754 export DOXYGEN
:= $(DOXYGEN_DIR
)/bin
/doxygen
756 # not installed, hope it's in the path...
757 # $(info $(EMPTY) WARNING $(call toprel, $(DOXYGEN_DIR)) not found (make doxygen_install), using system PATH)
758 export DOXYGEN
:= doxygen
761 .PHONY
: doxygen_version
763 -$(V1
) $(ECHO
) "Doxygen `$(DOXYGEN) --version`"
765 ##############################
769 ##############################
771 $(eval
$(call TOOL_INSTALL_TEMPLATE
,gtest
,$(GTEST_DIR
),$(GTEST_URL
),,$(notdir $(GTEST_URL
))))
775 .PHONY
: gtest_version
777 -$(V1
) $(SED
) -n
"s/^PACKAGE_STRING='\(.*\)'/\1/p" < $(GTEST_DIR
)/configure
779 ##############################
783 ##############################
785 CCACHE_BUILD_DIR
:= $(BUILD_DIR
)/ccache-3.2
.2
787 define CCACHE_BUILD_TEMPLATE
789 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(CCACHE_BUILD_DIR
)) && \
790 cd
$(CCACHE_BUILD_DIR
) && \
791 .
/configure
--prefix="$(CCACHE_DIR)" && \
792 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(CCACHE_BUILD_DIR
)) && \
793 $(MAKE
) $(MAKE_SILENT
) && \
794 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(CCACHE_DIR
)) && \
795 $(MAKE
) $(MAKE_SILENT
) install \
797 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(CCACHE_BUILD_DIR
))
798 -$(V1
) [ ! -d
"$(CCACHE_BUILD_DIR)" ] ||
$(RM
) -rf
"$(CCACHE_BUILD_DIR)"
801 @
$(ECHO
) "Setting up CCACHE configuration:"
803 $(V1
) [ -d
"$(ROOT_DIR)/.ccache" ] || mkdir
$(ROOT_DIR
)/.ccache
804 $(V1
) [ -d
"$(CCACHE_DIR)/etc" ] || mkdir
$(CCACHE_DIR
)/etc
806 $(V1
) $(ECHO
) $(QUOTE
)cache_dir
= $(ROOT_DIR
)/.ccache
$(QUOTE
) > $(CCACHE_DIR
)/etc
/ccache.conf
807 $(V1
) $(ECHO
) $(QUOTE
)max_size
= 250M
$(QUOTE
) >> $(CCACHE_DIR
)/etc
/ccache.conf
808 $(V1
) $(CAT
) $(CCACHE_DIR
)/etc
/ccache.conf
811 define CCACHE_CLEAN_TEMPLATE
812 -$(V1
) [ ! -d
"$(CCACHE_DIR)" ] ||
$(RM
) -rf
"$(CCACHE_DIR)"
815 $(eval
$(call TOOL_INSTALL_TEMPLATE
,ccache
,$(CCACHE_BUILD_DIR
),$(CCACHE_URL
),$(CCACHE_MD5_URL
),$(notdir $(CCACHE_URL
)),$(CCACHE_BUILD_TEMPLATE
),$(CCACHE_CLEAN_TEMPLATE
)))
817 ##############################
821 ##############################
823 ifneq ($(UNAME
), Windows
)
825 $(eval
$(call TOOL_INSTALL_TEMPLATE
,osg
,$(OSG_SDK_DIR
),$(OSG_URL
),,$(notdir $(OSG_URL
))))
829 ifeq ($(shell [ -d
"$(OSG_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
830 export OSG_SDK_DIR
:= $(OSG_SDK_DIR
)
832 # not installed, hope it's in the path...
833 # $(info $(EMPTY) WARNING $(call toprel, $(OSG_SDK_DIR)) not found (make osg_install), using system PATH)
838 -$(V1
) $(ECHO
) "`$(OSG_SDK_DIR)/bin/osgversion`"
840 ##############################
844 ##############################
846 ifneq ($(UNAME
), Windows
)
848 $(eval
$(call TOOL_INSTALL_TEMPLATE
,osgearth
,$(OSGEARTH_SDK_DIR
),$(OSGEARTH_URL
),,$(notdir $(OSGEARTH_URL
))))
852 ifeq ($(shell [ -d
"$(OSGEARTH_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
853 export OSGEARTH_SDK_DIR
:= $(OSGEARTH_SDK_DIR
)
855 # not installed, hope it's in the path...
856 # $(info $(EMPTY) WARNING $(call toprel, $(OSGEARTH_SDK_DIR)) not found (make osgearth_install), using system PATH)
859 .PHONY
: osgearth_version
861 -$(V1
) $(ECHO
) "`$(OSGEARTH_SDK_DIR)/bin/osgearth_version`"
863 ##############################
865 # TODO: code below is not revised yet
867 ##############################
869 # Set up openocd tools
870 OPENOCD_DIR
:= $(TOOLS_DIR
)/openocd
871 OPENOCD_WIN_DIR
:= $(TOOLS_DIR
)/openocd_win
872 OPENOCD_BUILD_DIR
:= $(DL_DIR
)/openocd-build
874 .PHONY
: openocd_install
875 openocd_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
876 openocd_install
: OPENOCD_URL
:= http
://sourceforge.net
/projects
/openocd
/files
/openocd
/0.6.1/openocd-0.6
.1.
tar.bz2
/download
877 openocd_install
: OPENOCD_FILE
:= openocd-0.6
.1.
tar.bz2
878 openocd_install
: openocd_clean
879 # download the source only if it's newer than what we already have
880 $(V1
) $(WGET
) -N
-P
"$(DL_DIR)" --trust-server-name
"$(OPENOCD_URL)"
883 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_BUILD_DIR)"
884 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
885 $(V1
) tar -C
$(OPENOCD_BUILD_DIR
) -xjf
"$(DL_DIR)/$(OPENOCD_FILE)"
888 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
890 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
891 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
892 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
896 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
898 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
899 .
/configure
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-stlink
; \
901 $(MAKE
) --silent
install ; \
904 # delete the extracted source when we're done
905 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
907 .PHONY
: ftd2xx_install
909 FTD2XX_DIR
:= $(DL_DIR
)/ftd2xx
911 ftd2xx_install
: |
$(DL_DIR
)
912 ftd2xx_install
: FTD2XX_URL
:= http
://www.ftdichip.com
/Drivers
/CDM
/Beta
/CDM20817.zip
913 ftd2xx_install
: FTD2XX_FILE
:= CDM20817.zip
914 ftd2xx_install
: ftd2xx_clean
915 # download the file only if it's newer than what we already have
916 $(V0
) @echo
" DOWNLOAD $(FTD2XX_URL)"
917 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" "$(FTD2XX_URL)"
920 $(V0
) @echo
" EXTRACT $(FTD2XX_FILE) -> $(FTD2XX_DIR)"
921 $(V1
) mkdir
-p
"$(FTD2XX_DIR)"
922 $(V1
) unzip
-q
-d
"$(FTD2XX_DIR)" "$(DL_DIR)/$(FTD2XX_FILE)"
926 $(V0
) @echo
" CLEAN $(FTD2XX_DIR)"
927 $(V1
) [ ! -d
"$(FTD2XX_DIR)" ] ||
$(RM
) -r
"$(FTD2XX_DIR)"
929 .PHONY
: ftd2xx_install
931 LIBUSB_WIN_DIR
:= $(DL_DIR
)/libusb-win32-bin-1.2
.6.0
933 libusb_win_install
: |
$(DL_DIR
)
934 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
935 libusb_win_install
: LIBUSB_WIN_FILE
:= libusb-win32-bin-1.2
.6.0.zip
936 libusb_win_install
: libusb_win_clean
937 # download the file only if it's newer than what we already have
938 $(V0
) @echo
" DOWNLOAD $(LIBUSB_WIN_URL)"
939 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" --trust-server-name
"$(LIBUSB_WIN_URL)"
942 $(V0
) @echo
" EXTRACT $(LIBUSB_WIN_FILE) -> $(LIBUSB_WIN_DIR)"
943 $(V1
) mkdir
-p
"$(LIBUSB_WIN_DIR)"
944 $(V1
) unzip
-q
-d
"$(DL_DIR)" "$(DL_DIR)/$(LIBUSB_WIN_FILE)"
946 # fixup .h file needed by openocd build
947 $(V0
) @echo
" FIXUP $(LIBUSB_WIN_DIR)"
948 $(V1
) ln
-s
"$(LIBUSB_WIN_DIR)/include/lusb0_usb.h" "$(LIBUSB_WIN_DIR)/include/usb.h"
950 .PHONY
: libusb_win_clean
952 $(V0
) @echo
" CLEAN $(LIBUSB_WIN_DIR)"
953 $(V1
) [ ! -d
"$(LIBUSB_WIN_DIR)" ] ||
$(RM
) -r
"$(LIBUSB_WIN_DIR)"
955 .PHONY
: openocd_git_win_install
957 openocd_git_win_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
958 openocd_git_win_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
959 openocd_git_win_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
960 openocd_git_win_install
: openocd_win_clean libusb_win_install ftd2xx_install
961 # download the source
962 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
963 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
964 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
965 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(DL_DIR)/openocd-build"
967 cd
$(OPENOCD_BUILD_DIR
) ; \
968 git checkout
-q
$(OPENOCD_REV
) ; \
972 $(V0
) @echo
" PATCH $(OPENOCD_BUILD_DIR)"
974 cd
$(OPENOCD_BUILD_DIR
) ; \
975 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
976 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
980 $(V0
) @echo
" BUILD $(OPENOCD_WIN_DIR)"
981 $(V1
) mkdir
-p
"$(OPENOCD_WIN_DIR)"
983 cd
$(OPENOCD_BUILD_DIR
) ; \
985 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_WIN_DIR)" \
986 --build
=i686-pc-linux-gnu
--host
=i586-mingw32msvc \
987 CPPFLAGS
=-I
$(LIBUSB_WIN_DIR
)/include \
988 LDFLAGS
=-L
$(LIBUSB_WIN_DIR
)/lib
/gcc \
989 --enable-ft2232_ftd2xx
--with-ftd2xx-win32-zipdir
=$(FTD2XX_DIR
) \
996 # delete the extracted source when we're done
997 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
999 .PHONY
: openocd_win_clean
1001 $(V0
) @echo
" CLEAN $(OPENOCD_WIN_DIR)"
1002 $(V1
) [ ! -d
"$(OPENOCD_WIN_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_WIN_DIR)"
1004 .PHONY
: openocd_git_install
1006 openocd_git_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1007 openocd_git_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
1008 openocd_git_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
1009 openocd_git_install
: openocd_clean
1010 # download the source
1011 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
1012 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1013 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
1014 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(OPENOCD_BUILD_DIR)"
1016 cd
$(OPENOCD_BUILD_DIR
) ; \
1017 git checkout
-q
$(OPENOCD_REV
) ; \
1021 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
1023 cd
$(OPENOCD_BUILD_DIR
) ; \
1024 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
1025 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
1029 $(V0
) @echo
" BUILD $(OPENOCD_DIR)"
1030 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
1032 cd
$(OPENOCD_BUILD_DIR
) ; \
1034 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-buspirate
--enable-stlink
; \
1039 # delete the extracted source when we're done
1040 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1042 .PHONY
: openocd_clean
1044 $(V0
) @echo
" CLEAN $(OPENOCD_DIR)"
1045 $(V1
) [ ! -d
"$(OPENOCD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_DIR)"
1047 STM32FLASH_DIR
:= $(TOOLS_DIR
)/stm32flash
1048 ifeq ($(UNAME
), Windows
)
1049 STM32FLASH_BUILD_OPTIONS
:= "CC=GCC"
1051 .PHONY
: stm32flash_install
1052 stm32flash_install
: STM32FLASH_URL
:= https
://code.google.com
/p
/stm32flash
/
1053 stm32flash_install
: STM32FLASH_REV
:= a358bd1f025d
1054 stm32flash_install
: stm32flash_clean
1055 # download the source
1056 $(V0
) @
$(ECHO
) " DOWNLOAD $(STM32FLASH_URL) @ r$(STM32FLASH_REV)"
1057 $(V1
) [ ! -d
"$(STM32FLASH_DIR)" ] ||
$(RM
) -rf
"$(STM32FLASH_DIR)"
1058 $(V1
) $(MKDIR
) -p
"$(STM32FLASH_DIR)"
1059 $(V1
) $(GIT
) clone
--no-checkout
$(STM32FLASH_URL
) "$(STM32FLASH_DIR)"
1061 $(CD
) $(STM32FLASH_DIR
) ; \
1062 $(GIT
) checkout
-q
$(STM32FLASH_REV
) ; \
1065 $(V0
) @
$(ECHO
) " BUILD $(STM32FLASH_DIR)"
1066 $(V1
) $(MAKE
) --silent
-C
$(STM32FLASH_DIR
) all $(STM32FLASH_BUILD_OPTIONS
)
1068 .PHONY
: stm32flash_clean
1070 $(V0
) @
$(ECHO
) " CLEAN $(STM32FLASH_DIR)"
1071 $(V1
) [ ! -d
"$(STM32FLASH_DIR)" ] ||
$(RM
) -rf
"$(STM32FLASH_DIR)"
1073 DFUUTIL_DIR
:= $(TOOLS_DIR
)/dfu-util
1075 .PHONY
: dfuutil_install
1076 dfuutil_install
: DFUUTIL_URL
:= http
://dfu-util.sourceforge.net
/releases
/dfu-util-0.8.
tar.gz
1077 dfuutil_install
: DFUUTIL_FILE
:= $(notdir $(DFUUTIL_URL
))
1078 dfuutil_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1079 dfuutil_install
: dfuutil_clean
1080 # download the source
1081 $(V0
) @echo
" DOWNLOAD $(DFUUTIL_URL)"
1082 $(V1
) $(CURL
) $(CURL_OPTIONS
) -o
"$(DL_DIR)/$(DFUUTIL_FILE)" "$(DFUUTIL_URL)"
1084 # extract the source
1085 $(V0
) @echo
" EXTRACT $(DFUUTIL_FILE)"
1086 $(V1
) [ ! -d
"$(DL_DIR)/dfuutil-build" ] ||
$(RM
) -r
"$(DL_DIR)/dfuutil-build"
1087 $(V1
) mkdir
-p
"$(DL_DIR)/dfuutil-build"
1088 $(V1
) tar -C
$(DL_DIR
)/dfuutil-build
-xf
"$(DL_DIR)/$(DFUUTIL_FILE)"
1091 $(V0
) @echo
" BUILD $(DFUUTIL_DIR)"
1092 $(V1
) mkdir
-p
"$(DFUUTIL_DIR)"
1094 cd
$(DL_DIR
)/dfuutil-build
/dfu-util-0.8
; \
1095 .
/configure
--prefix="$(DFUUTIL_DIR)" ; \
1100 .PHONY
: dfuutil_clean
1102 $(V0
) @echo
" CLEAN $(DFUUTIL_DIR)"
1103 $(V1
) [ ! -d
"$(DFUUTIL_DIR)" ] ||
$(RM
) -r
"$(DFUUTIL_DIR)"
1105 # see http://developer.android.com/sdk/ for latest versions
1106 ANDROID_SDK_DIR
:= $(TOOLS_DIR
)/android-sdk-linux
1107 .PHONY
: android_sdk_install
1108 android_sdk_install
: ANDROID_SDK_URL
:= http
://dl.google.com
/android
/android-sdk_r20.0
.3-linux.tgz
1109 android_sdk_install
: ANDROID_SDK_FILE
:= $(notdir $(ANDROID_SDK_URL
))
1110 # order-only prereq on directory existance:
1111 android_sdk_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1112 android_sdk_install
: android_sdk_clean
1113 # download the source only if it's newer than what we already have
1114 $(V0
) @echo
" DOWNLOAD $(ANDROID_SDK_URL)"
1115 $(V1
) $(WGET
) --no-check-certificate
-N
-P
"$(DL_DIR)" "$(ANDROID_SDK_URL)"
1117 # binary only release so just extract it
1118 $(V0
) @echo
" EXTRACT $(ANDROID_SDK_FILE)"
1119 $(V1
) tar -C
$(TOOLS_DIR
) -xf
"$(DL_DIR)/$(ANDROID_SDK_FILE)"
1121 .PHONY
: android_sdk_clean
1123 $(V0
) @echo
" CLEAN $(ANDROID_SDK_DIR)"
1124 $(V1
) [ ! -d
"$(ANDROID_SDK_DIR)" ] ||
$(RM
) -r
$(ANDROID_SDK_DIR
)
1126 .PHONY
: android_sdk_update
1128 $(V0
) @echo
" UPDATE $(ANDROID_SDK_DIR)"
1129 $(ANDROID_SDK_DIR
)/tools
/android update sdk
--no-ui
-t platform-tools
,android-16
,addon-google_apis-google-16
1131 #Install git hooks under the right folder
1135 $(V0
) @echo
" Configuring GIT commit template"
1136 $(V1
) $(CD
) "$(ROOT_DIR)"
1137 $(V1
) $(GIT
) config commit.template .commit-template
1139 .PHONY
: prepare_clean
1141 $(V0
) @echo
" Cleanup GIT commit template configuration"
1142 $(V1
) $(CD
) "$(ROOT_DIR)"
1143 $(V1
) $(GIT
) config
--unset commit.template
1145 ##############################
1147 # TODO: these defines will go to tool install sections
1149 ##############################
1151 ifeq ($(shell [ -d
"$(OPENOCD_DIR)" ] && $(ECHO
) "exists"), exists
)
1152 export OPENOCD
:= $(OPENOCD_DIR
)/bin
/openocd
1154 # not installed, hope it's in the path...
1155 export OPENOCD ?
= openocd
1158 ifeq ($(shell [ -d
"$(ANDROID_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
1159 ANDROID
:= $(ANDROID_SDK_DIR
)/tools
/android
1160 ANDROID_DX
:= $(ANDROID_SDK_DIR
)/platform-tools
/dx
1162 # not installed, hope it's in the path...