2012-11-28 04:43:02 +01:00
|
|
|
#
|
2015-08-12 14:02:29 +02:00
|
|
|
# Installers for tools required by the build system.
|
2015-07-31 11:20:09 +02:00
|
|
|
# Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
|
2013-03-31 16:57:25 +02:00
|
|
|
# Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
|
2012-11-28 04:43:02 +01:00
|
|
|
#
|
2013-03-31 16:57:25 +02:00
|
|
|
# NOTE: install targets are not tied to the default goals and must
|
|
|
|
# be invoked manually. But tool paths set by this file are used
|
|
|
|
# across the build system.
|
2012-11-28 04:43:02 +01:00
|
|
|
#
|
2013-03-31 16:57:25 +02:00
|
|
|
# Ready to use:
|
|
|
|
# arm_sdk_install
|
2013-04-10 00:04:03 +02:00
|
|
|
# qt_sdk_install
|
2013-05-01 21:44:11 +02:00
|
|
|
# nsis_install (Windows only)
|
2014-07-04 17:21:39 +02:00
|
|
|
# mesawin_install (Windows only)
|
2013-04-22 01:43:53 +02:00
|
|
|
# uncrustify_install
|
2013-04-29 02:02:29 +02:00
|
|
|
# doxygen_install
|
2013-05-03 12:39:33 +02:00
|
|
|
# gtest_install
|
2015-07-28 07:30:45 +02:00
|
|
|
# ccache_install
|
2013-03-31 16:57:25 +02:00
|
|
|
#
|
|
|
|
# TODO:
|
|
|
|
# openocd_install
|
|
|
|
# ftd2xx_install
|
|
|
|
# libusb_win_install
|
|
|
|
# openocd_git_win_install
|
|
|
|
# openocd_git_install
|
|
|
|
# stm32flash_install
|
|
|
|
# dfuutil_install
|
|
|
|
# android_sdk_install
|
|
|
|
#
|
|
|
|
# TODO:
|
|
|
|
# help in the top Makefile
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2015-07-13 17:12:10 +02:00
|
|
|
ifndef TOP_LEVEL_MAKEFILE
|
2013-03-31 16:57:25 +02:00
|
|
|
$(error $(notdir $(lastword $(MAKEFILE_LIST))) should be included by the top level Makefile)
|
|
|
|
endif
|
|
|
|
|
2015-09-05 13:27:15 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Already installed tools modules
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
-include $(wildcard $(TOOLS_DIR)/*.mk)
|
|
|
|
|
2015-09-05 14:23:03 +02:00
|
|
|
TOOL_INSTALL := $(ROOT_DIR)/tool_install.sh
|
|
|
|
TOOL_TARGETS := gcc-arm-none-eabi
|
|
|
|
|
|
|
|
TOOL_INSTALL_TARGETS := $(addsuffix _install,$(TOOL_TARGETS))
|
|
|
|
TOOL_FORCE_INSTALL_TARGETS := $(addsuffix _force_install,$(TOOL_TARGETS))
|
|
|
|
TOOL_REMOVE_TARGETS := $(addsuffix _remove,$(TOOL_TARGETS))
|
|
|
|
|
|
|
|
.PHONY: $(TOOL_INSTALL_TARGETS)
|
|
|
|
$(TOOL_INSTALL_TARGETS):
|
|
|
|
@$(ECHO) $(MSG_INSTALLING) $(@:_install=)
|
|
|
|
$(V1) $(TOOL_INSTALL) -n $(@:_install=)
|
|
|
|
|
|
|
|
.PHONY: $(TOOL_FORCE_INSTALL_TARGETS)
|
|
|
|
$(TOOL_FORCE_INSTALL_TARGETS):
|
|
|
|
@$(ECHO) $(MSG_INSTALLING) $(@:_install=)
|
|
|
|
$(V1) $(TOOL_INSTALL) -n -f $(@:_force_install=)
|
|
|
|
|
|
|
|
.PHONY: $(TOOL_REMOVE_TARGETS)
|
|
|
|
$(TOOL_REMOVE_TARGETS):
|
|
|
|
@$(ECHO) $(MSG_CLEANING) $(@:_install=)
|
|
|
|
$(V1) $(TOOL_INSTALL) -n -r $(@:_remove=)
|
|
|
|
|
2013-03-31 16:57:25 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Toolchain URLs and directories
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2016-02-17 23:38:00 +01:00
|
|
|
TOOLS_URL := http://librepilot.github.io/tools
|
|
|
|
|
2016-03-24 16:11:52 +01:00
|
|
|
QT_SHORT_VERSION := 5.6
|
2016-12-15 21:44:58 +01:00
|
|
|
QT_VERSION := 5.6.2
|
2016-03-24 15:01:26 +01:00
|
|
|
|
2013-03-31 16:57:25 +02:00
|
|
|
ifeq ($(UNAME), Linux)
|
2013-04-13 21:51:33 +02:00
|
|
|
ifeq ($(ARCH), x86_64)
|
2016-01-27 08:54:45 +01:00
|
|
|
QT_SDK_ARCH := gcc_64
|
2016-03-24 16:11:52 +01:00
|
|
|
QT_SDK_URL := http://download.qt.io/official_releases/qt/$(QT_SHORT_VERSION)/$(QT_VERSION)/qt-opensource-linux-x64-$(QT_VERSION).run
|
|
|
|
QT_SDK_MD5_URL := http://download.qt.io/official_releases/qt/$(QT_SHORT_VERSION)/$(QT_VERSION)/md5sums.txt
|
2016-06-24 02:46:14 +02:00
|
|
|
OSG_URL := $(TOOLS_URL)/osg-3.5.3-linux-x64-qt-$(QT_VERSION).tar.gz
|
2016-03-24 16:11:52 +01:00
|
|
|
OSGEARTH_URL := $(TOOLS_URL)/osgearth-2.7-linux-x64-qt-$(QT_VERSION).tar.gz
|
2013-04-13 21:51:33 +02:00
|
|
|
else
|
2016-07-11 22:48:47 +02:00
|
|
|
# x32 for linux no longer provided as pre-built binaries.
|
2013-04-13 21:51:33 +02:00
|
|
|
endif
|
2016-02-17 23:38:00 +01:00
|
|
|
UNCRUSTIFY_URL := $(TOOLS_URL)/uncrustify-0.60.tar.gz
|
|
|
|
DOXYGEN_URL := $(TOOLS_URL)/doxygen-1.8.3.1.src.tar.gz
|
2013-03-31 16:57:25 +02:00
|
|
|
else ifeq ($(UNAME), Darwin)
|
2016-01-27 08:54:45 +01:00
|
|
|
QT_SDK_ARCH := clang_64
|
2016-03-24 16:11:52 +01:00
|
|
|
QT_SDK_URL := http://download.qt.io/official_releases/qt/$(QT_SHORT_VERSION)/$(QT_VERSION)/qt-opensource-mac-x64-clang-$(QT_VERSION).dmg
|
|
|
|
QT_SDK_MD5_URL := http://download.qt.io/official_releases/qt/$(QT_SHORT_VERSION)/$(QT_VERSION)/md5sums.txt
|
|
|
|
QT_SDK_MOUNT_DIR := /Volumes/qt-opensource-mac-x64-clang-$(QT_VERSION)
|
|
|
|
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)
|
2016-02-17 23:38:00 +01:00
|
|
|
UNCRUSTIFY_URL := $(TOOLS_URL)/uncrustify-0.60.tar.gz
|
|
|
|
DOXYGEN_URL := $(TOOLS_URL)/doxygen-1.8.3.1.src.tar.gz
|
2016-06-24 02:46:14 +02:00
|
|
|
OSG_URL := $(TOOLS_URL)/osg-3.5.3-clang_64-qt-$(QT_VERSION).tar.gz
|
2016-03-24 16:11:52 +01:00
|
|
|
OSGEARTH_URL := $(TOOLS_URL)/osgearth-2.7-clang_64-qt-$(QT_VERSION).tar.gz
|
2013-03-31 16:57:25 +02:00
|
|
|
else ifeq ($(UNAME), Windows)
|
2016-01-27 08:54:45 +01:00
|
|
|
QT_SDK_ARCH := mingw492_32
|
2016-03-24 16:11:52 +01:00
|
|
|
QT_SDK_URL := http://download.qt.io/official_releases/qt/$(QT_SHORT_VERSION)/$(QT_VERSION)/qt-opensource-windows-x86-mingw492-$(QT_VERSION).exe
|
|
|
|
QT_SDK_MD5_URL := http://download.qt.io/official_releases/qt/$(QT_SHORT_VERSION)/$(QT_VERSION)/md5sums.txt
|
2016-02-17 23:38:00 +01:00
|
|
|
NSIS_URL := $(TOOLS_URL)/nsis-2.46-unicode.tar.bz2
|
|
|
|
MESAWIN_URL := $(TOOLS_URL)/mesawin.tar.gz
|
|
|
|
UNCRUSTIFY_URL := $(TOOLS_URL)/uncrustify-0.60-windows.tar.bz2
|
|
|
|
DOXYGEN_URL := $(TOOLS_URL)/doxygen-1.8.3.1-windows.tar.bz2
|
2013-03-31 16:57:25 +02:00
|
|
|
endif
|
|
|
|
|
2016-07-11 22:48:47 +02:00
|
|
|
GTEST_URL := $(TOOLS_URL)/gtest-1.7.0.zip
|
2015-07-28 07:30:45 +02:00
|
|
|
CCACHE_URL := http://samba.org/ftp/ccache/ccache-3.2.2.tar.bz2
|
2016-02-17 23:38:00 +01:00
|
|
|
CCACHE_MD5_URL := $(TOOLS_URL)/ccache-3.2.2.tar.bz2.md5
|
2013-05-03 12:39:33 +02:00
|
|
|
|
2016-01-27 08:50:48 +01:00
|
|
|
QT_SDK_DIR := $(TOOLS_DIR)/qt-$(QT_VERSION)
|
2015-03-19 21:01:06 +01:00
|
|
|
UNCRUSTIFY_DIR := $(TOOLS_DIR)/uncrustify-0.60
|
|
|
|
DOXYGEN_DIR := $(TOOLS_DIR)/doxygen-1.8.3.1
|
2016-01-31 22:04:59 +01:00
|
|
|
GTEST_DIR := $(TOOLS_DIR)/gtest-1.7.0
|
2015-07-28 07:30:45 +02:00
|
|
|
CCACHE_DIR := $(TOOLS_DIR)/ccache
|
2014-07-14 18:19:12 +02:00
|
|
|
|
2015-03-19 21:01:06 +01:00
|
|
|
ifeq ($(UNAME), Linux)
|
2015-07-17 22:55:25 +02:00
|
|
|
ifeq ($(ARCH), x86_64)
|
2016-06-24 02:46:14 +02:00
|
|
|
OSG_SDK_DIR := $(TOOLS_DIR)/osg-3.5.3-linux-x64-qt-$(QT_VERSION)
|
2016-02-17 23:38:00 +01:00
|
|
|
OSGEARTH_SDK_DIR := $(TOOLS_DIR)/osgearth-2.7-linux-x64-qt-$(QT_VERSION)
|
2015-07-17 22:55:25 +02:00
|
|
|
else
|
2016-06-24 02:46:14 +02:00
|
|
|
OSG_SDK_DIR := $(TOOLS_DIR)/osg-3.5.3-linux-x86-qt-$(QT_VERSION)
|
2016-02-17 23:38:00 +01:00
|
|
|
OSGEARTH_SDK_DIR := $(TOOLS_DIR)/osgearth-2.7-linux-x86-qt-$(QT_VERSION)
|
2015-07-17 22:55:25 +02:00
|
|
|
endif
|
2015-03-19 21:01:06 +01:00
|
|
|
else ifeq ($(UNAME), Darwin)
|
2016-06-24 02:46:14 +02:00
|
|
|
OSG_SDK_DIR := $(TOOLS_DIR)/osg-3.5.3-clang_64-qt-$(QT_VERSION)
|
2016-02-17 23:38:00 +01:00
|
|
|
OSGEARTH_SDK_DIR := $(TOOLS_DIR)/osgearth-2.7-clang_64-qt-$(QT_VERSION)
|
2015-03-19 21:01:06 +01:00
|
|
|
else ifeq ($(UNAME), Windows)
|
2016-02-17 23:13:01 +01:00
|
|
|
ifeq ($(ARCH), x86_64)
|
|
|
|
MINGW_DIR := /mingw64
|
|
|
|
else
|
|
|
|
MINGW_DIR := /mingw32
|
|
|
|
endif
|
2015-08-02 20:20:02 +02:00
|
|
|
# When changing PYTHON_DIR, you must also update it in ground/gcs/src/python.pri
|
2016-02-17 23:13:01 +01:00
|
|
|
PYTHON_DIR := $(MINGW_DIR)/bin
|
|
|
|
OSG_SDK_DIR := $(MINGW_DIR)
|
|
|
|
OSGEARTH_SDK_DIR := $(MINGW_DIR)
|
2015-03-19 21:01:06 +01:00
|
|
|
NSIS_DIR := $(TOOLS_DIR)/nsis-2.46-unicode
|
|
|
|
MESAWIN_DIR := $(TOOLS_DIR)/mesawin
|
2014-07-14 18:19:12 +02:00
|
|
|
endif
|
2013-03-31 16:57:25 +02:00
|
|
|
|
|
|
|
##############################
|
|
|
|
#
|
2013-05-03 12:39:33 +02:00
|
|
|
# Build only and all toolchains available for the platform
|
2013-03-31 16:57:25 +02:00
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2016-01-31 11:25:55 +01:00
|
|
|
BUILD_SDK_TARGETS := arm_sdk
|
2013-04-10 00:04:03 +02:00
|
|
|
ifeq ($(UNAME), Windows)
|
2016-01-31 11:25:55 +01:00
|
|
|
BUILD_SDK_TARGETS += nsis mesawin
|
2016-08-14 13:22:45 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(UNAME), Darwin)
|
2016-01-31 11:25:55 +01:00
|
|
|
BUILD_SDK_TARGETS += qt_sdk osg
|
2013-04-10 00:04:03 +02:00
|
|
|
endif
|
2015-09-06 17:10:52 +02:00
|
|
|
ALL_SDK_TARGETS := $(BUILD_SDK_TARGETS) gtest uncrustify doxygen
|
2013-05-03 12:39:33 +02:00
|
|
|
|
|
|
|
define GROUP_SDK_TEMPLATE
|
|
|
|
.PHONY: $(1)_install $(1)_clean $(1)_distclean $(1)_version
|
|
|
|
$(1)_install: $(addsuffix _install,$(2))
|
|
|
|
$(1)_clean: $(addsuffix _clean,$(2))
|
|
|
|
$(1)_distclean: $(addsuffix _distclean,$(2))
|
|
|
|
$(1)_version: $(addsuffix _version,$(2))
|
|
|
|
endef
|
2013-03-31 16:57:25 +02:00
|
|
|
|
2013-05-03 12:39:33 +02:00
|
|
|
$(eval $(call GROUP_SDK_TEMPLATE,build_sdk,$(BUILD_SDK_TARGETS)))
|
|
|
|
$(eval $(call GROUP_SDK_TEMPLATE,all_sdk,$(ALL_SDK_TARGETS)))
|
2013-03-31 16:57:25 +02:00
|
|
|
|
2013-04-10 00:04:03 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Misc host tools
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2013-04-22 21:32:57 +02:00
|
|
|
# Used by other makefiles
|
2013-04-10 00:04:03 +02:00
|
|
|
export MKDIR := mkdir
|
|
|
|
export CP := cp
|
|
|
|
export RM := rm
|
|
|
|
export LN := ln
|
|
|
|
export CAT := cat
|
2013-04-22 21:32:57 +02:00
|
|
|
export CUT := cut
|
2013-04-10 00:04:03 +02:00
|
|
|
export SED := sed
|
2013-04-22 21:32:57 +02:00
|
|
|
|
|
|
|
# Used only by this Makefile
|
2013-10-26 14:39:49 +02:00
|
|
|
GIT := git
|
2013-05-03 12:39:33 +02:00
|
|
|
CURL := curl
|
2013-10-26 14:39:49 +02:00
|
|
|
TAR := tar
|
2013-05-03 12:39:33 +02:00
|
|
|
UNZIP := unzip
|
2015-04-05 18:38:56 +02:00
|
|
|
ZIP := gzip
|
2013-05-03 12:39:33 +02:00
|
|
|
OPENSSL := openssl
|
2013-10-26 14:39:49 +02:00
|
|
|
ANT := ant
|
2013-04-22 21:32:57 +02:00
|
|
|
JAVAC := javac
|
2013-10-26 14:39:49 +02:00
|
|
|
JAR := jar
|
|
|
|
CD := cd
|
|
|
|
GREP := grep
|
2016-01-14 00:24:31 +01:00
|
|
|
CMAKE := cmake
|
2014-03-20 00:46:05 +01:00
|
|
|
ifneq ($(UNAME), Windows)
|
2014-04-08 14:11:17 +02:00
|
|
|
SEVENZIP := 7za
|
2014-03-20 00:46:05 +01:00
|
|
|
else
|
|
|
|
SEVENZIP := 7za.exe
|
2014-04-08 14:11:17 +02:00
|
|
|
ifneq ($(shell $(SEVENZIP) --version >/dev/null 2>&1 && $(ECHO) "found"), found)
|
2015-07-31 11:20:09 +02:00
|
|
|
# no $(SEVENZIP) found in path. hope is in bin...
|
2014-04-08 14:11:17 +02:00
|
|
|
SEVENZIP = $(TOOLS_DIR)/bin/7za.exe
|
|
|
|
endif
|
2014-03-20 00:46:05 +01:00
|
|
|
endif
|
2016-01-27 08:46:16 +01:00
|
|
|
ifneq ($(UNAME), Windows)
|
|
|
|
MAKE := make
|
|
|
|
else
|
|
|
|
MAKE := mingw32-make
|
|
|
|
endif
|
2014-03-20 00:46:05 +01:00
|
|
|
|
2013-04-10 00:04:03 +02:00
|
|
|
# Echo in recipes is a bit tricky in a Windows Git Bash window in some cases.
|
|
|
|
# It does not work if make started under msysGit installed into a path with spaces.
|
|
|
|
ifneq ($(UNAME), Windows)
|
|
|
|
export ECHO := echo
|
|
|
|
else
|
2013-04-10 17:23:01 +02:00
|
|
|
# export ECHO := $(PYTHON) -c "import sys; print(' '.join(sys.argv[1:]))"
|
|
|
|
export ECHO := echo
|
2013-04-10 00:04:03 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Test if quotes are needed for the echo command
|
|
|
|
ifeq ($(shell $(ECHO) "test"), test)
|
|
|
|
export QUOTE := '
|
|
|
|
# This line is just to clear out the single quote above '
|
|
|
|
else
|
|
|
|
export QUOTE :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Command to extract version info data from the repository and source tree
|
2013-04-10 17:23:01 +02:00
|
|
|
export VERSION_INFO = $(PYTHON) $(ROOT_DIR)/make/scripts/version-info.py --path=$(ROOT_DIR)
|
2013-04-10 00:04:03 +02:00
|
|
|
|
2015-07-17 23:21:01 +02:00
|
|
|
export CCACHE
|
|
|
|
|
2013-04-14 03:17:10 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Misc settings
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
# Define messages
|
|
|
|
MSG_VERIFYING = $(QUOTE) VERIFY $(QUOTE)
|
|
|
|
MSG_DOWNLOADING = $(QUOTE) DOWNLOAD $(QUOTE)
|
|
|
|
MSG_CHECKSUMMING = $(QUOTE) MD5 $(QUOTE)
|
|
|
|
MSG_EXTRACTING = $(QUOTE) EXTRACT $(QUOTE)
|
|
|
|
MSG_CONFIGURING = $(QUOTE) CONFIGURE $(QUOTE)
|
2013-04-22 01:43:53 +02:00
|
|
|
MSG_BUILDING = $(QUOTE) BUILD $(QUOTE)
|
|
|
|
MSG_INSTALLING = $(QUOTE) INSTALL $(QUOTE)
|
2013-04-14 03:17:10 +02:00
|
|
|
MSG_CLEANING = $(QUOTE) CLEAN $(QUOTE)
|
|
|
|
MSG_DISTCLEANING = $(QUOTE) DISTCLEAN $(QUOTE)
|
2013-04-14 23:41:59 +02:00
|
|
|
MSG_NOTICE = $(QUOTE) NOTE $(QUOTE)
|
2013-04-14 03:17:10 +02:00
|
|
|
|
|
|
|
# Verbosity level
|
|
|
|
ifeq ($(V), 1)
|
2013-05-03 12:39:33 +02:00
|
|
|
MAKE_SILENT :=
|
|
|
|
UNZIP_SILENT :=
|
2013-04-14 03:17:10 +02:00
|
|
|
else
|
2013-05-03 12:39:33 +02:00
|
|
|
MAKE_SILENT := --silent
|
|
|
|
UNZIP_SILENT := -q
|
2013-04-14 03:17:10 +02:00
|
|
|
endif
|
|
|
|
|
2013-10-24 00:09:01 +02:00
|
|
|
# Batch mode
|
|
|
|
ifeq ($(BATCH), 1)
|
2013-10-26 15:12:34 +02:00
|
|
|
CURL_OPTIONS := --silent -L
|
2013-10-24 00:09:01 +02:00
|
|
|
else
|
2013-10-26 15:12:34 +02:00
|
|
|
CURL_OPTIONS := -L
|
2013-10-24 00:09:01 +02:00
|
|
|
endif
|
|
|
|
|
2013-04-14 03:17:10 +02:00
|
|
|
# MSYS tar workaround
|
|
|
|
ifeq ($(UNAME), Windows)
|
|
|
|
TAR_OPTIONS := --force-local
|
|
|
|
else
|
|
|
|
TAR_OPTIONS :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Print some useful notes for *_install targets
|
|
|
|
ifneq ($(strip $(filter $(addsuffix _install,all_sdk $(ALL_SDK_TARGETS)),$(MAKECMDGOALS))),)
|
|
|
|
ifneq ($(shell $(CURL) --version >/dev/null 2>&1 && $(ECHO) "found"), found)
|
|
|
|
$(error Please install curl first ('apt-get install curl' or similar))
|
|
|
|
endif
|
|
|
|
$(info $(EMPTY) NOTE Use 'make all_sdk_distclean' to remove installation files)
|
|
|
|
$(info $(EMPTY) NOTE Use 'make all_sdk_version' to check toolchain versions)
|
|
|
|
$(info $(EMPTY) NOTE Add 'V=1' to make command line to diagnose make problems)
|
2013-10-24 00:09:01 +02:00
|
|
|
$(info $(EMPTY) NOTE Add 'BATCH=1' to make command line to disable progress reporting during downloads)
|
2013-04-14 03:17:10 +02:00
|
|
|
endif
|
|
|
|
|
2013-04-24 15:42:47 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Cross-platform MD5 check template
|
|
|
|
# $(1) = file name without quotes
|
|
|
|
# $(2) = string compare operator, e.g. = or !=
|
|
|
|
#
|
|
|
|
##############################
|
2013-12-01 23:17:48 +01:00
|
|
|
|
2013-04-24 15:42:47 +02:00
|
|
|
define MD5_CHECK_TEMPLATE
|
2016-03-24 15:01:26 +01:00
|
|
|
"`test -f \"$(1)\" && $(OPENSSL) dgst -md5 \"$(1)\" | $(CUT) -f2 -d' '`" $(2) "`$(GREP) $(notdir $(1)) $(1).md5 | $(CUT) -f1 -d' '`"
|
2013-04-24 15:42:47 +02:00
|
|
|
endef
|
|
|
|
|
2015-04-05 18:40:52 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Cross-platform MD5 generation template
|
|
|
|
# $(1) = file name without quotes
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
ifeq ($(UNAME), Darwin)
|
|
|
|
|
|
|
|
define MD5_GEN_TEMPLATE
|
|
|
|
md5 -r $(1) > $(1).md5
|
|
|
|
endef
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
define MD5_GEN_TEMPLATE
|
|
|
|
$(OPENSSL) dgst -r -md5 $(1) > $(1).md5
|
|
|
|
endef
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2013-10-26 14:39:49 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Cross platform download template
|
|
|
|
# $(1) = Package URL
|
|
|
|
# $(2) = Package file
|
|
|
|
# $(3) = URL for .md5 file to be tested against Package
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
define DOWNLOAD_TEMPLATE
|
|
|
|
@$(ECHO) $(MSG_VERIFYING) $$(call toprel, $(DL_DIR)/$(2))
|
|
|
|
$(V1) ( \
|
|
|
|
cd "$(DL_DIR)" && \
|
2013-11-02 12:12:23 +01:00
|
|
|
$(CURL) $(CURL_OPTIONS) --silent -o "$(DL_DIR)/$(2).md5" "$(3)" && \
|
2013-10-26 14:39:49 +02:00
|
|
|
if [ $(call MD5_CHECK_TEMPLATE,$(DL_DIR)/$(2),!=) ]; then \
|
|
|
|
$(ECHO) $(MSG_DOWNLOADING) $(1) && \
|
|
|
|
$(CURL) $(CURL_OPTIONS) -o "$(DL_DIR)/$(2)" "$(1)" && \
|
|
|
|
$(ECHO) $(MSG_CHECKSUMMING) $$(call toprel, $(DL_DIR)/$(2)) && \
|
|
|
|
[ $(call MD5_CHECK_TEMPLATE,$(DL_DIR)/$(2),=) ]; \
|
|
|
|
fi; \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2013-03-31 16:57:25 +02:00
|
|
|
##############################
|
|
|
|
#
|
2013-04-10 20:56:43 +02:00
|
|
|
# Common tool install template
|
|
|
|
# $(1) = tool name
|
2013-04-22 01:43:53 +02:00
|
|
|
# $(2) = tool extract/build directory
|
2013-04-10 20:56:43 +02:00
|
|
|
# $(3) = tool distribution URL
|
2014-04-29 02:02:51 +02:00
|
|
|
# $(4) = tool distribution MD5 URL
|
2014-04-27 22:20:49 +02:00
|
|
|
# $(5) = tool distribution file
|
|
|
|
# $(6) = optional extra build recipes template
|
|
|
|
# $(7) = optional extra clean recipes template
|
2013-03-31 16:57:25 +02:00
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2013-04-10 20:56:43 +02:00
|
|
|
define TOOL_INSTALL_TEMPLATE
|
2013-03-31 16:57:25 +02:00
|
|
|
|
2013-04-10 20:56:43 +02:00
|
|
|
.PHONY: $(addprefix $(1)_, install clean distclean)
|
2013-04-10 00:04:03 +02:00
|
|
|
|
2013-04-10 20:56:43 +02:00
|
|
|
$(1)_install: $(1)_clean | $(DL_DIR) $(TOOLS_DIR)
|
2015-07-31 11:20:09 +02:00
|
|
|
|
2014-04-29 02:02:51 +02:00
|
|
|
$(if $(4), $(call DOWNLOAD_TEMPLATE,$(3),$(5),$(4)),$(call DOWNLOAD_TEMPLATE,$(3),$(5),"$(3).md5"))
|
2015-07-31 11:20:09 +02:00
|
|
|
|
2013-04-10 20:56:43 +02:00
|
|
|
@$(ECHO) $(MSG_EXTRACTING) $$(call toprel, $(2))
|
2013-04-22 01:43:53 +02:00
|
|
|
$(V1) $(MKDIR) -p $$(call toprel, $(dir $(2)))
|
2014-04-29 10:52:41 +02:00
|
|
|
|
2014-04-27 22:20:49 +02:00
|
|
|
$(if $(filter $(suffix $(5)), .zip),
|
|
|
|
$(V1) $(UNZIP) $(UNZIP_SILENT) -d $$(call toprel, $(dir $(2))) $$(call toprel, $(DL_DIR)/$(5)),
|
|
|
|
$(V1) $(TAR) $(TAR_OPTIONS) -C $$(call toprel, $(dir $(2))) -xf $$(call toprel, $(DL_DIR)/$(5))
|
2013-05-03 12:39:33 +02:00
|
|
|
)
|
2013-03-31 16:57:25 +02:00
|
|
|
|
2014-04-27 22:20:49 +02:00
|
|
|
$(6)
|
2013-03-31 16:57:25 +02:00
|
|
|
|
2013-04-10 20:56:43 +02:00
|
|
|
$(1)_clean:
|
|
|
|
@$(ECHO) $(MSG_CLEANING) $$(call toprel, $(2))
|
2013-04-12 01:49:20 +02:00
|
|
|
$(V1) [ ! -d "$(2)" ] || $(RM) -rf "$(2)"
|
2013-04-10 20:56:43 +02:00
|
|
|
|
2014-04-27 22:20:49 +02:00
|
|
|
$(7)
|
2013-04-22 01:43:53 +02:00
|
|
|
|
2013-04-10 20:56:43 +02:00
|
|
|
$(1)_distclean:
|
2014-04-27 22:20:49 +02:00
|
|
|
@$(ECHO) $(MSG_DISTCLEANING) $$(call toprel, $(DL_DIR)/$(5))
|
|
|
|
$(V1) [ ! -f "$(DL_DIR)/$(5)" ] || $(RM) "$(DL_DIR)/$(5)"
|
|
|
|
$(V1) [ ! -f "$(DL_DIR)/$(5).md5" ] || $(RM) "$(DL_DIR)/$(5).md5"
|
2013-04-10 20:56:43 +02:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
2015-11-21 15:05:43 +01:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# ARM SDK
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
export ARM_SDK_PREFIX := arm-none-eabi-
|
|
|
|
ARM_SDK_TOOL := gcc-arm-none-eabi
|
|
|
|
|
|
|
|
.PHONY: arm_sdk_install
|
|
|
|
arm_sdk_install: $(ARM_SDK_TOOL)_install
|
|
|
|
|
|
|
|
.PHONY: arm_sdk_clean
|
|
|
|
arm_sdk_clean: $(ARM_SDK_TOOL)_remove
|
|
|
|
|
|
|
|
.PHONY: arm_sdk_version
|
|
|
|
arm_sdk_version:
|
|
|
|
-$(V1) $(ARM_SDK_PREFIX)gcc --version | head -n1
|
|
|
|
|
|
|
|
# Template to check ARM toolchain version before building targets
|
|
|
|
define ARM_GCC_VERSION_CHECK_TEMPLATE
|
|
|
|
if ! $(ARM_SDK_PREFIX)gcc --version --specs=nano.specs >/dev/null 2>&1; then \
|
|
|
|
$(ECHO) $(MSG_NOTICE) Please install ARM toolchain 4.8 2014q1 using \'make arm_sdk_install\' && \
|
|
|
|
$(ECHO) $(MSG_NOTICE) Older ARM SDKs do not support new \'--specs=nano.specs\' option && \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
2014-03-20 00:46:05 +01:00
|
|
|
##############################
|
|
|
|
#
|
2015-11-15 16:45:13 +01:00
|
|
|
# Qt install template
|
2015-11-14 14:47:14 +01:00
|
|
|
# $(1) = tool install directory
|
|
|
|
# $(2) = tool distribution URL
|
|
|
|
# $(3) = tool distribution .md5 URL
|
|
|
|
# $(4) = tool distribution file
|
2015-11-15 16:45:13 +01:00
|
|
|
# $(5) = Qt architecture
|
2015-11-14 14:47:14 +01:00
|
|
|
# $(6) = optional extra build recipes template
|
|
|
|
# $(7) = optional extra clean recipes template
|
2014-03-20 00:46:05 +01:00
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2015-11-15 16:45:13 +01:00
|
|
|
define QT_INSTALL_TEMPLATE
|
2014-03-20 00:46:05 +01:00
|
|
|
|
|
|
|
.PHONY: $(addprefix qt_sdk_, install clean distclean)
|
|
|
|
|
|
|
|
qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR)
|
2015-11-14 14:47:14 +01:00
|
|
|
$(call DOWNLOAD_TEMPLATE,$(2),$(4),"$(3)")
|
2015-11-15 16:45:13 +01:00
|
|
|
# Silently install Qt under tools directory
|
|
|
|
@$(ECHO) $(MSG_EXTRACTING) $(4) to $$(call toprel, $(1))
|
|
|
|
$(V1) ( export QT_INSTALL_TARGET_DIR=$(1) && \
|
|
|
|
chmod +x $(DL_DIR)/$(4) && \
|
|
|
|
$(DL_DIR)/$(4) --script $(ROOT_DIR)/make/tool_install/qt-install.qs ; \
|
|
|
|
)
|
2014-03-20 00:46:05 +01:00
|
|
|
# Execute post build templates
|
2015-11-14 14:47:14 +01:00
|
|
|
$(6)
|
2014-03-20 00:46:05 +01:00
|
|
|
|
|
|
|
qt_sdk_clean:
|
|
|
|
@$(ECHO) $(MSG_CLEANING) $$(call toprel, $(1))
|
|
|
|
$(V1) [ ! -d "$(1)" ] || $(RM) -rf "$(1)"
|
2015-11-14 14:47:14 +01:00
|
|
|
$(7)
|
2014-03-20 00:46:05 +01:00
|
|
|
|
|
|
|
qt_sdk_distclean:
|
2015-11-14 14:47:14 +01:00
|
|
|
@$(ECHO) $(MSG_DISTCLEANING) $$(call toprel, $(DL_DIR)/$(4))
|
|
|
|
$(V1) [ ! -f "$(DL_DIR)/$(4)" ] || $(RM) "$(DL_DIR)/$(4)"
|
|
|
|
$(V1) [ ! -f "$(DL_DIR)/$(4).md5" ] || $(RM) "$(DL_DIR)/$(4).md5"
|
2014-03-20 00:46:05 +01:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
2014-08-13 22:25:18 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Mac QT install template
|
2015-11-21 14:05:28 +01:00
|
|
|
# $(1) = tool install directory
|
|
|
|
# $(2) = tool distribution URL
|
|
|
|
# $(3) = tool distribution .md5 URL
|
|
|
|
# $(4) = tool distribution file
|
|
|
|
# $(5) = QT architecture
|
|
|
|
# $(6) = optional extra build recipes template
|
|
|
|
# $(7) = optional extra clean recipes template
|
2014-08-13 22:25:18 +02:00
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
define MAC_QT_INSTALL_TEMPLATE
|
|
|
|
|
|
|
|
.PHONY: $(addprefix qt_sdk_, install clean distclean)
|
|
|
|
|
|
|
|
qt_sdk_install: qt_sdk_clean | $(DL_DIR) $(TOOLS_DIR)
|
2015-11-21 14:05:28 +01:00
|
|
|
$(call DOWNLOAD_TEMPLATE,$(2),$(4),"$(3)")
|
2014-08-13 22:25:18 +02:00
|
|
|
# Mount .dmg file
|
2015-11-21 14:05:28 +01:00
|
|
|
$(V1) hdiutil attach -nobrowse $(DL_DIR)/$(4)
|
|
|
|
# Silently install Qt under tools directory
|
|
|
|
@$(ECHO) $(MSG_EXTRACTING) $(4) to $$(call toprel, $(1))
|
|
|
|
$(V1) ( export QT_INSTALL_TARGET_DIR=$(1) && \
|
2015-11-21 15:04:46 +01:00
|
|
|
$(QT_SDK_MAINTENANCE_TOOL) --script $(ROOT_DIR)/make/tool_install/qt-install.qs ; \
|
2015-11-21 14:05:28 +01:00
|
|
|
)
|
|
|
|
# Unmount the .dmg file
|
2014-08-13 22:25:18 +02:00
|
|
|
$(V1) hdiutil detach $(QT_SDK_MOUNT_DIR)
|
|
|
|
# Execute post build templates
|
2015-11-21 14:05:28 +01:00
|
|
|
$(6)
|
2015-07-31 11:20:09 +02:00
|
|
|
|
2014-08-13 22:25:18 +02:00
|
|
|
qt_sdk_clean:
|
|
|
|
@$(ECHO) $(MSG_CLEANING) $$(call toprel, $(1))
|
|
|
|
$(V1) [ ! -d "$(1)" ] || $(RM) -rf "$(1)"
|
2015-11-21 14:05:28 +01:00
|
|
|
$(7)
|
2014-08-13 22:25:18 +02:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
2013-04-10 17:23:01 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Qt SDK
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2013-04-22 01:43:53 +02:00
|
|
|
ifeq ($(UNAME), Windows)
|
|
|
|
|
2016-03-24 16:11:52 +01:00
|
|
|
QT_SDK_PREFIX := $(QT_SDK_DIR)/$(QT_SHORT_VERSION)/$(QT_SDK_ARCH)
|
2015-11-15 16:45:13 +01:00
|
|
|
$(eval $(call QT_INSTALL_TEMPLATE,$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH)))
|
2013-04-14 23:41:59 +02:00
|
|
|
|
2013-10-26 14:39:49 +02:00
|
|
|
else ifeq ($(UNAME), Linux)
|
2014-03-20 00:46:05 +01:00
|
|
|
|
2016-03-24 16:11:52 +01:00
|
|
|
QT_SDK_PREFIX := "$(QT_SDK_DIR)/$(QT_SHORT_VERSION)/$(QT_SDK_ARCH)"
|
2015-11-15 16:45:13 +01:00
|
|
|
$(eval $(call QT_INSTALL_TEMPLATE,$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH)))
|
2013-10-26 14:39:49 +02:00
|
|
|
|
2014-08-13 22:25:18 +02:00
|
|
|
else ifeq ($(UNAME), Darwin)
|
|
|
|
|
2016-03-24 16:11:52 +01:00
|
|
|
QT_SDK_PREFIX := "$(QT_SDK_DIR)/$(QT_SHORT_VERSION)/$(QT_SDK_ARCH)"
|
2015-11-21 14:05:28 +01:00
|
|
|
$(eval $(call MAC_QT_INSTALL_TEMPLATE,$(QT_SDK_DIR),$(QT_SDK_URL),$(QT_SDK_MD5_URL),$(notdir $(QT_SDK_URL)),$(QT_SDK_ARCH)))
|
2014-08-13 22:25:18 +02:00
|
|
|
|
2013-04-14 23:41:59 +02:00
|
|
|
else
|
|
|
|
|
2013-09-15 17:16:58 +02:00
|
|
|
QT_SDK_PREFIX := $(QT_SDK_DIR)
|
2013-11-02 14:02:34 +01:00
|
|
|
|
2013-04-14 23:41:59 +02:00
|
|
|
.PHONY: qt_sdk_install
|
|
|
|
qt_sdk_install:
|
2013-11-02 14:02:34 +01:00
|
|
|
@$(ECHO) $(MSG_NOTICE) --------------------------------------------------------
|
2016-03-24 15:01:26 +01:00
|
|
|
@$(ECHO) $(MSG_NOTICE) Please install native Qt 5.6.x SDK using package manager
|
2013-11-02 14:02:34 +01:00
|
|
|
@$(ECHO) $(MSG_NOTICE) --------------------------------------------------------
|
2013-04-14 23:41:59 +02:00
|
|
|
|
|
|
|
.PHONY: qt_sdk_clean
|
|
|
|
qt_sdk_clean:
|
|
|
|
|
|
|
|
.PHONY: qt_sdk_distclean
|
|
|
|
qt_sdk_distclean:
|
|
|
|
|
|
|
|
endif
|
2013-04-10 17:23:01 +02:00
|
|
|
|
|
|
|
ifeq ($(shell [ -d "$(QT_SDK_DIR)" ] && $(ECHO) "exists"), exists)
|
2013-09-15 17:16:58 +02:00
|
|
|
export QMAKE := $(QT_SDK_PREFIX)/bin/qmake
|
2013-04-10 17:23:01 +02:00
|
|
|
|
|
|
|
# set Qt library search path
|
|
|
|
ifeq ($(UNAME), Windows)
|
2013-09-15 17:16:58 +02:00
|
|
|
export PATH := $(QT_SDK_PREFIX)/bin:$(PATH)
|
2013-04-10 17:23:01 +02:00
|
|
|
else
|
|
|
|
export LD_LIBRARY_PATH := $(QT_SDK_DIR)/lib:$(LD_LIBRARY_PATH)
|
|
|
|
endif
|
|
|
|
else
|
2016-05-19 22:20:16 +02:00
|
|
|
OPT_QT := qt56
|
|
|
|
OPT_QT_ENV_SH := /opt/$(OPT_QT)/bin/$(OPT_QT)-env.sh
|
|
|
|
ifneq ($(wildcard $(OPT_QT_ENV_SH)),)
|
|
|
|
SHELL := /bin/bash
|
|
|
|
QMAKE := . $(OPT_QT_ENV_SH) && qmake
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
|
|
|
QMAKE := qmake
|
|
|
|
endif
|
2013-04-10 17:23:01 +02:00
|
|
|
endif
|
|
|
|
|
2013-04-10 20:56:43 +02:00
|
|
|
.PHONY: qt_sdk_version
|
|
|
|
qt_sdk_version:
|
2013-04-22 01:43:53 +02:00
|
|
|
-$(V1) $(QMAKE) --version | tail -1
|
2013-04-10 20:56:43 +02:00
|
|
|
|
2013-03-31 16:57:25 +02:00
|
|
|
##############################
|
|
|
|
#
|
2013-04-10 20:56:43 +02:00
|
|
|
# MinGW
|
2013-03-31 16:57:25 +02:00
|
|
|
#
|
|
|
|
##############################
|
2012-11-28 04:43:02 +01:00
|
|
|
|
2013-04-10 00:04:03 +02:00
|
|
|
ifeq ($(UNAME), Windows)
|
2012-11-28 04:43:02 +01:00
|
|
|
|
2013-04-10 00:04:03 +02:00
|
|
|
ifeq ($(shell [ -d "$(MINGW_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
# set MinGW binary and library paths (QTMINGW is used by qmake, do not rename)
|
|
|
|
export QTMINGW := $(MINGW_DIR)/bin
|
|
|
|
export PATH := $(QTMINGW):$(PATH)
|
2012-11-28 04:43:02 +01:00
|
|
|
else
|
2013-04-10 00:04:03 +02:00
|
|
|
# not installed, use host gcc compiler
|
2014-03-21 18:53:16 +01:00
|
|
|
# $(info $(EMPTY) WARNING $(call toprel, $(MINGW_DIR)) not found, using system PATH)
|
2012-11-28 04:43:02 +01:00
|
|
|
endif
|
2013-04-10 00:04:03 +02:00
|
|
|
|
2013-04-10 20:56:43 +02:00
|
|
|
.PHONY: mingw_version
|
2014-03-21 18:53:16 +01:00
|
|
|
mingw_version: gcc_version
|
2013-04-10 20:56:43 +02:00
|
|
|
|
2014-03-21 18:53:16 +01:00
|
|
|
endif
|
|
|
|
|
2013-04-10 00:04:03 +02:00
|
|
|
.PHONY: gcc_version
|
|
|
|
gcc_version:
|
2013-04-22 01:43:53 +02:00
|
|
|
-$(V1) gcc --version | head -n1
|
2013-04-10 00:04:03 +02:00
|
|
|
|
2016-07-11 22:48:47 +02:00
|
|
|
all_sdk_version: gcc_version
|
|
|
|
|
2013-04-10 00:04:03 +02:00
|
|
|
##############################
|
|
|
|
#
|
2013-04-10 20:56:43 +02:00
|
|
|
# Python
|
2013-04-10 00:04:03 +02:00
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2013-04-10 17:23:01 +02:00
|
|
|
ifeq ($(shell [ -d "$(PYTHON_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
export PYTHON := $(PYTHON_DIR)/python
|
|
|
|
export PATH := $(PYTHON_DIR):$(PATH)
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
2014-03-21 18:53:16 +01:00
|
|
|
# $(info $(EMPTY) WARNING $(call toprel, $(PYTHON_DIR)) not found, using system PATH)
|
2014-08-19 01:50:03 +02:00
|
|
|
ifeq ($(findstring Python 2,$(shell python --version 2>&1)), Python 2)
|
2014-08-16 23:59:37 +02:00
|
|
|
export PYTHON := python
|
|
|
|
else
|
2014-08-19 00:41:24 +02:00
|
|
|
export PYTHON := python2
|
2014-08-16 23:59:37 +02:00
|
|
|
endif
|
2013-04-10 17:23:01 +02:00
|
|
|
endif
|
2013-04-10 00:04:03 +02:00
|
|
|
|
2013-04-10 20:56:43 +02:00
|
|
|
.PHONY: python_version
|
|
|
|
python_version:
|
2013-04-22 01:43:53 +02:00
|
|
|
-$(V1) $(PYTHON) --version
|
2013-04-10 20:56:43 +02:00
|
|
|
|
2013-05-01 21:44:11 +02:00
|
|
|
##############################
|
|
|
|
#
|
2013-12-01 23:17:48 +01:00
|
|
|
# NSIS Unicode (Windows only)
|
2013-05-01 21:44:11 +02:00
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
ifeq ($(UNAME), Windows)
|
|
|
|
|
2014-04-29 02:02:51 +02:00
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,nsis,$(NSIS_DIR),$(NSIS_URL),,$(notdir $(NSIS_URL))))
|
2013-05-01 21:44:11 +02:00
|
|
|
|
|
|
|
ifeq ($(shell [ -d "$(NSIS_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
export NSIS := $(NSIS_DIR)/makensis
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
|
|
|
# $(info $(EMPTY) WARNING $(call toprel, $(NSIS_DIR)) not found (make nsis_install), using system PATH)
|
|
|
|
export NSIS ?= makensis
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: nsis_version
|
|
|
|
nsis_version:
|
|
|
|
-$(V1) $(NSIS) | head -n1
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2014-07-04 17:21:39 +02:00
|
|
|
##################################
|
|
|
|
#
|
|
|
|
# Mesa OpenGL DLL (Windows only)
|
|
|
|
#
|
|
|
|
##################################
|
|
|
|
|
|
|
|
ifeq ($(UNAME), Windows)
|
|
|
|
|
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,mesawin,$(MESAWIN_DIR),$(MESAWIN_URL),,$(notdir $(MESAWIN_URL))))
|
|
|
|
|
|
|
|
ifeq ($(shell [ -d "$(MESAWIN_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
export MESAWIN_DIR := $(MESAWIN_DIR)
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
|
|
|
#$(info $(EMPTY) WARNING $(call toprel, $(MESA_WIN_DIR)) not found (make mesawin_install), using system PATH)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: mesawin_version
|
|
|
|
mesawin_version:
|
|
|
|
-$(V1) $(ECHO) "MesaOpenGL vXX"
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2013-04-22 01:43:53 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Uncrustify
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
ifeq ($(UNAME), Windows)
|
|
|
|
|
2014-04-29 02:02:51 +02:00
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,uncrustify,$(UNCRUSTIFY_DIR),$(UNCRUSTIFY_URL),,$(notdir $(UNCRUSTIFY_URL))))
|
2013-04-22 01:43:53 +02:00
|
|
|
|
|
|
|
else # Linux or Mac
|
|
|
|
|
|
|
|
UNCRUSTIFY_BUILD_DIR := $(BUILD_DIR)/$(notdir $(UNCRUSTIFY_DIR))
|
|
|
|
|
|
|
|
define UNCRUSTIFY_BUILD_TEMPLATE
|
|
|
|
$(V1) ( \
|
|
|
|
$(ECHO) $(MSG_CONFIGURING) $(call toprel, $(UNCRUSTIFY_BUILD_DIR)) && \
|
|
|
|
cd $(UNCRUSTIFY_BUILD_DIR) && \
|
|
|
|
./configure --prefix="$(UNCRUSTIFY_DIR)" && \
|
|
|
|
$(ECHO) $(MSG_BUILDING) $(call toprel, $(UNCRUSTIFY_BUILD_DIR)) && \
|
2013-04-29 02:02:29 +02:00
|
|
|
$(MAKE) $(MAKE_SILENT) && \
|
2013-04-22 01:43:53 +02:00
|
|
|
$(ECHO) $(MSG_INSTALLING) $(call toprel, $(UNCRUSTIFY_DIR)) && \
|
2013-04-29 02:02:29 +02:00
|
|
|
$(MAKE) $(MAKE_SILENT) install-strip \
|
2013-04-22 01:43:53 +02:00
|
|
|
)
|
|
|
|
@$(ECHO) $(MSG_CLEANING) $(call toprel, $(UNCRUSTIFY_BUILD_DIR))
|
|
|
|
-$(V1) [ ! -d "$(UNCRUSTIFY_BUILD_DIR)" ] || $(RM) -rf "$(UNCRUSTIFY_BUILD_DIR)"
|
|
|
|
endef
|
|
|
|
|
|
|
|
define UNCRUSTIFY_CLEAN_TEMPLATE
|
|
|
|
-$(V1) [ ! -d "$(UNCRUSTIFY_DIR)" ] || $(RM) -rf "$(UNCRUSTIFY_DIR)"
|
|
|
|
endef
|
|
|
|
|
2014-04-29 02:02:51 +02:00
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,uncrustify,$(UNCRUSTIFY_BUILD_DIR),$(UNCRUSTIFY_URL),,$(notdir $(UNCRUSTIFY_URL)),$(UNCRUSTIFY_BUILD_TEMPLATE),$(UNCRUSTIFY_CLEAN_TEMPLATE)))
|
2013-04-22 01:43:53 +02:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(shell [ -d "$(UNCRUSTIFY_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
export UNCRUSTIFY := $(UNCRUSTIFY_DIR)/bin/uncrustify
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
|
|
|
# $(info $(EMPTY) WARNING $(call toprel, $(UNCRUSTIFY_DIR)) not found (make uncrustify_install), using system PATH)
|
|
|
|
export UNCRUSTIFY := uncrustify
|
|
|
|
endif
|
2013-04-10 20:56:43 +02:00
|
|
|
|
2013-04-22 01:43:53 +02:00
|
|
|
.PHONY: uncrustify_version
|
|
|
|
uncrustify_version:
|
|
|
|
-$(V1) $(UNCRUSTIFY) --version
|
2013-04-10 20:56:43 +02:00
|
|
|
|
2013-04-29 02:02:29 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Doxygen
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
ifeq ($(UNAME), Windows)
|
|
|
|
|
2014-04-29 02:02:51 +02:00
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,doxygen,$(DOXYGEN_DIR),$(DOXYGEN_URL),,$(notdir $(DOXYGEN_URL))))
|
2013-04-29 02:02:29 +02:00
|
|
|
|
|
|
|
else # Linux or Mac
|
|
|
|
|
|
|
|
DOXYGEN_BUILD_DIR := $(BUILD_DIR)/$(notdir $(DOXYGEN_DIR))
|
|
|
|
|
|
|
|
define DOXYGEN_BUILD_TEMPLATE
|
|
|
|
$(V1) ( \
|
|
|
|
$(ECHO) $(MSG_CONFIGURING) $(call toprel, $(DOXYGEN_BUILD_DIR)) && \
|
|
|
|
cd $(DOXYGEN_BUILD_DIR) && \
|
|
|
|
./configure --prefix "$(DOXYGEN_DIR)" --english-only && \
|
|
|
|
$(ECHO) $(MSG_BUILDING) $(call toprel, $(DOXYGEN_BUILD_DIR)) && \
|
|
|
|
$(MAKE) $(MAKE_SILENT) && \
|
|
|
|
$(ECHO) $(MSG_INSTALLING) $(call toprel, $(DOXYGEN_DIR)) && \
|
|
|
|
$(MAKE) $(MAKE_SILENT) install \
|
|
|
|
)
|
|
|
|
@$(ECHO) $(MSG_CLEANING) $(call toprel, $(DOXYGEN_BUILD_DIR))
|
|
|
|
-$(V1) [ ! -d "$(DOXYGEN_BUILD_DIR)" ] || $(RM) -rf "$(DOXYGEN_BUILD_DIR)"
|
|
|
|
endef
|
|
|
|
|
|
|
|
define DOXYGEN_CLEAN_TEMPLATE
|
|
|
|
-$(V1) [ ! -d "$(DOXYGEN_DIR)" ] || $(RM) -rf "$(DOXYGEN_DIR)"
|
|
|
|
endef
|
|
|
|
|
2014-04-29 02:02:51 +02:00
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,doxygen,$(DOXYGEN_BUILD_DIR),$(DOXYGEN_URL),,$(notdir $(DOXYGEN_URL)),$(DOXYGEN_BUILD_TEMPLATE),$(DOXYGEN_CLEAN_TEMPLATE)))
|
2013-04-29 02:02:29 +02:00
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(shell [ -d "$(DOXYGEN_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
export DOXYGEN := $(DOXYGEN_DIR)/bin/doxygen
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
|
|
|
# $(info $(EMPTY) WARNING $(call toprel, $(DOXYGEN_DIR)) not found (make doxygen_install), using system PATH)
|
|
|
|
export DOXYGEN := doxygen
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: doxygen_version
|
|
|
|
doxygen_version:
|
|
|
|
-$(V1) $(ECHO) "Doxygen `$(DOXYGEN) --version`"
|
|
|
|
|
2013-05-03 12:39:33 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# GoogleTest
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2014-04-29 02:02:51 +02:00
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,gtest,$(GTEST_DIR),$(GTEST_URL),,$(notdir $(GTEST_URL))))
|
2013-04-29 02:02:29 +02:00
|
|
|
|
2013-05-03 14:14:29 +02:00
|
|
|
export GTEST_DIR
|
|
|
|
|
2013-05-03 12:39:33 +02:00
|
|
|
.PHONY: gtest_version
|
|
|
|
gtest_version:
|
|
|
|
-$(V1) $(SED) -n "s/^PACKAGE_STRING='\(.*\)'/\1/p" < $(GTEST_DIR)/configure
|
2013-04-29 02:02:29 +02:00
|
|
|
|
2015-07-28 07:30:45 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# CCACHE
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
CCACHE_BUILD_DIR := $(BUILD_DIR)/ccache-3.2.2
|
2013-04-10 20:56:43 +02:00
|
|
|
|
2015-07-28 07:30:45 +02:00
|
|
|
define CCACHE_BUILD_TEMPLATE
|
|
|
|
$(V1) ( \
|
|
|
|
$(ECHO) $(MSG_CONFIGURING) $(call toprel, $(CCACHE_BUILD_DIR)) && \
|
|
|
|
cd $(CCACHE_BUILD_DIR) && \
|
|
|
|
./configure --prefix="$(CCACHE_DIR)" && \
|
|
|
|
$(ECHO) $(MSG_BUILDING) $(call toprel, $(CCACHE_BUILD_DIR)) && \
|
|
|
|
$(MAKE) $(MAKE_SILENT) && \
|
|
|
|
$(ECHO) $(MSG_INSTALLING) $(call toprel, $(CCACHE_DIR)) && \
|
|
|
|
$(MAKE) $(MAKE_SILENT) install \
|
|
|
|
)
|
|
|
|
@$(ECHO) $(MSG_CLEANING) $(call toprel, $(CCACHE_BUILD_DIR))
|
|
|
|
-$(V1) [ ! -d "$(CCACHE_BUILD_DIR)" ] || $(RM) -rf "$(CCACHE_BUILD_DIR)"
|
2015-07-31 11:20:09 +02:00
|
|
|
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) "Setting up CCACHE configuration:"
|
|
|
|
|
|
|
|
$(V1) [ -d "$(ROOT_DIR)/.ccache" ] || mkdir $(ROOT_DIR)/.ccache
|
|
|
|
$(V1) [ -d "$(CCACHE_DIR)/etc" ] || mkdir $(CCACHE_DIR)/etc
|
|
|
|
|
|
|
|
$(V1) $(ECHO) $(QUOTE)cache_dir = $(ROOT_DIR)/.ccache $(QUOTE) > $(CCACHE_DIR)/etc/ccache.conf
|
|
|
|
$(V1) $(ECHO) $(QUOTE)max_size = 250M$(QUOTE) >> $(CCACHE_DIR)/etc/ccache.conf
|
|
|
|
$(V1) $(CAT) $(CCACHE_DIR)/etc/ccache.conf
|
2015-07-28 07:30:45 +02:00
|
|
|
endef
|
2013-04-10 00:04:03 +02:00
|
|
|
|
2015-07-28 07:30:45 +02:00
|
|
|
define CCACHE_CLEAN_TEMPLATE
|
|
|
|
-$(V1) [ ! -d "$(CCACHE_DIR)" ] || $(RM) -rf "$(CCACHE_DIR)"
|
|
|
|
endef
|
2013-04-10 00:04:03 +02:00
|
|
|
|
2015-07-28 07:30:45 +02:00
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,ccache,$(CCACHE_BUILD_DIR),$(CCACHE_URL),$(CCACHE_MD5_URL),$(notdir $(CCACHE_URL)),$(CCACHE_BUILD_TEMPLATE),$(CCACHE_CLEAN_TEMPLATE)))
|
2013-04-10 00:04:03 +02:00
|
|
|
|
2015-07-17 22:55:25 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# osg
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2016-07-11 22:46:50 +02:00
|
|
|
ifneq ($(UNAME), Windows)
|
|
|
|
|
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,osg,$(OSG_SDK_DIR),$(OSG_URL),,$(notdir $(OSG_URL))))
|
|
|
|
|
|
|
|
endif
|
2015-07-17 22:55:25 +02:00
|
|
|
|
|
|
|
ifeq ($(shell [ -d "$(OSG_SDK_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
export OSG_SDK_DIR := $(OSG_SDK_DIR)
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
2016-08-14 13:25:56 +02:00
|
|
|
# $(info $(EMPTY) WARNING $(call toprel, $(OSG_SDK_DIR)) not found (make osg_install), using system PATH)
|
2015-07-17 22:55:25 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: osg_version
|
|
|
|
osg_version:
|
|
|
|
-$(V1) $(ECHO) "`$(OSG_SDK_DIR)/bin/osgversion`"
|
2016-01-07 21:36:17 +01:00
|
|
|
|
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# osgearth
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2016-07-11 22:46:50 +02:00
|
|
|
ifneq ($(UNAME), Windows)
|
|
|
|
|
|
|
|
$(eval $(call TOOL_INSTALL_TEMPLATE,osgearth,$(OSGEARTH_SDK_DIR),$(OSGEARTH_URL),,$(notdir $(OSGEARTH_URL))))
|
|
|
|
|
|
|
|
endif
|
2016-01-07 21:36:17 +01:00
|
|
|
|
|
|
|
ifeq ($(shell [ -d "$(OSGEARTH_SDK_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
export OSGEARTH_SDK_DIR := $(OSGEARTH_SDK_DIR)
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
2016-08-14 13:25:56 +02:00
|
|
|
# $(info $(EMPTY) WARNING $(call toprel, $(OSGEARTH_SDK_DIR)) not found (make osgearth_install), using system PATH)
|
2016-01-07 21:36:17 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: osgearth_version
|
|
|
|
osgearth_version:
|
|
|
|
-$(V1) $(ECHO) "`$(OSGEARTH_SDK_DIR)/bin/osgearth_version`"
|
2013-04-10 20:56:43 +02:00
|
|
|
|
2013-04-10 00:04:03 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# TODO: code below is not revised yet
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2012-11-28 04:43:02 +01:00
|
|
|
# Set up openocd tools
|
|
|
|
OPENOCD_DIR := $(TOOLS_DIR)/openocd
|
|
|
|
OPENOCD_WIN_DIR := $(TOOLS_DIR)/openocd_win
|
|
|
|
OPENOCD_BUILD_DIR := $(DL_DIR)/openocd-build
|
|
|
|
|
|
|
|
.PHONY: openocd_install
|
|
|
|
openocd_install: | $(DL_DIR) $(TOOLS_DIR)
|
|
|
|
openocd_install: OPENOCD_URL := http://sourceforge.net/projects/openocd/files/openocd/0.6.1/openocd-0.6.1.tar.bz2/download
|
|
|
|
openocd_install: OPENOCD_FILE := openocd-0.6.1.tar.bz2
|
|
|
|
openocd_install: openocd_clean
|
|
|
|
# download the source only if it's newer than what we already have
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(WGET) -N -P "$(DL_DIR)" --trust-server-name "$(OPENOCD_URL)"
|
2012-11-28 04:43:02 +01:00
|
|
|
|
|
|
|
# extract the source
|
|
|
|
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -r "$(OPENOCD_BUILD_DIR)"
|
|
|
|
$(V1) mkdir -p "$(OPENOCD_BUILD_DIR)"
|
|
|
|
$(V1) tar -C $(OPENOCD_BUILD_DIR) -xjf "$(DL_DIR)/$(OPENOCD_FILE)"
|
|
|
|
|
|
|
|
# apply patches
|
|
|
|
$(V0) @echo " PATCH $(OPENOCD_DIR)"
|
|
|
|
$(V1) ( \
|
|
|
|
cd $(OPENOCD_BUILD_DIR)/openocd-0.6.1 ; \
|
|
|
|
patch -p1 < $(ROOT_DIR)/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch ; \
|
|
|
|
patch -p1 < $(ROOT_DIR)/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
# build and install
|
|
|
|
$(V1) mkdir -p "$(OPENOCD_DIR)"
|
|
|
|
$(V1) ( \
|
|
|
|
cd $(OPENOCD_BUILD_DIR)/openocd-0.6.1 ; \
|
|
|
|
./configure --prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi --enable-stlink ; \
|
|
|
|
$(MAKE) --silent ; \
|
|
|
|
$(MAKE) --silent install ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
# delete the extracted source when we're done
|
|
|
|
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)"
|
|
|
|
|
|
|
|
.PHONY: ftd2xx_install
|
|
|
|
|
|
|
|
FTD2XX_DIR := $(DL_DIR)/ftd2xx
|
|
|
|
|
|
|
|
ftd2xx_install: | $(DL_DIR)
|
|
|
|
ftd2xx_install: FTD2XX_URL := http://www.ftdichip.com/Drivers/CDM/Beta/CDM20817.zip
|
|
|
|
ftd2xx_install: FTD2XX_FILE := CDM20817.zip
|
|
|
|
ftd2xx_install: ftd2xx_clean
|
|
|
|
# download the file only if it's newer than what we already have
|
|
|
|
$(V0) @echo " DOWNLOAD $(FTD2XX_URL)"
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(WGET) -q -N -P "$(DL_DIR)" "$(FTD2XX_URL)"
|
2012-11-28 04:43:02 +01:00
|
|
|
|
|
|
|
# extract the source
|
|
|
|
$(V0) @echo " EXTRACT $(FTD2XX_FILE) -> $(FTD2XX_DIR)"
|
|
|
|
$(V1) mkdir -p "$(FTD2XX_DIR)"
|
|
|
|
$(V1) unzip -q -d "$(FTD2XX_DIR)" "$(DL_DIR)/$(FTD2XX_FILE)"
|
|
|
|
|
|
|
|
.PHONY: ftd2xx_clean
|
|
|
|
ftd2xx_clean:
|
|
|
|
$(V0) @echo " CLEAN $(FTD2XX_DIR)"
|
|
|
|
$(V1) [ ! -d "$(FTD2XX_DIR)" ] || $(RM) -r "$(FTD2XX_DIR)"
|
|
|
|
|
|
|
|
.PHONY: ftd2xx_install
|
|
|
|
|
|
|
|
LIBUSB_WIN_DIR := $(DL_DIR)/libusb-win32-bin-1.2.6.0
|
|
|
|
|
|
|
|
libusb_win_install: | $(DL_DIR)
|
|
|
|
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
|
|
|
|
libusb_win_install: LIBUSB_WIN_FILE := libusb-win32-bin-1.2.6.0.zip
|
|
|
|
libusb_win_install: libusb_win_clean
|
|
|
|
# download the file only if it's newer than what we already have
|
|
|
|
$(V0) @echo " DOWNLOAD $(LIBUSB_WIN_URL)"
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(WGET) -q -N -P "$(DL_DIR)" --trust-server-name "$(LIBUSB_WIN_URL)"
|
2012-11-28 04:43:02 +01:00
|
|
|
|
|
|
|
# extract the source
|
|
|
|
$(V0) @echo " EXTRACT $(LIBUSB_WIN_FILE) -> $(LIBUSB_WIN_DIR)"
|
|
|
|
$(V1) mkdir -p "$(LIBUSB_WIN_DIR)"
|
|
|
|
$(V1) unzip -q -d "$(DL_DIR)" "$(DL_DIR)/$(LIBUSB_WIN_FILE)"
|
|
|
|
|
|
|
|
# fixup .h file needed by openocd build
|
|
|
|
$(V0) @echo " FIXUP $(LIBUSB_WIN_DIR)"
|
|
|
|
$(V1) ln -s "$(LIBUSB_WIN_DIR)/include/lusb0_usb.h" "$(LIBUSB_WIN_DIR)/include/usb.h"
|
|
|
|
|
|
|
|
.PHONY: libusb_win_clean
|
|
|
|
libusb_win_clean:
|
|
|
|
$(V0) @echo " CLEAN $(LIBUSB_WIN_DIR)"
|
|
|
|
$(V1) [ ! -d "$(LIBUSB_WIN_DIR)" ] || $(RM) -r "$(LIBUSB_WIN_DIR)"
|
|
|
|
|
|
|
|
.PHONY: openocd_git_win_install
|
|
|
|
|
|
|
|
openocd_git_win_install: | $(DL_DIR) $(TOOLS_DIR)
|
|
|
|
openocd_git_win_install: OPENOCD_URL := git://openocd.git.sourceforge.net/gitroot/openocd/openocd
|
|
|
|
openocd_git_win_install: OPENOCD_REV := f1c0133321c8fcadadd10bba5537c0a634eb183b
|
|
|
|
openocd_git_win_install: openocd_win_clean libusb_win_install ftd2xx_install
|
|
|
|
# download the source
|
|
|
|
$(V0) @echo " DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
|
|
|
|
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)"
|
|
|
|
$(V1) mkdir -p "$(OPENOCD_BUILD_DIR)"
|
|
|
|
$(V1) git clone --no-checkout $(OPENOCD_URL) "$(DL_DIR)/openocd-build"
|
|
|
|
$(V1) ( \
|
|
|
|
cd $(OPENOCD_BUILD_DIR) ; \
|
|
|
|
git checkout -q $(OPENOCD_REV) ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
# apply patches
|
|
|
|
$(V0) @echo " PATCH $(OPENOCD_BUILD_DIR)"
|
|
|
|
$(V1) ( \
|
|
|
|
cd $(OPENOCD_BUILD_DIR) ; \
|
|
|
|
git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch ; \
|
|
|
|
git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
# build and install
|
|
|
|
$(V0) @echo " BUILD $(OPENOCD_WIN_DIR)"
|
|
|
|
$(V1) mkdir -p "$(OPENOCD_WIN_DIR)"
|
|
|
|
$(V1) ( \
|
|
|
|
cd $(OPENOCD_BUILD_DIR) ; \
|
|
|
|
./bootstrap ; \
|
|
|
|
./configure --enable-maintainer-mode --prefix="$(OPENOCD_WIN_DIR)" \
|
|
|
|
--build=i686-pc-linux-gnu --host=i586-mingw32msvc \
|
|
|
|
CPPFLAGS=-I$(LIBUSB_WIN_DIR)/include \
|
|
|
|
LDFLAGS=-L$(LIBUSB_WIN_DIR)/lib/gcc \
|
|
|
|
--enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=$(FTD2XX_DIR) \
|
|
|
|
--disable-werror \
|
|
|
|
--enable-stlink ; \
|
|
|
|
$(MAKE) ; \
|
|
|
|
$(MAKE) install ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
# delete the extracted source when we're done
|
|
|
|
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)"
|
|
|
|
|
|
|
|
.PHONY: openocd_win_clean
|
|
|
|
openocd_win_clean:
|
|
|
|
$(V0) @echo " CLEAN $(OPENOCD_WIN_DIR)"
|
|
|
|
$(V1) [ ! -d "$(OPENOCD_WIN_DIR)" ] || $(RM) -r "$(OPENOCD_WIN_DIR)"
|
|
|
|
|
|
|
|
.PHONY: openocd_git_install
|
|
|
|
|
|
|
|
openocd_git_install: | $(DL_DIR) $(TOOLS_DIR)
|
|
|
|
openocd_git_install: OPENOCD_URL := git://openocd.git.sourceforge.net/gitroot/openocd/openocd
|
|
|
|
openocd_git_install: OPENOCD_REV := f1c0133321c8fcadadd10bba5537c0a634eb183b
|
|
|
|
openocd_git_install: openocd_clean
|
|
|
|
# download the source
|
|
|
|
$(V0) @echo " DOWNLOAD $(OPENOCD_URL) @ $(OPENOCD_REV)"
|
|
|
|
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)"
|
|
|
|
$(V1) mkdir -p "$(OPENOCD_BUILD_DIR)"
|
|
|
|
$(V1) git clone --no-checkout $(OPENOCD_URL) "$(OPENOCD_BUILD_DIR)"
|
|
|
|
$(V1) ( \
|
|
|
|
cd $(OPENOCD_BUILD_DIR) ; \
|
|
|
|
git checkout -q $(OPENOCD_REV) ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
# apply patches
|
|
|
|
$(V0) @echo " PATCH $(OPENOCD_DIR)"
|
|
|
|
$(V1) ( \
|
|
|
|
cd $(OPENOCD_BUILD_DIR) ; \
|
|
|
|
git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0001-armv7m-remove-dummy-FP-regs-for-new-gdb.patch ; \
|
|
|
|
git apply < $(ROOT_DIR)/flight/Project/OpenOCD/0002-rtos-add-stm32_stlink-to-FreeRTOS-targets.patch ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
# build and install
|
|
|
|
$(V0) @echo " BUILD $(OPENOCD_DIR)"
|
|
|
|
$(V1) mkdir -p "$(OPENOCD_DIR)"
|
|
|
|
$(V1) ( \
|
|
|
|
cd $(OPENOCD_BUILD_DIR) ; \
|
|
|
|
./bootstrap ; \
|
|
|
|
./configure --enable-maintainer-mode --prefix="$(OPENOCD_DIR)" --enable-ft2232_libftdi --enable-buspirate --enable-stlink ; \
|
|
|
|
$(MAKE) ; \
|
|
|
|
$(MAKE) install ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
# delete the extracted source when we're done
|
|
|
|
$(V1) [ ! -d "$(OPENOCD_BUILD_DIR)" ] || $(RM) -rf "$(OPENOCD_BUILD_DIR)"
|
|
|
|
|
|
|
|
.PHONY: openocd_clean
|
|
|
|
openocd_clean:
|
|
|
|
$(V0) @echo " CLEAN $(OPENOCD_DIR)"
|
|
|
|
$(V1) [ ! -d "$(OPENOCD_DIR)" ] || $(RM) -r "$(OPENOCD_DIR)"
|
|
|
|
|
|
|
|
STM32FLASH_DIR := $(TOOLS_DIR)/stm32flash
|
2014-09-01 14:51:43 +02:00
|
|
|
ifeq ($(UNAME), Windows)
|
|
|
|
STM32FLASH_BUILD_OPTIONS := "CC=GCC"
|
|
|
|
endif
|
2012-11-28 04:43:02 +01:00
|
|
|
.PHONY: stm32flash_install
|
2014-08-29 21:13:13 +02:00
|
|
|
stm32flash_install: STM32FLASH_URL := https://code.google.com/p/stm32flash/
|
|
|
|
stm32flash_install: STM32FLASH_REV := a358bd1f025d
|
2012-11-28 04:43:02 +01:00
|
|
|
stm32flash_install: stm32flash_clean
|
|
|
|
# download the source
|
2014-09-08 14:39:41 +02:00
|
|
|
$(V0) @$(ECHO) " DOWNLOAD $(STM32FLASH_URL) @ r$(STM32FLASH_REV)"
|
2014-08-29 21:13:13 +02:00
|
|
|
$(V1) [ ! -d "$(STM32FLASH_DIR)" ] || $(RM) -rf "$(STM32FLASH_DIR)"
|
2014-09-08 14:39:41 +02:00
|
|
|
$(V1) $(MKDIR) -p "$(STM32FLASH_DIR)"
|
|
|
|
$(V1) $(GIT) clone --no-checkout $(STM32FLASH_URL) "$(STM32FLASH_DIR)"
|
2014-08-29 21:13:13 +02:00
|
|
|
$(V1) ( \
|
2014-09-08 14:39:41 +02:00
|
|
|
$(CD) $(STM32FLASH_DIR) ; \
|
|
|
|
$(GIT) checkout -q $(STM32FLASH_REV) ; \
|
2014-08-29 21:13:13 +02:00
|
|
|
)
|
2012-11-28 04:43:02 +01:00
|
|
|
# build
|
2014-09-08 14:39:41 +02:00
|
|
|
$(V0) @$(ECHO) " BUILD $(STM32FLASH_DIR)"
|
2015-07-31 11:20:09 +02:00
|
|
|
$(V1) $(MAKE) --silent -C $(STM32FLASH_DIR) all $(STM32FLASH_BUILD_OPTIONS)
|
2012-11-28 04:43:02 +01:00
|
|
|
|
|
|
|
.PHONY: stm32flash_clean
|
|
|
|
stm32flash_clean:
|
2014-09-08 14:39:41 +02:00
|
|
|
$(V0) @$(ECHO) " CLEAN $(STM32FLASH_DIR)"
|
2014-09-01 14:51:43 +02:00
|
|
|
$(V1) [ ! -d "$(STM32FLASH_DIR)" ] || $(RM) -rf "$(STM32FLASH_DIR)"
|
2012-11-28 04:43:02 +01:00
|
|
|
|
|
|
|
DFUUTIL_DIR := $(TOOLS_DIR)/dfu-util
|
|
|
|
|
|
|
|
.PHONY: dfuutil_install
|
2015-01-19 23:59:44 +01:00
|
|
|
dfuutil_install: DFUUTIL_URL := http://dfu-util.sourceforge.net/releases/dfu-util-0.8.tar.gz
|
2012-11-28 04:43:02 +01:00
|
|
|
dfuutil_install: DFUUTIL_FILE := $(notdir $(DFUUTIL_URL))
|
|
|
|
dfuutil_install: | $(DL_DIR) $(TOOLS_DIR)
|
|
|
|
dfuutil_install: dfuutil_clean
|
|
|
|
# download the source
|
|
|
|
$(V0) @echo " DOWNLOAD $(DFUUTIL_URL)"
|
2015-01-19 23:59:44 +01:00
|
|
|
$(V1) $(CURL) $(CURL_OPTIONS) -o "$(DL_DIR)/$(DFUUTIL_FILE)" "$(DFUUTIL_URL)"
|
2012-11-28 04:43:02 +01:00
|
|
|
|
|
|
|
# extract the source
|
|
|
|
$(V0) @echo " EXTRACT $(DFUUTIL_FILE)"
|
|
|
|
$(V1) [ ! -d "$(DL_DIR)/dfuutil-build" ] || $(RM) -r "$(DL_DIR)/dfuutil-build"
|
|
|
|
$(V1) mkdir -p "$(DL_DIR)/dfuutil-build"
|
|
|
|
$(V1) tar -C $(DL_DIR)/dfuutil-build -xf "$(DL_DIR)/$(DFUUTIL_FILE)"
|
|
|
|
|
|
|
|
# build
|
|
|
|
$(V0) @echo " BUILD $(DFUUTIL_DIR)"
|
|
|
|
$(V1) mkdir -p "$(DFUUTIL_DIR)"
|
|
|
|
$(V1) ( \
|
2015-01-19 23:59:44 +01:00
|
|
|
cd $(DL_DIR)/dfuutil-build/dfu-util-0.8 ; \
|
2012-11-28 04:43:02 +01:00
|
|
|
./configure --prefix="$(DFUUTIL_DIR)" ; \
|
|
|
|
$(MAKE) ; \
|
|
|
|
$(MAKE) install ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
.PHONY: dfuutil_clean
|
|
|
|
dfuutil_clean:
|
|
|
|
$(V0) @echo " CLEAN $(DFUUTIL_DIR)"
|
|
|
|
$(V1) [ ! -d "$(DFUUTIL_DIR)" ] || $(RM) -r "$(DFUUTIL_DIR)"
|
|
|
|
|
|
|
|
# see http://developer.android.com/sdk/ for latest versions
|
|
|
|
ANDROID_SDK_DIR := $(TOOLS_DIR)/android-sdk-linux
|
|
|
|
.PHONY: android_sdk_install
|
|
|
|
android_sdk_install: ANDROID_SDK_URL := http://dl.google.com/android/android-sdk_r20.0.3-linux.tgz
|
|
|
|
android_sdk_install: ANDROID_SDK_FILE := $(notdir $(ANDROID_SDK_URL))
|
|
|
|
# order-only prereq on directory existance:
|
|
|
|
android_sdk_install: | $(DL_DIR) $(TOOLS_DIR)
|
|
|
|
android_sdk_install: android_sdk_clean
|
|
|
|
# download the source only if it's newer than what we already have
|
|
|
|
$(V0) @echo " DOWNLOAD $(ANDROID_SDK_URL)"
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(WGET) --no-check-certificate -N -P "$(DL_DIR)" "$(ANDROID_SDK_URL)"
|
2012-11-28 04:43:02 +01:00
|
|
|
|
|
|
|
# binary only release so just extract it
|
|
|
|
$(V0) @echo " EXTRACT $(ANDROID_SDK_FILE)"
|
|
|
|
$(V1) tar -C $(TOOLS_DIR) -xf "$(DL_DIR)/$(ANDROID_SDK_FILE)"
|
|
|
|
|
|
|
|
.PHONY: android_sdk_clean
|
|
|
|
android_sdk_clean:
|
|
|
|
$(V0) @echo " CLEAN $(ANDROID_SDK_DIR)"
|
|
|
|
$(V1) [ ! -d "$(ANDROID_SDK_DIR)" ] || $(RM) -r $(ANDROID_SDK_DIR)
|
|
|
|
|
|
|
|
.PHONY: android_sdk_update
|
|
|
|
android_sdk_update:
|
|
|
|
$(V0) @echo " UPDATE $(ANDROID_SDK_DIR)"
|
|
|
|
$(ANDROID_SDK_DIR)/tools/android update sdk --no-ui -t platform-tools,android-16,addon-google_apis-google-16
|
|
|
|
|
2014-01-13 12:24:23 +01:00
|
|
|
#Install git hooks under the right folder
|
2014-01-14 09:42:04 +01:00
|
|
|
|
2014-01-13 12:24:23 +01:00
|
|
|
.PHONY: prepare
|
|
|
|
prepare:
|
2014-01-14 09:42:04 +01:00
|
|
|
$(V0) @echo " Configuring GIT commit template"
|
|
|
|
$(V1) $(CD) "$(ROOT_DIR)"
|
|
|
|
$(V1) $(GIT) config commit.template .commit-template
|
|
|
|
|
|
|
|
.PHONY: prepare_clean
|
|
|
|
prepare_clean:
|
|
|
|
$(V0) @echo " Cleanup GIT commit template configuration"
|
|
|
|
$(V1) $(CD) "$(ROOT_DIR)"
|
2015-07-31 11:20:09 +02:00
|
|
|
$(V1) $(GIT) config --unset commit.template
|
2013-03-31 20:52:58 +02:00
|
|
|
|
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# TODO: these defines will go to tool install sections
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
ifeq ($(shell [ -d "$(OPENOCD_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
export OPENOCD := $(OPENOCD_DIR)/bin/openocd
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
|
|
|
export OPENOCD ?= openocd
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(shell [ -d "$(ANDROID_SDK_DIR)" ] && $(ECHO) "exists"), exists)
|
|
|
|
ANDROID := $(ANDROID_SDK_DIR)/tools/android
|
|
|
|
ANDROID_DX := $(ANDROID_SDK_DIR)/platform-tools/dx
|
|
|
|
else
|
|
|
|
# not installed, hope it's in the path...
|
|
|
|
ANDROID ?= android
|
|
|
|
ANDROID_DX ?= dx
|
|
|
|
endif
|