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 # versions given below are defaults
90 # and are used only to install the tools on some OSes
91 # don't assume actual versions to match
93 QT_SHORT_VERSION
:= 5.9
97 OSGEARTH_VERSION
:= 2.8
99 ifeq ($(UNAME
), Linux
)
100 ifeq ($(ARCH
), x86_64
)
101 QT_SDK_ARCH
:= gcc_64
102 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/qt-opensource-linux-x64-
$(QT_VERSION
).run
103 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/md5sums.txt
104 OSG_URL
:= $(TOOLS_URL
)/osg-
$(OSG_VERSION
)-linux-x64.
tar.gz
105 OSGEARTH_URL
:= $(TOOLS_URL
)/osgearth-
$(OSGEARTH_VERSION
)-linux-x64.
tar.gz
107 # x32 for linux no longer provided as pre-built binaries.
109 UNCRUSTIFY_URL
:= $(TOOLS_URL
)/uncrustify-0.60.
tar.gz
110 DOXYGEN_URL
:= $(TOOLS_URL
)/doxygen-1.8
.3.1.src.
tar.gz
111 else ifeq ($(UNAME
), Darwin
)
112 QT_SDK_ARCH
:= clang_64
113 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/qt-opensource-mac-x64-
$(QT_VERSION
).dmg
114 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/md5sums.txt
115 QT_SDK_MOUNT_DIR
:= /Volumes
/qt-opensource-mac-x64-
$(QT_VERSION
)
116 QT_SDK_MAINTENANCE_TOOL
:= /Volumes
/qt-opensource-mac-x64-
$(QT_VERSION
)/qt-opensource-mac-x64-
$(QT_VERSION
).app
/Contents
/MacOS
/qt-opensource-mac-x64-
$(QT_VERSION
)
117 UNCRUSTIFY_URL
:= $(TOOLS_URL
)/uncrustify-0.60.
tar.gz
118 DOXYGEN_URL
:= $(TOOLS_URL
)/doxygen-1.8
.3.1.src.
tar.gz
119 OSG_URL
:= $(TOOLS_URL
)/osg-
$(OSG_VERSION
)-clang_64.
tar.gz
120 OSGEARTH_URL
:= $(TOOLS_URL
)/osgearth-
$(OSGEARTH_VERSION
)-clang_64.
tar.gz
121 else ifeq ($(UNAME
), Windows
)
122 QT_SDK_ARCH
:= mingw53_32
123 QT_SDK_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/qt-opensource-windows-x86-mingw530-
$(QT_VERSION
).exe
124 QT_SDK_MD5_URL
:= http
://download.qt.io
/official_releases
/qt
/$(QT_SHORT_VERSION
)/$(QT_VERSION
)/md5sums.txt
125 NSIS_URL
:= $(TOOLS_URL
)/nsis-2.46
-unicode.
tar.bz2
126 MESAWIN_URL
:= $(TOOLS_URL
)/mesawin.
tar.gz
127 UNCRUSTIFY_URL
:= $(TOOLS_URL
)/uncrustify-0.60
-windows.
tar.bz2
128 DOXYGEN_URL
:= $(TOOLS_URL
)/doxygen-1.8
.3.1-windows.
tar.bz2
131 GTEST_URL
:= $(TOOLS_URL
)/gtest-1.7
.0.zip
132 CCACHE_URL
:= http
://samba.org
/ftp
/ccache
/ccache-3.2
.2.
tar.bz2
133 CCACHE_MD5_URL
:= $(TOOLS_URL
)/ccache-3.2
.2.
tar.bz2.md5
135 QT_SDK_DIR
:= $(TOOLS_DIR
)/qt-
$(QT_VERSION
)
136 UNCRUSTIFY_DIR
:= $(TOOLS_DIR
)/uncrustify-0.60
137 DOXYGEN_DIR
:= $(TOOLS_DIR
)/doxygen-1.8
.3.1
138 GTEST_DIR
:= $(TOOLS_DIR
)/gtest-1.7
.0
139 CCACHE_DIR
:= $(TOOLS_DIR
)/ccache
141 ifeq ($(UNAME
), Linux
)
142 ifeq ($(ARCH
), x86_64
)
143 OSG_SDK_DIR
:= $(TOOLS_DIR
)/osg-
$(OSG_VERSION
)-linux-x64
144 OSGEARTH_SDK_DIR
:= $(TOOLS_DIR
)/osgearth-
$(OSGEARTH_VERSION
)-linux-x64
146 OSG_SDK_DIR
:= $(TOOLS_DIR
)/osg-
$(OSG_VERSION
)-linux-x86
147 OSGEARTH_SDK_DIR
:= $(TOOLS_DIR
)/osgearth-
$(OSGEARTH_VERSION
)-linux-x86
149 else ifeq ($(UNAME
), Darwin
)
150 OSG_SDK_DIR
:= $(TOOLS_DIR
)/osg-
$(OSG_VERSION
)-clang_64
151 OSGEARTH_SDK_DIR
:= $(TOOLS_DIR
)/osgearth-
$(OSGEARTH_VERSION
)-clang_64
152 else ifeq ($(UNAME
), Windows
)
153 ifeq ($(ARCH
), x86_64
)
154 MINGW_DIR
:= /mingw64
156 MINGW_DIR
:= /mingw32
158 # When changing PYTHON_DIR, you must also update it in ground/gcs/src/python.pri
159 PYTHON_DIR
:= $(MINGW_DIR
)/bin
160 OSG_SDK_DIR
:= $(MINGW_DIR
)
161 OSGEARTH_SDK_DIR
:= $(MINGW_DIR
)
162 NSIS_DIR
:= $(TOOLS_DIR
)/nsis-2.46
-unicode
163 MESAWIN_DIR
:= $(TOOLS_DIR
)/mesawin
166 ##############################
168 # Build only and all toolchains available for the platform
170 ##############################
172 BUILD_SDK_TARGETS
:= arm_sdk
173 ifeq ($(UNAME
), Windows
)
174 BUILD_SDK_TARGETS
+= nsis mesawin
176 ifeq ($(UNAME
), Darwin
)
177 BUILD_SDK_TARGETS
+= qt_sdk osg
179 ALL_SDK_TARGETS
:= $(BUILD_SDK_TARGETS
) gtest uncrustify doxygen
181 define GROUP_SDK_TEMPLATE
182 .PHONY
: $(1)_install
$(1)_clean
$(1)_distclean
$(1)_version
183 $(1)_install
: $(addsuffix _install
,$(2))
184 $(1)_clean
: $(addsuffix _clean
,$(2))
185 $(1)_distclean
: $(addsuffix _distclean
,$(2))
186 $(1)_version
: $(addsuffix _version
,$(2))
189 $(eval
$(call GROUP_SDK_TEMPLATE
,build_sdk
,$(BUILD_SDK_TARGETS
)))
190 $(eval
$(call GROUP_SDK_TEMPLATE
,all_sdk
,$(ALL_SDK_TARGETS
)))
192 ##############################
196 ##############################
198 # Used by other makefiles
199 export MKDIR
:= mkdir
207 # Used only by this Makefile
220 ifneq ($(UNAME
), Windows
)
224 ifneq ($(shell $(SEVENZIP
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
225 # no $(SEVENZIP) found in path. hope is in bin...
226 SEVENZIP
= $(TOOLS_DIR
)/bin
/7za.exe
229 ifneq ($(UNAME
), Windows
)
235 # Echo in recipes is a bit tricky in a Windows Git Bash window in some cases.
236 # It does not work if make started under msysGit installed into a path with spaces.
237 ifneq ($(UNAME
), Windows
)
240 # export ECHO := $(PYTHON) -c "import sys; print(' '.join(sys.argv[1:]))"
244 # Test if quotes are needed for the echo command
245 ifeq ($(shell $(ECHO
) "test"), test)
247 # This line is just to clear out the single quote above '
252 # Command to extract version info data from the repository and source tree
253 export VERSION_INFO
= $(PYTHON
) $(ROOT_DIR
)/make
/scripts
/version-info.py
--path
=$(ROOT_DIR
)
257 ##############################
261 ##############################
264 MSG_VERIFYING
= $(QUOTE
) VERIFY
$(QUOTE
)
265 MSG_DOWNLOADING
= $(QUOTE
) DOWNLOAD
$(QUOTE
)
266 MSG_CHECKSUMMING
= $(QUOTE
) MD5
$(QUOTE
)
267 MSG_EXTRACTING
= $(QUOTE
) EXTRACT
$(QUOTE
)
268 MSG_CONFIGURING
= $(QUOTE
) CONFIGURE
$(QUOTE
)
269 MSG_BUILDING
= $(QUOTE
) BUILD
$(QUOTE
)
270 MSG_INSTALLING
= $(QUOTE
) INSTALL
$(QUOTE
)
271 MSG_CLEANING
= $(QUOTE
) CLEAN
$(QUOTE
)
272 MSG_DISTCLEANING
= $(QUOTE
) DISTCLEAN
$(QUOTE
)
273 MSG_NOTICE
= $(QUOTE
) NOTE
$(QUOTE
)
280 MAKE_SILENT
:= --silent
286 CURL_OPTIONS
:= --silent
-L
291 # MSYS tar workaround
292 ifeq ($(UNAME
), Windows
)
293 TAR_OPTIONS
:= --force-local
298 # Print some useful notes for *_install targets
299 ifneq ($(strip $(filter $(addsuffix _install
,all_sdk
$(ALL_SDK_TARGETS
)),$(MAKECMDGOALS
))),)
300 ifneq ($(shell $(CURL
) --version
>/dev
/null
2>&1 && $(ECHO
) "found"), found
)
301 $(error Please
install curl first
('apt-get install curl' or similar
))
303 $(info $(EMPTY
) NOTE Use
'make all_sdk_distclean' to remove installation files
)
304 $(info $(EMPTY
) NOTE Use
'make all_sdk_version' to
check toolchain versions
)
305 $(info $(EMPTY
) NOTE Add
'V=1' to make command line to diagnose make problems
)
306 $(info $(EMPTY
) NOTE Add
'BATCH=1' to make command line to disable progress reporting during downloads
)
309 ##############################
311 # Cross-platform MD5 check template
312 # $(1) = file name without quotes
313 # $(2) = string compare operator, e.g. = or !=
315 ##############################
317 define MD5_CHECK_TEMPLATE
318 "`test -f \"$(1)\" && $(OPENSSL) dgst -md5 \"$(1)\" | $(CUT) -f2 -d' '`" $(2) "`$(GREP) $(notdir $(1)) $(1).md5 | $(CUT) -f1 -d' '`"
321 ##############################
323 # Cross-platform MD5 generation template
324 # $(1) = file name without quotes
326 ##############################
328 ifeq ($(UNAME
), Darwin
)
330 define MD5_GEN_TEMPLATE
331 md5
-r
$(1) > $(1).md5
336 define MD5_GEN_TEMPLATE
337 $(OPENSSL
) dgst
-r
-md5
$(1) > $(1).md5
342 ##############################
344 # Cross platform download template
346 # $(2) = Package file
347 # $(3) = URL for .md5 file to be tested against Package
349 ##############################
351 define DOWNLOAD_TEMPLATE
352 @
$(ECHO
) $(MSG_VERIFYING
) $$(call toprel
, $(DL_DIR
)/$(2))
355 $(CURL
) $(CURL_OPTIONS
) --silent
-o
"$(DL_DIR)/$(2).md5" "$(3)" && \
356 if
[ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),!=) ]; then \
357 $(ECHO
) $(MSG_DOWNLOADING
) $(1) && \
358 $(CURL
) $(CURL_OPTIONS
) -o
"$(DL_DIR)/$(2)" "$(1)" && \
359 $(ECHO
) $(MSG_CHECKSUMMING
) $$(call toprel
, $(DL_DIR
)/$(2)) && \
360 [ $(call MD5_CHECK_TEMPLATE
,$(DL_DIR
)/$(2),=) ]; \
365 ##############################
367 # Common tool install template
369 # $(2) = tool extract/build directory
370 # $(3) = tool distribution URL
371 # $(4) = tool distribution MD5 URL
372 # $(5) = tool distribution file
373 # $(6) = optional extra build recipes template
374 # $(7) = optional extra clean recipes template
376 ##############################
378 define TOOL_INSTALL_TEMPLATE
380 .PHONY
: $(addprefix $(1)_
, install clean distclean)
382 $(1)_install
: $(1)_clean |
$(DL_DIR
) $(TOOLS_DIR
)
384 $(if
$(4), $(call DOWNLOAD_TEMPLATE
,$(3),$(5),$(4)),$(call DOWNLOAD_TEMPLATE
,$(3),$(5),"$(3).md5"))
386 @
$(ECHO
) $(MSG_EXTRACTING
) $$(call toprel
, $(2))
387 $(V1
) $(MKDIR
) -p
$$(call toprel
, $(dir $(2)))
389 $(if
$(filter $(suffix $(5)), .zip
),
390 $(V1
) $(UNZIP
) $(UNZIP_SILENT
) -d
$$(call toprel
, $(dir $(2))) $$(call toprel
, $(DL_DIR
)/$(5)),
391 $(V1
) $(TAR
) $(TAR_OPTIONS
) -C
$$(call toprel
, $(dir $(2))) -xf
$$(call toprel
, $(DL_DIR
)/$(5))
397 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(2))
398 $(V1
) [ ! -d
"$(2)" ] ||
$(RM
) -rf
"$(2)"
403 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(5))
404 $(V1
) [ ! -f
"$(DL_DIR)/$(5)" ] ||
$(RM
) "$(DL_DIR)/$(5)"
405 $(V1
) [ ! -f
"$(DL_DIR)/$(5).md5" ] ||
$(RM
) "$(DL_DIR)/$(5).md5"
409 ##############################
413 ##############################
414 export ARM_SDK_PREFIX
:= arm-none-eabi-
415 ARM_SDK_TOOL
:= gcc-arm-none-eabi
417 .PHONY
: arm_sdk_install
418 arm_sdk_install
: $(ARM_SDK_TOOL
)_install
420 .PHONY
: arm_sdk_clean
421 arm_sdk_clean
: $(ARM_SDK_TOOL
)_remove
423 .PHONY
: arm_sdk_version
425 -$(V1
) $(ARM_SDK_PREFIX
)gcc
--version | head
-n1
427 # Template to check ARM toolchain version before building targets
428 define ARM_GCC_VERSION_CHECK_TEMPLATE
429 if
! $(ARM_SDK_PREFIX
)gcc
--version
--specs
=nano.specs
>/dev
/null
2>&1; then \
430 $(ECHO
) $(MSG_NOTICE
) Please
install ARM toolchain
4.8 2014q1 using
\'make arm_sdk_install
\' && \
431 $(ECHO
) $(MSG_NOTICE
) Older ARM SDKs do not support new
\'--specs
=nano.specs
\' option
&& \
436 ##############################
438 # Qt install template
439 # $(1) = tool install directory
440 # $(2) = tool distribution URL
441 # $(3) = tool distribution .md5 URL
442 # $(4) = tool distribution file
443 # $(5) = Qt architecture
444 # $(6) = optional extra build recipes template
445 # $(7) = optional extra clean recipes template
447 ##############################
449 define QT_INSTALL_TEMPLATE
451 .PHONY
: $(addprefix qt_sdk_
, install clean distclean)
453 qt_sdk_install
: qt_sdk_clean |
$(DL_DIR
) $(TOOLS_DIR
)
454 $(call DOWNLOAD_TEMPLATE
,$(2),$(4),"$(3)")
455 # Silently install Qt under tools directory
456 @
$(ECHO
) $(MSG_EXTRACTING
) $(4) to
$$(call toprel
, $(1))
457 $(V1
) ( export QT_INSTALL_TARGET_DIR
=$(1) && \
458 chmod
+x
$(DL_DIR
)/$(4) && \
459 $(DL_DIR
)/$(4) --script
$(ROOT_DIR
)/make
/tool_install
/qt-install.qs
; \
461 # Execute post build templates
465 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
466 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
470 @
$(ECHO
) $(MSG_DISTCLEANING
) $$(call toprel
, $(DL_DIR
)/$(4))
471 $(V1
) [ ! -f
"$(DL_DIR)/$(4)" ] ||
$(RM
) "$(DL_DIR)/$(4)"
472 $(V1
) [ ! -f
"$(DL_DIR)/$(4).md5" ] ||
$(RM
) "$(DL_DIR)/$(4).md5"
476 ##############################
478 # Mac QT install template
479 # $(1) = tool install directory
480 # $(2) = tool distribution URL
481 # $(3) = tool distribution .md5 URL
482 # $(4) = tool distribution file
483 # $(5) = QT architecture
484 # $(6) = optional extra build recipes template
485 # $(7) = 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 $(call DOWNLOAD_TEMPLATE
,$(2),$(4),"$(3)")
496 $(V1
) hdiutil attach
-nobrowse
$(DL_DIR
)/$(4)
497 # Silently install Qt under tools directory
498 @
$(ECHO
) $(MSG_EXTRACTING
) $(4) to
$$(call toprel
, $(1))
499 $(V1
) ( export QT_INSTALL_TARGET_DIR
=$(1) && \
500 $(QT_SDK_MAINTENANCE_TOOL
) --script
$(ROOT_DIR
)/make
/tool_install
/qt-install.qs
; \
502 # Unmount the .dmg file
503 $(V1
) hdiutil detach
$(QT_SDK_MOUNT_DIR
)
504 # Execute post build templates
508 @
$(ECHO
) $(MSG_CLEANING
) $$(call toprel
, $(1))
509 $(V1
) [ ! -d
"$(1)" ] ||
$(RM
) -rf
"$(1)"
514 ##############################
518 ##############################
520 ifeq ($(UNAME
), Windows
)
522 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)/$(QT_SHORT_VERSION
)/$(QT_SDK_ARCH
)
523 $(eval
$(call QT_INSTALL_TEMPLATE
,$(QT_SDK_DIR
),$(QT_SDK_URL
),$(QT_SDK_MD5_URL
),$(notdir $(QT_SDK_URL
)),$(QT_SDK_ARCH
)))
525 else ifeq ($(UNAME
), Linux
)
527 QT_SDK_PREFIX
:= "$(QT_SDK_DIR)/$(QT_SHORT_VERSION)/$(QT_SDK_ARCH)"
528 $(eval
$(call QT_INSTALL_TEMPLATE
,$(QT_SDK_DIR
),$(QT_SDK_URL
),$(QT_SDK_MD5_URL
),$(notdir $(QT_SDK_URL
)),$(QT_SDK_ARCH
)))
530 else ifeq ($(UNAME
), Darwin
)
532 QT_SDK_PREFIX
:= "$(QT_SDK_DIR)/$(QT_SHORT_VERSION)/$(QT_SDK_ARCH)"
533 $(eval
$(call MAC_QT_INSTALL_TEMPLATE
,$(QT_SDK_DIR
),$(QT_SDK_URL
),$(QT_SDK_MD5_URL
),$(notdir $(QT_SDK_URL
)),$(QT_SDK_ARCH
)))
537 QT_SDK_PREFIX
:= $(QT_SDK_DIR
)
539 .PHONY
: qt_sdk_install
541 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
542 @
$(ECHO
) $(MSG_NOTICE
) Please
install native Qt
5.6.x SDK using package manager
543 @
$(ECHO
) $(MSG_NOTICE
) --------------------------------------------------------
548 .PHONY
: qt_sdk_distclean
553 ifeq ($(shell [ -d
"$(QT_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
554 export QMAKE
:= $(QT_SDK_PREFIX
)/bin
/qmake
556 # set Qt library search path
557 ifeq ($(UNAME
), Windows
)
558 export PATH
:= $(QT_SDK_PREFIX
)/bin
:$(PATH
)
560 export LD_LIBRARY_PATH
:= $(QT_SDK_DIR
)/lib
:$(LD_LIBRARY_PATH
)
564 OPT_QT_ENV_SH
:= /opt
/$(OPT_QT
)/bin
/$(OPT_QT
)-env.sh
565 ifneq ($(wildcard $(OPT_QT_ENV_SH
)),)
567 QMAKE
:= .
$(OPT_QT_ENV_SH
) && qmake
569 # not installed, hope it's in the path...
574 .PHONY
: qt_sdk_version
576 -$(V1
) $(QMAKE
) --version | tail
-1
578 ##############################
582 ##############################
584 ifeq ($(UNAME
), Windows
)
586 ifeq ($(shell [ -d
"$(MINGW_DIR)" ] && $(ECHO
) "exists"), exists
)
587 # set MinGW binary and library paths (QTMINGW is used by qmake, do not rename)
588 export MINGW_DIR
:= $(MINGW_DIR
)
589 export QTMINGW
:= $(MINGW_DIR
)/bin
590 export PATH
:= $(QTMINGW
):$(PATH
)
592 # not installed, use host gcc compiler
593 # $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found, using system PATH)
596 .PHONY
: mingw_version
597 mingw_version
: gcc_version
603 -$(V1
) gcc
--version | head
-n1
605 all_sdk_version
: gcc_version
607 ##############################
611 ##############################
613 ifeq ($(shell [ -d
"$(PYTHON_DIR)" ] && $(ECHO
) "exists"), exists
)
614 export PYTHON
:= $(PYTHON_DIR
)/python
615 export PATH
:= $(PYTHON_DIR
):$(PATH
)
617 # not installed, hope it's in the path...
618 # $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found, using system PATH)
619 ifeq ($(findstring Python
2,$(shell python
--version
2>&1)), Python
2)
620 export PYTHON
:= python
622 export PYTHON
:= python2
626 .PHONY
: python_version
628 -$(V1
) $(PYTHON
) --version
630 ##############################
632 # NSIS Unicode (Windows only)
634 ##############################
636 ifeq ($(UNAME
), Windows
)
638 $(eval
$(call TOOL_INSTALL_TEMPLATE
,nsis
,$(NSIS_DIR
),$(NSIS_URL
),,$(notdir $(NSIS_URL
))))
640 ifeq ($(shell [ -d
"$(NSIS_DIR)" ] && $(ECHO
) "exists"), exists
)
641 export NSIS
:= $(NSIS_DIR
)/makensis
643 # not installed, hope it's in the path...
644 # $(info $(EMPTY) WARNING $(call toprel, $(NSIS_DIR)) not found (make nsis_install), using system PATH)
645 export NSIS ?
= makensis
650 -$(V1
) $(NSIS
) | head
-n1
654 ##################################
656 # Mesa OpenGL DLL (Windows only)
658 ##################################
660 ifeq ($(UNAME
), Windows
)
662 $(eval
$(call TOOL_INSTALL_TEMPLATE
,mesawin
,$(MESAWIN_DIR
),$(MESAWIN_URL
),,$(notdir $(MESAWIN_URL
))))
664 ifeq ($(shell [ -d
"$(MESAWIN_DIR)" ] && $(ECHO
) "exists"), exists
)
665 export MESAWIN_DIR
:= $(MESAWIN_DIR
)
667 # not installed, hope it's in the path...
668 #$(info $(EMPTY) WARNING $(call toprel, $(MESA_WIN_DIR)) not found (make mesawin_install), using system PATH)
671 .PHONY
: mesawin_version
673 -$(V1
) $(ECHO
) "MesaOpenGL vXX"
677 ##############################
681 ##############################
683 ifeq ($(UNAME
), Windows
)
685 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
))))
689 UNCRUSTIFY_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(UNCRUSTIFY_DIR
))
691 define UNCRUSTIFY_BUILD_TEMPLATE
693 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
694 cd
$(UNCRUSTIFY_BUILD_DIR
) && \
695 .
/configure
--prefix="$(UNCRUSTIFY_DIR)" && \
696 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
)) && \
697 $(MAKE
) $(MAKE_SILENT
) && \
698 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(UNCRUSTIFY_DIR
)) && \
699 $(MAKE
) $(MAKE_SILENT
) install-strip \
701 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(UNCRUSTIFY_BUILD_DIR
))
702 -$(V1
) [ ! -d
"$(UNCRUSTIFY_BUILD_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_BUILD_DIR)"
705 define UNCRUSTIFY_CLEAN_TEMPLATE
706 -$(V1
) [ ! -d
"$(UNCRUSTIFY_DIR)" ] ||
$(RM
) -rf
"$(UNCRUSTIFY_DIR)"
709 $(eval
$(call TOOL_INSTALL_TEMPLATE
,uncrustify
,$(UNCRUSTIFY_BUILD_DIR
),$(UNCRUSTIFY_URL
),,$(notdir $(UNCRUSTIFY_URL
)),$(UNCRUSTIFY_BUILD_TEMPLATE
),$(UNCRUSTIFY_CLEAN_TEMPLATE
)))
713 ifeq ($(shell [ -d
"$(UNCRUSTIFY_DIR)" ] && $(ECHO
) "exists"), exists
)
714 export UNCRUSTIFY
:= $(UNCRUSTIFY_DIR
)/bin
/uncrustify
716 # not installed, hope it's in the path...
717 # $(info $(EMPTY) WARNING $(call toprel, $(UNCRUSTIFY_DIR)) not found (make uncrustify_install), using system PATH)
718 export UNCRUSTIFY
:= uncrustify
721 .PHONY
: uncrustify_version
723 -$(V1
) $(UNCRUSTIFY
) --version
725 ##############################
729 ##############################
731 ifeq ($(UNAME
), Windows
)
733 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
))))
737 DOXYGEN_BUILD_DIR
:= $(BUILD_DIR
)/$(notdir $(DOXYGEN_DIR
))
739 define DOXYGEN_BUILD_TEMPLATE
741 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
742 cd
$(DOXYGEN_BUILD_DIR
) && \
743 .
/configure
--prefix "$(DOXYGEN_DIR)" --english-only
&& \
744 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
)) && \
745 $(MAKE
) $(MAKE_SILENT
) && \
746 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(DOXYGEN_DIR
)) && \
747 $(MAKE
) $(MAKE_SILENT
) install \
749 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(DOXYGEN_BUILD_DIR
))
750 -$(V1
) [ ! -d
"$(DOXYGEN_BUILD_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_BUILD_DIR)"
753 define DOXYGEN_CLEAN_TEMPLATE
754 -$(V1
) [ ! -d
"$(DOXYGEN_DIR)" ] ||
$(RM
) -rf
"$(DOXYGEN_DIR)"
757 $(eval
$(call TOOL_INSTALL_TEMPLATE
,doxygen
,$(DOXYGEN_BUILD_DIR
),$(DOXYGEN_URL
),,$(notdir $(DOXYGEN_URL
)),$(DOXYGEN_BUILD_TEMPLATE
),$(DOXYGEN_CLEAN_TEMPLATE
)))
761 ifeq ($(shell [ -d
"$(DOXYGEN_DIR)" ] && $(ECHO
) "exists"), exists
)
762 export DOXYGEN
:= $(DOXYGEN_DIR
)/bin
/doxygen
764 # not installed, hope it's in the path...
765 # $(info $(EMPTY) WARNING $(call toprel, $(DOXYGEN_DIR)) not found (make doxygen_install), using system PATH)
766 export DOXYGEN
:= doxygen
769 .PHONY
: doxygen_version
771 -$(V1
) $(ECHO
) "Doxygen `$(DOXYGEN) --version`"
773 ##############################
777 ##############################
779 $(eval
$(call TOOL_INSTALL_TEMPLATE
,gtest
,$(GTEST_DIR
),$(GTEST_URL
),,$(notdir $(GTEST_URL
))))
783 .PHONY
: gtest_version
785 -$(V1
) $(SED
) -n
"s/^PACKAGE_STRING='\(.*\)'/\1/p" < $(GTEST_DIR
)/configure
787 ##############################
791 ##############################
793 CCACHE_BUILD_DIR
:= $(BUILD_DIR
)/ccache-3.2
.2
795 define CCACHE_BUILD_TEMPLATE
797 $(ECHO
) $(MSG_CONFIGURING
) $(call toprel
, $(CCACHE_BUILD_DIR
)) && \
798 cd
$(CCACHE_BUILD_DIR
) && \
799 .
/configure
--prefix="$(CCACHE_DIR)" && \
800 $(ECHO
) $(MSG_BUILDING
) $(call toprel
, $(CCACHE_BUILD_DIR
)) && \
801 $(MAKE
) $(MAKE_SILENT
) && \
802 $(ECHO
) $(MSG_INSTALLING
) $(call toprel
, $(CCACHE_DIR
)) && \
803 $(MAKE
) $(MAKE_SILENT
) install \
805 @
$(ECHO
) $(MSG_CLEANING
) $(call toprel
, $(CCACHE_BUILD_DIR
))
806 -$(V1
) [ ! -d
"$(CCACHE_BUILD_DIR)" ] ||
$(RM
) -rf
"$(CCACHE_BUILD_DIR)"
809 @
$(ECHO
) "Setting up CCACHE configuration:"
811 $(V1
) [ -d
"$(ROOT_DIR)/.ccache" ] || mkdir
$(ROOT_DIR
)/.ccache
812 $(V1
) [ -d
"$(CCACHE_DIR)/etc" ] || mkdir
$(CCACHE_DIR
)/etc
814 $(V1
) $(ECHO
) $(QUOTE
)cache_dir
= $(ROOT_DIR
)/.ccache
$(QUOTE
) > $(CCACHE_DIR
)/etc
/ccache.conf
815 $(V1
) $(ECHO
) $(QUOTE
)max_size
= 250M
$(QUOTE
) >> $(CCACHE_DIR
)/etc
/ccache.conf
816 $(V1
) $(CAT
) $(CCACHE_DIR
)/etc
/ccache.conf
819 define CCACHE_CLEAN_TEMPLATE
820 -$(V1
) [ ! -d
"$(CCACHE_DIR)" ] ||
$(RM
) -rf
"$(CCACHE_DIR)"
823 $(eval
$(call TOOL_INSTALL_TEMPLATE
,ccache
,$(CCACHE_BUILD_DIR
),$(CCACHE_URL
),$(CCACHE_MD5_URL
),$(notdir $(CCACHE_URL
)),$(CCACHE_BUILD_TEMPLATE
),$(CCACHE_CLEAN_TEMPLATE
)))
825 ##############################
829 ##############################
831 ifneq ($(UNAME
), Windows
)
833 $(eval
$(call TOOL_INSTALL_TEMPLATE
,osg
,$(OSG_SDK_DIR
),$(OSG_URL
),,$(notdir $(OSG_URL
))))
837 ifeq ($(shell [ -d
"$(OSG_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
838 export OSG_SDK_DIR
:= $(OSG_SDK_DIR
)
840 # not installed, hope it's in the path...
841 # $(info $(EMPTY) WARNING $(call toprel, $(OSG_SDK_DIR)) not found (make osg_install), using system PATH)
846 -$(V1
) $(ECHO
) "`$(OSG_SDK_DIR)/bin/osgversion`"
848 ##############################
852 ##############################
854 ifneq ($(UNAME
), Windows
)
856 $(eval
$(call TOOL_INSTALL_TEMPLATE
,osgearth
,$(OSGEARTH_SDK_DIR
),$(OSGEARTH_URL
),,$(notdir $(OSGEARTH_URL
))))
860 ifeq ($(shell [ -d
"$(OSGEARTH_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
861 export OSGEARTH_SDK_DIR
:= $(OSGEARTH_SDK_DIR
)
863 # not installed, hope it's in the path...
864 # $(info $(EMPTY) WARNING $(call toprel, $(OSGEARTH_SDK_DIR)) not found (make osgearth_install), using system PATH)
867 .PHONY
: osgearth_version
869 -$(V1
) $(ECHO
) "`$(OSGEARTH_SDK_DIR)/bin/osgearth_version`"
871 ##############################
873 # TODO: code below is not revised yet
875 ##############################
877 # Set up openocd tools
878 OPENOCD_DIR
:= $(TOOLS_DIR
)/openocd
879 OPENOCD_WIN_DIR
:= $(TOOLS_DIR
)/openocd_win
880 OPENOCD_BUILD_DIR
:= $(DL_DIR
)/openocd-build
882 .PHONY
: openocd_install
883 openocd_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
884 openocd_install
: OPENOCD_URL
:= http
://sourceforge.net
/projects
/openocd
/files
/openocd
/0.6.1/openocd-0.6
.1.
tar.bz2
/download
885 openocd_install
: OPENOCD_FILE
:= openocd-0.6
.1.
tar.bz2
886 openocd_install
: openocd_clean
887 # download the source only if it's newer than what we already have
888 $(V1
) $(WGET
) -N
-P
"$(DL_DIR)" --trust-server-name
"$(OPENOCD_URL)"
891 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_BUILD_DIR)"
892 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
893 $(V1
) tar -C
$(OPENOCD_BUILD_DIR
) -xjf
"$(DL_DIR)/$(OPENOCD_FILE)"
896 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
898 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
899 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
900 patch
-p1
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
904 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
906 cd
$(OPENOCD_BUILD_DIR
)/openocd-0.6
.1 ; \
907 .
/configure
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-stlink
; \
909 $(MAKE
) --silent
install ; \
912 # delete the extracted source when we're done
913 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
915 .PHONY
: ftd2xx_install
917 FTD2XX_DIR
:= $(DL_DIR
)/ftd2xx
919 ftd2xx_install
: |
$(DL_DIR
)
920 ftd2xx_install
: FTD2XX_URL
:= http
://www.ftdichip.com
/Drivers
/CDM
/Beta
/CDM20817.zip
921 ftd2xx_install
: FTD2XX_FILE
:= CDM20817.zip
922 ftd2xx_install
: ftd2xx_clean
923 # download the file only if it's newer than what we already have
924 $(V0
) @echo
" DOWNLOAD $(FTD2XX_URL)"
925 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" "$(FTD2XX_URL)"
928 $(V0
) @echo
" EXTRACT $(FTD2XX_FILE) -> $(FTD2XX_DIR)"
929 $(V1
) mkdir
-p
"$(FTD2XX_DIR)"
930 $(V1
) unzip
-q
-d
"$(FTD2XX_DIR)" "$(DL_DIR)/$(FTD2XX_FILE)"
934 $(V0
) @echo
" CLEAN $(FTD2XX_DIR)"
935 $(V1
) [ ! -d
"$(FTD2XX_DIR)" ] ||
$(RM
) -r
"$(FTD2XX_DIR)"
937 .PHONY
: ftd2xx_install
939 LIBUSB_WIN_DIR
:= $(DL_DIR
)/libusb-win32-bin-1.2
.6.0
941 libusb_win_install
: |
$(DL_DIR
)
942 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
943 libusb_win_install
: LIBUSB_WIN_FILE
:= libusb-win32-bin-1.2
.6.0.zip
944 libusb_win_install
: libusb_win_clean
945 # download the file only if it's newer than what we already have
946 $(V0
) @echo
" DOWNLOAD $(LIBUSB_WIN_URL)"
947 $(V1
) $(WGET
) -q
-N
-P
"$(DL_DIR)" --trust-server-name
"$(LIBUSB_WIN_URL)"
950 $(V0
) @echo
" EXTRACT $(LIBUSB_WIN_FILE) -> $(LIBUSB_WIN_DIR)"
951 $(V1
) mkdir
-p
"$(LIBUSB_WIN_DIR)"
952 $(V1
) unzip
-q
-d
"$(DL_DIR)" "$(DL_DIR)/$(LIBUSB_WIN_FILE)"
954 # fixup .h file needed by openocd build
955 $(V0
) @echo
" FIXUP $(LIBUSB_WIN_DIR)"
956 $(V1
) ln
-s
"$(LIBUSB_WIN_DIR)/include/lusb0_usb.h" "$(LIBUSB_WIN_DIR)/include/usb.h"
958 .PHONY
: libusb_win_clean
960 $(V0
) @echo
" CLEAN $(LIBUSB_WIN_DIR)"
961 $(V1
) [ ! -d
"$(LIBUSB_WIN_DIR)" ] ||
$(RM
) -r
"$(LIBUSB_WIN_DIR)"
963 .PHONY
: openocd_git_win_install
965 openocd_git_win_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
966 openocd_git_win_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
967 openocd_git_win_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
968 openocd_git_win_install
: openocd_win_clean libusb_win_install ftd2xx_install
969 # download the source
970 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
971 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
972 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
973 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(DL_DIR)/openocd-build"
975 cd
$(OPENOCD_BUILD_DIR
) ; \
976 git checkout
-q
$(OPENOCD_REV
) ; \
980 $(V0
) @echo
" PATCH $(OPENOCD_BUILD_DIR)"
982 cd
$(OPENOCD_BUILD_DIR
) ; \
983 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
984 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
988 $(V0
) @echo
" BUILD $(OPENOCD_WIN_DIR)"
989 $(V1
) mkdir
-p
"$(OPENOCD_WIN_DIR)"
991 cd
$(OPENOCD_BUILD_DIR
) ; \
993 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_WIN_DIR)" \
994 --build
=i686-pc-linux-gnu
--host
=i586-mingw32msvc \
995 CPPFLAGS
=-I
$(LIBUSB_WIN_DIR
)/include \
996 LDFLAGS
=-L
$(LIBUSB_WIN_DIR
)/lib
/gcc \
997 --enable-ft2232_ftd2xx
--with-ftd2xx-win32-zipdir
=$(FTD2XX_DIR
) \
1004 # delete the extracted source when we're done
1005 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1007 .PHONY
: openocd_win_clean
1009 $(V0
) @echo
" CLEAN $(OPENOCD_WIN_DIR)"
1010 $(V1
) [ ! -d
"$(OPENOCD_WIN_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_WIN_DIR)"
1012 .PHONY
: openocd_git_install
1014 openocd_git_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1015 openocd_git_install
: OPENOCD_URL
:= git
://openocd.git.sourceforge.net
/gitroot
/openocd
/openocd
1016 openocd_git_install
: OPENOCD_REV
:= f1c0133321c8fcadadd10bba5537c0a634eb183b
1017 openocd_git_install
: openocd_clean
1018 # download the source
1019 $(V0
) @echo
" DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
1020 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1021 $(V1
) mkdir
-p
"$(OPENOCD_BUILD_DIR)"
1022 $(V1
) git clone
--no-checkout
$(OPENOCD_URL
) "$(OPENOCD_BUILD_DIR)"
1024 cd
$(OPENOCD_BUILD_DIR
) ; \
1025 git checkout
-q
$(OPENOCD_REV
) ; \
1029 $(V0
) @echo
" PATCH $(OPENOCD_DIR)"
1031 cd
$(OPENOCD_BUILD_DIR
) ; \
1032 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch
; \
1033 git apply
< $(ROOT_DIR
)/flight
/Project
/OpenOCD
/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch
; \
1037 $(V0
) @echo
" BUILD $(OPENOCD_DIR)"
1038 $(V1
) mkdir
-p
"$(OPENOCD_DIR)"
1040 cd
$(OPENOCD_BUILD_DIR
) ; \
1042 .
/configure
--enable-maintainer-mode
--prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi
--enable-buspirate
--enable-stlink
; \
1047 # delete the extracted source when we're done
1048 $(V1
) [ ! -d
"$(OPENOCD_BUILD_DIR)" ] ||
$(RM
) -rf
"$(OPENOCD_BUILD_DIR)"
1050 .PHONY
: openocd_clean
1052 $(V0
) @echo
" CLEAN $(OPENOCD_DIR)"
1053 $(V1
) [ ! -d
"$(OPENOCD_DIR)" ] ||
$(RM
) -r
"$(OPENOCD_DIR)"
1055 STM32FLASH_DIR
:= $(TOOLS_DIR
)/stm32flash
1056 ifeq ($(UNAME
), Windows
)
1057 STM32FLASH_BUILD_OPTIONS
:= "CC=GCC"
1059 .PHONY
: stm32flash_install
1060 stm32flash_install
: STM32FLASH_URL
:= https
://code.google.com
/p
/stm32flash
/
1061 stm32flash_install
: STM32FLASH_REV
:= a358bd1f025d
1062 stm32flash_install
: stm32flash_clean
1063 # download the source
1064 $(V0
) @
$(ECHO
) " DOWNLOAD $(STM32FLASH_URL) @ r$(STM32FLASH_REV)"
1065 $(V1
) [ ! -d
"$(STM32FLASH_DIR)" ] ||
$(RM
) -rf
"$(STM32FLASH_DIR)"
1066 $(V1
) $(MKDIR
) -p
"$(STM32FLASH_DIR)"
1067 $(V1
) $(GIT
) clone
--no-checkout
$(STM32FLASH_URL
) "$(STM32FLASH_DIR)"
1069 $(CD
) $(STM32FLASH_DIR
) ; \
1070 $(GIT
) checkout
-q
$(STM32FLASH_REV
) ; \
1073 $(V0
) @
$(ECHO
) " BUILD $(STM32FLASH_DIR)"
1074 $(V1
) $(MAKE
) --silent
-C
$(STM32FLASH_DIR
) all $(STM32FLASH_BUILD_OPTIONS
)
1076 .PHONY
: stm32flash_clean
1078 $(V0
) @
$(ECHO
) " CLEAN $(STM32FLASH_DIR)"
1079 $(V1
) [ ! -d
"$(STM32FLASH_DIR)" ] ||
$(RM
) -rf
"$(STM32FLASH_DIR)"
1081 DFUUTIL_DIR
:= $(TOOLS_DIR
)/dfu-util
1083 .PHONY
: dfuutil_install
1084 dfuutil_install
: DFUUTIL_URL
:= http
://dfu-util.sourceforge.net
/releases
/dfu-util-0.8.
tar.gz
1085 dfuutil_install
: DFUUTIL_FILE
:= $(notdir $(DFUUTIL_URL
))
1086 dfuutil_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1087 dfuutil_install
: dfuutil_clean
1088 # download the source
1089 $(V0
) @echo
" DOWNLOAD $(DFUUTIL_URL)"
1090 $(V1
) $(CURL
) $(CURL_OPTIONS
) -o
"$(DL_DIR)/$(DFUUTIL_FILE)" "$(DFUUTIL_URL)"
1092 # extract the source
1093 $(V0
) @echo
" EXTRACT $(DFUUTIL_FILE)"
1094 $(V1
) [ ! -d
"$(DL_DIR)/dfuutil-build" ] ||
$(RM
) -r
"$(DL_DIR)/dfuutil-build"
1095 $(V1
) mkdir
-p
"$(DL_DIR)/dfuutil-build"
1096 $(V1
) tar -C
$(DL_DIR
)/dfuutil-build
-xf
"$(DL_DIR)/$(DFUUTIL_FILE)"
1099 $(V0
) @echo
" BUILD $(DFUUTIL_DIR)"
1100 $(V1
) mkdir
-p
"$(DFUUTIL_DIR)"
1102 cd
$(DL_DIR
)/dfuutil-build
/dfu-util-0.8
; \
1103 .
/configure
--prefix="$(DFUUTIL_DIR)" ; \
1108 .PHONY
: dfuutil_clean
1110 $(V0
) @echo
" CLEAN $(DFUUTIL_DIR)"
1111 $(V1
) [ ! -d
"$(DFUUTIL_DIR)" ] ||
$(RM
) -r
"$(DFUUTIL_DIR)"
1113 # see http://developer.android.com/sdk/ for latest versions
1114 ANDROID_SDK_DIR
:= $(TOOLS_DIR
)/android-sdk-linux
1115 .PHONY
: android_sdk_install
1116 android_sdk_install
: ANDROID_SDK_URL
:= http
://dl.google.com
/android
/android-sdk_r20.0
.3-linux.tgz
1117 android_sdk_install
: ANDROID_SDK_FILE
:= $(notdir $(ANDROID_SDK_URL
))
1118 # order-only prereq on directory existance:
1119 android_sdk_install
: |
$(DL_DIR
) $(TOOLS_DIR
)
1120 android_sdk_install
: android_sdk_clean
1121 # download the source only if it's newer than what we already have
1122 $(V0
) @echo
" DOWNLOAD $(ANDROID_SDK_URL)"
1123 $(V1
) $(WGET
) --no-check-certificate
-N
-P
"$(DL_DIR)" "$(ANDROID_SDK_URL)"
1125 # binary only release so just extract it
1126 $(V0
) @echo
" EXTRACT $(ANDROID_SDK_FILE)"
1127 $(V1
) tar -C
$(TOOLS_DIR
) -xf
"$(DL_DIR)/$(ANDROID_SDK_FILE)"
1129 .PHONY
: android_sdk_clean
1131 $(V0
) @echo
" CLEAN $(ANDROID_SDK_DIR)"
1132 $(V1
) [ ! -d
"$(ANDROID_SDK_DIR)" ] ||
$(RM
) -r
$(ANDROID_SDK_DIR
)
1134 .PHONY
: android_sdk_update
1136 $(V0
) @echo
" UPDATE $(ANDROID_SDK_DIR)"
1137 $(ANDROID_SDK_DIR
)/tools
/android update sdk
--no-ui
-t platform-tools
,android-16
,addon-google_apis-google-16
1139 #Install git hooks under the right folder
1143 $(V0
) @echo
" Configuring GIT commit template"
1144 $(V1
) $(CD
) "$(ROOT_DIR)"
1145 $(V1
) $(GIT
) config commit.template .commit-template
1147 .PHONY
: prepare_clean
1149 $(V0
) @echo
" Cleanup GIT commit template configuration"
1150 $(V1
) $(CD
) "$(ROOT_DIR)"
1151 $(V1
) $(GIT
) config
--unset commit.template
1153 ##############################
1155 # TODO: these defines will go to tool install sections
1157 ##############################
1159 ifeq ($(shell [ -d
"$(OPENOCD_DIR)" ] && $(ECHO
) "exists"), exists
)
1160 export OPENOCD
:= $(OPENOCD_DIR
)/bin
/openocd
1162 # not installed, hope it's in the path...
1163 export OPENOCD ?
= openocd
1166 ifeq ($(shell [ -d
"$(ANDROID_SDK_DIR)" ] && $(ECHO
) "exists"), exists
)
1167 ANDROID
:= $(ANDROID_SDK_DIR
)/tools
/android
1168 ANDROID_DX
:= $(ANDROID_SDK_DIR
)/platform-tools
/dx
1170 # not installed, hope it's in the path...