2013-03-11 20:54:36 +01:00
|
|
|
#
|
|
|
|
# Top level Makefile for the OpenPilot project build system.
|
|
|
|
# Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
|
2013-04-10 00:04:03 +02:00
|
|
|
# Use 'make help' for instructions.
|
2013-03-11 20:54:36 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
2013-03-11 22:36:26 +01:00
|
|
|
# This top level Makefile passes down some variables to sub-makes through
|
|
|
|
# the environment. They are explicitly exported using the export keyword.
|
|
|
|
# Lower level makefiles assume that these variables are defined. To ensure
|
|
|
|
# that a special magic variable is exported here. It must be checked for
|
|
|
|
# existance by each sub-make.
|
2015-07-13 17:12:10 +02:00
|
|
|
export TOP_LEVEL_MAKEFILE := TRUE
|
2013-03-11 22:36:26 +01:00
|
|
|
|
2013-04-04 22:57:43 +02:00
|
|
|
# It is possible to set OPENPILOT_DL_DIR and/or OPENPILOT_TOOLS_DIR environment
|
|
|
|
# variables to override local tools download and installation directorys. So the
|
|
|
|
# same toolchains can be used for all working copies. Particularly useful for CI
|
|
|
|
# server build agents, but also for local installations.
|
|
|
|
#
|
|
|
|
# If no OPENPILOT_* variables found, makefile internal DL_DIR and TOOLS_DIR paths
|
|
|
|
# will be used. They still can be overriden by the make command line parameters:
|
|
|
|
# make DL_DIR=/path/to/download/directory TOOLS_DIR=/path/to/tools/directory targets...
|
|
|
|
|
2013-04-04 23:42:56 +02:00
|
|
|
# Function for converting Windows style slashes into Unix style
|
|
|
|
slashfix = $(subst \,/,$(1))
|
|
|
|
|
|
|
|
# Function for converting an absolute path to one relative
|
|
|
|
# to the top of the source tree
|
|
|
|
toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1)))
|
|
|
|
|
2011-02-23 05:18:56 +01:00
|
|
|
# Set up some macros for common directories within the tree
|
2013-03-21 22:11:30 +01:00
|
|
|
export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
2013-04-04 23:42:56 +02:00
|
|
|
export DL_DIR := $(if $(OPENPILOT_DL_DIR),$(call slashfix,$(OPENPILOT_DL_DIR)),$(ROOT_DIR)/downloads)
|
|
|
|
export TOOLS_DIR := $(if $(OPENPILOT_TOOLS_DIR),$(call slashfix,$(OPENPILOT_TOOLS_DIR)),$(ROOT_DIR)/tools)
|
2013-03-21 22:11:30 +01:00
|
|
|
export BUILD_DIR := $(ROOT_DIR)/build
|
|
|
|
export PACKAGE_DIR := $(ROOT_DIR)/build/package
|
2014-12-04 09:32:05 +01:00
|
|
|
export DIST_DIR := $(ROOT_DIR)/build/dist
|
2013-03-11 20:54:36 +01:00
|
|
|
|
2015-04-01 04:06:04 +02:00
|
|
|
DIRS = $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR)
|
|
|
|
|
2015-06-23 22:38:11 +02:00
|
|
|
# Function to convert to all lowercase
|
|
|
|
lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
|
|
|
|
# Function to make all lowercase and replace spaces with -
|
|
|
|
EMPTY :=
|
|
|
|
SPACE := $(EMPTY) $(EMPTY)
|
|
|
|
smallify = $(subst $(SPACE),-,$(call lc,$1))
|
|
|
|
|
2015-05-18 19:03:11 +02:00
|
|
|
# Naming for binaries and packaging etc,.
|
2015-07-12 18:15:53 +02:00
|
|
|
ORG_BIG_NAME := LibrePilot
|
|
|
|
GCS_BIG_NAME := ${ORG_BIG_NAME} GCS
|
2015-05-18 19:03:11 +02:00
|
|
|
# These should be lowercase with no spaces
|
2015-07-12 18:15:53 +02:00
|
|
|
ORG_SMALL_NAME := $(call smallify,$(ORG_BIG_NAME))
|
2015-06-23 22:38:11 +02:00
|
|
|
GCS_SMALL_NAME := $(call smallify,$(GCS_BIG_NAME))
|
2015-05-18 19:03:11 +02:00
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
# Set up default build configurations (debug | release)
|
2013-03-19 23:48:02 +01:00
|
|
|
GCS_BUILD_CONF := release
|
|
|
|
GOOGLE_API_VERSION := 14
|
2011-02-23 05:18:56 +01:00
|
|
|
|
2011-04-25 00:21:26 +02:00
|
|
|
# Clean out undesirable variables from the environment and command-line
|
|
|
|
# to remove the chance that they will cause problems with our build
|
|
|
|
define SANITIZE_VAR
|
|
|
|
$(if $(filter-out undefined,$(origin $(1))),
|
2013-03-31 16:57:25 +02:00
|
|
|
$(info $(EMPTY) NOTE Sanitized $(2) variable '$(1)' from $(origin $(1)))
|
2013-03-11 20:54:36 +01:00
|
|
|
MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES))
|
|
|
|
override $(1) :=
|
|
|
|
unexport $(1)
|
2011-04-25 00:21:26 +02:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2014-10-29 04:20:48 +01:00
|
|
|
# These specific variables can influence compilation in unexpected (and undesirable) ways
|
|
|
|
# gcc flags
|
2011-04-25 00:21:26 +02:00
|
|
|
SANITIZE_GCC_VARS := TMPDIR GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH
|
2014-10-29 04:20:48 +01:00
|
|
|
# preprocessor flags
|
|
|
|
SANITIZE_GCC_VARS += CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH DEPENDENCIES_OUTPUT
|
|
|
|
# make flags
|
2014-10-29 06:11:13 +01:00
|
|
|
SANITIZE_GCC_VARS += CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LDLIBS
|
2011-04-25 00:21:26 +02:00
|
|
|
$(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowed)))
|
|
|
|
|
|
|
|
# These specific variables used to be valid but now they make no sense
|
2013-04-12 16:03:32 +02:00
|
|
|
SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER CLEAN_BUILD
|
2011-04-25 00:21:26 +02:00
|
|
|
$(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated)))
|
|
|
|
|
2014-12-05 10:47:35 +01:00
|
|
|
# Make sure this isn't being run as root unless installing (no whoami on Windows, but that is ok here)
|
2013-03-11 20:54:36 +01:00
|
|
|
ifeq ($(shell whoami 2>/dev/null),root)
|
2015-01-31 03:38:12 +01:00
|
|
|
ifeq ($(filter install,$(MAKECMDGOALS)),)
|
|
|
|
ifndef FAKEROOTKEY
|
|
|
|
$(error You should not be running this as root)
|
|
|
|
endif
|
2014-12-05 10:47:35 +01:00
|
|
|
endif
|
2012-12-16 01:32:38 +01:00
|
|
|
endif
|
|
|
|
|
2012-11-28 04:43:02 +01:00
|
|
|
# Decide on a verbosity level based on the V= parameter
|
|
|
|
export AT := @
|
|
|
|
ifndef V
|
2013-03-11 20:54:36 +01:00
|
|
|
export V0 :=
|
|
|
|
export V1 := $(AT)
|
2012-11-28 04:43:02 +01:00
|
|
|
else ifeq ($(V), 0)
|
2013-03-11 20:54:36 +01:00
|
|
|
export V0 := $(AT)
|
|
|
|
export V1 := $(AT)
|
2012-11-28 04:43:02 +01:00
|
|
|
else ifeq ($(V), 1)
|
|
|
|
endif
|
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
# Make sure we know few things about the architecture before including
|
2012-12-16 06:18:07 +01:00
|
|
|
# the tools.mk to ensure that we download/install the right tools.
|
|
|
|
UNAME := $(shell uname)
|
2013-03-11 20:54:36 +01:00
|
|
|
ARCH := $(shell uname -m)
|
2013-04-10 00:04:03 +02:00
|
|
|
# Here and everywhere if not Linux or Mac then assume Windows
|
2013-03-11 20:54:36 +01:00
|
|
|
ifeq ($(filter Linux Darwin, $(UNAME)), )
|
|
|
|
UNAME := Windows
|
|
|
|
endif
|
2012-12-16 06:18:07 +01:00
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
# Include tools installers
|
2012-11-28 04:43:02 +01:00
|
|
|
include $(ROOT_DIR)/make/tools.mk
|
|
|
|
|
2015-04-09 21:11:15 +02:00
|
|
|
# Include third party builders if available
|
|
|
|
-include $(ROOT_DIR)/make/3rdparty/3rdparty.mk
|
2015-04-05 18:51:56 +02:00
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
# We almost need to consider autoconf/automake instead of this
|
|
|
|
ifeq ($(UNAME), Linux)
|
|
|
|
QT_SPEC = linux-g++
|
2015-05-10 11:46:00 +02:00
|
|
|
UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
|
2013-03-11 20:54:36 +01:00
|
|
|
else ifeq ($(UNAME), Darwin)
|
|
|
|
QT_SPEC = macx-g++
|
2015-05-10 11:46:00 +02:00
|
|
|
UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
|
2013-04-10 00:04:03 +02:00
|
|
|
else ifeq ($(UNAME), Windows)
|
2013-03-11 20:54:36 +01:00
|
|
|
QT_SPEC = win32-g++
|
2015-05-17 15:06:27 +02:00
|
|
|
UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator.exe
|
2013-03-11 20:54:36 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# All targets
|
|
|
|
#
|
|
|
|
##############################
|
2011-02-23 05:18:56 +01:00
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: uavobjects all_ground all_flight
|
|
|
|
|
|
|
|
.PHONY: all_clean
|
|
|
|
all_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR))"
|
|
|
|
$(V1) [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)"
|
2011-02-23 05:18:56 +01:00
|
|
|
|
2015-01-29 21:42:07 +01:00
|
|
|
.PONY: clean
|
|
|
|
clean: all_clean
|
|
|
|
|
2015-01-30 22:56:17 +01:00
|
|
|
|
2011-02-23 05:18:56 +01:00
|
|
|
##############################
|
|
|
|
#
|
2013-03-11 20:54:36 +01:00
|
|
|
# UAVObjects
|
2011-02-23 05:18:56 +01:00
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2015-04-01 04:06:04 +02:00
|
|
|
UAVOBJGENERATOR_DIR = $(BUILD_DIR)/uavobjgenerator
|
|
|
|
DIRS += $(UAVOBJGENERATOR_DIR)
|
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
.PHONY: uavobjgenerator
|
2015-05-10 11:25:50 +02:00
|
|
|
uavobjgenerator $(UAVOBJGENERATOR): | $(UAVOBJGENERATOR_DIR)
|
2015-04-20 23:20:13 +02:00
|
|
|
$(V1) cd $(UAVOBJGENERATOR_DIR) && \
|
2015-05-10 11:25:50 +02:00
|
|
|
( [ -f Makefile ] || $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro \
|
|
|
|
-spec $(QT_SPEC) CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) ) && \
|
2015-04-20 23:20:13 +02:00
|
|
|
$(MAKE) --no-print-directory -w
|
2011-02-23 05:18:56 +01:00
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
UAVOBJ_TARGETS := gcs flight python matlab java wireshark
|
2011-02-23 05:18:56 +01:00
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
.PHONY: uavobjects
|
|
|
|
uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
|
|
|
|
|
|
|
|
UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
|
|
|
|
UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
|
|
|
|
|
2015-05-17 15:06:27 +02:00
|
|
|
uavobjects_%: uavobjgenerator
|
2015-04-24 06:18:24 +02:00
|
|
|
@$(MKDIR) -p $(UAVOBJ_OUT_DIR)/$*
|
|
|
|
$(V1) ( cd $(UAVOBJ_OUT_DIR)/$* && \
|
2013-03-11 20:54:36 +01:00
|
|
|
$(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
|
|
|
|
)
|
|
|
|
|
2015-05-17 15:06:27 +02:00
|
|
|
uavobjects_test: uavobjgenerator
|
2015-04-24 06:18:24 +02:00
|
|
|
$(V1) $(UAVOBJGENERATOR) -v $(UAVOBJ_XML_DIR) $(ROOT_DIR)
|
2013-03-11 20:54:36 +01:00
|
|
|
|
|
|
|
uavobjects_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(UAVOBJ_OUT_DIR))"
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)"
|
2012-10-06 00:47:10 +02:00
|
|
|
|
2011-02-23 05:18:56 +01:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Flight related components
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2012-11-28 04:32:51 +01:00
|
|
|
# Define some pointers to the various important pieces of the flight code
|
|
|
|
# to prevent these being repeated in every sub makefile
|
2013-04-25 00:01:19 +02:00
|
|
|
export PIOS := $(ROOT_DIR)/flight/pios
|
2013-04-24 23:24:38 +02:00
|
|
|
export FLIGHTLIB := $(ROOT_DIR)/flight/libraries
|
|
|
|
export OPMODULEDIR := $(ROOT_DIR)/flight/modules
|
2013-04-16 23:44:06 +02:00
|
|
|
export OPUAVOBJ := $(ROOT_DIR)/flight/uavobjects
|
|
|
|
export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
|
2013-03-11 22:36:26 +01:00
|
|
|
export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
|
2013-03-30 16:33:38 +01:00
|
|
|
export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
|
2012-11-28 04:32:51 +01:00
|
|
|
|
2015-04-01 04:06:04 +02:00
|
|
|
DIRS += $(OPGCSSYNTHDIR)
|
|
|
|
|
2013-03-18 19:24:50 +01:00
|
|
|
# Define supported board lists
|
2014-10-24 01:44:53 +02:00
|
|
|
ALL_BOARDS := oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum revonano
|
2013-03-18 19:24:50 +01:00
|
|
|
|
|
|
|
# Short names of each board (used to display board name in parallel builds)
|
2013-04-12 23:24:30 +02:00
|
|
|
oplinkmini_short := 'oplm'
|
2013-04-14 01:34:43 +02:00
|
|
|
revolution_short := 'revo'
|
2013-03-18 19:24:50 +01:00
|
|
|
osd_short := 'osd '
|
2013-04-23 23:57:33 +02:00
|
|
|
revoproto_short := 'revp'
|
2014-10-24 01:44:53 +02:00
|
|
|
revonano_short := 'revn'
|
Final step: lot of small fixes, last commit in this commit series
This is the first cleanup pass through makefiles and pios.
Probably it is difficult to track changes due to the nature of them.
I would recommend to look at resulting files and compiled code instead.
NOTE: original branch was rebased and lot of conflicts were fixed on
the way. So do not expect that every commit in this series will be
buildable (unlike original branch). Only final result was tested.
The main goal was to remove as much duplication of code (and copy/paste
errors) as possible, moving common parts out of Makefiles. It still is
not perfect, and mostly no code changes made - Makefiles and #ifdefs only.
But please while testing make sure that all code works as before, and no
modules/options are missed by accident.
Brief list of changes:
- Moved common parts of Makefiles into the set of *.mk files.
- Changed method of passing common vars from top Makefile to lower ones.
- Some pios cleanup, mostly #ifdefs, and all pios_config.h files.
- Many obsolete files removed (for instance, AHRS files, op_config.h).
- Many obsolete or unused macros removed or fixed/renamed (ALL_DIGNOSTICS).
- Unified pios_config.h template. Please don't remove lines for board
configs, only comment/uncomment them. Adding new PIOS options, please
propagate them to all board files keeping the same order.
- Some formatting, spacing, indentation (no line endings change yet).
- Some cosmetic fixes (no more C:\X\Y\filename.c printings on Windows).
- Added some library.mk files to move libs into AR achives later.
- EntireFlash target now uses cross-platform python script to generate bin
files. So it works on all supported platforms: Linux, OSX, Windows.
- Top level packaging is completely rewritten. Now it is a part of top
Makefile. As such, all dependencies are checked and accounted, no
more 'make -j' problems should occur.
- Default GCS_BUILD_CONF is release now, may be changed if necessary
using 'make GCS_BUILD_CONF=debug gcs'.
- GCS build paths are separated into debug and release, so no more obj
file clashes. Packaging system supports only release builds.
- New target is introduced: 'clean_package'. Now 'make package' does not
clean build directory. Use clean_package instead for distributable builds.
- Targets like 'all', 'opfw_resource', etc now will print extra contex
in parallel builds too.
- If any of 'package', 'clean_package', 'opfw_resource' targets are given
on command line, GCS build will depend on the resource, so all fw_*.opfw
targets will be built and embedded into GCS. By default GCS does not
depend on resource, and will be built w/o firmware (unless the resource
files already exist and the Qt resource file is generated).
- fw_simposix (ELF executable) is now packaged for linux. Run'n'play!
- Make help is refined and is now up to date.
Still broken:
- UnitTests, should be fixed
- SimPosix: buildable, but should be reworked.
Next planned passes to do:
- toolchain bootstrapping and packaging (including windows - WIP)
- CMSIS/StdPeriph lib cleanup
- more PIOS cleanup
- move libs into AR archives to save build time
- sim targets refactir and cleanup
- move android-related directories under <top>/android
- unit test targets fix
- source code line ending changes (there are many different, were not changed)
- coding style
Merging this, please use --no-ff git option to make it the real commit point
Conflicts:
A lot of... :-)
2013-03-24 12:02:08 +01:00
|
|
|
simposix_short := 'posx'
|
2013-05-31 11:39:49 +02:00
|
|
|
discoveryf4bare_short := 'df4b'
|
2015-04-01 00:08:41 +02:00
|
|
|
gpsplatinum_short := 'gps9'
|
2013-03-18 19:24:50 +01:00
|
|
|
|
|
|
|
# SimPosix only builds on Linux so drop it from the list for
|
|
|
|
# all other platforms.
|
|
|
|
ifneq ($(UNAME), Linux)
|
2013-04-28 14:35:28 +02:00
|
|
|
ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
|
2013-03-18 19:24:50 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Start out assuming that we'll build fw, bl and bu for all boards
|
|
|
|
FW_BOARDS := $(ALL_BOARDS)
|
|
|
|
BL_BOARDS := $(ALL_BOARDS)
|
2013-04-28 10:14:50 +02:00
|
|
|
BU_BOARDS := $(ALL_BOARDS)
|
2013-03-18 19:24:50 +01:00
|
|
|
EF_BOARDS := $(ALL_BOARDS)
|
|
|
|
|
|
|
|
# SimPosix doesn't have a BL, BU or EF target so we need to
|
|
|
|
# filter them out to prevent errors on the all_flight target.
|
|
|
|
BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
|
2014-09-08 01:57:17 +02:00
|
|
|
BU_BOARDS := $(filter-out simposix gpsplatinum, $(BU_BOARDS))
|
2013-03-18 19:24:50 +01:00
|
|
|
EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
|
|
|
|
|
|
|
|
# Generate the targets for whatever boards are left in each list
|
|
|
|
FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
|
|
|
|
BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
|
|
|
|
BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
|
|
|
|
EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
|
|
|
|
|
|
|
|
# When building any of the "all_*" targets, tell all sub makefiles to display
|
|
|
|
# additional details on each line of output to describe which build and target
|
2013-03-21 20:28:44 +01:00
|
|
|
# that each line applies to. The same applies also to all, opfw_resource,
|
2015-01-29 21:47:48 +01:00
|
|
|
# package targets
|
|
|
|
ifneq ($(strip $(filter all_% all opfw_resource package,$(MAKECMDGOALS))),)
|
2013-03-18 19:24:50 +01:00
|
|
|
export ENABLE_MSG_EXTRA := yes
|
|
|
|
endif
|
|
|
|
|
|
|
|
# When building more than one goal in a single make invocation, also
|
|
|
|
# enable the extra context for each output line
|
|
|
|
ifneq ($(word 2,$(MAKECMDGOALS)),)
|
|
|
|
export ENABLE_MSG_EXTRA := yes
|
|
|
|
endif
|
|
|
|
|
|
|
|
# TEMPLATES (used to generate build rules)
|
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
2013-04-15 17:09:47 +02:00
|
|
|
# $(2) = Short name for board (e.g cc)
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
define FW_TEMPLATE
|
|
|
|
.PHONY: $(1) fw_$(1)
|
2011-05-25 06:20:02 +02:00
|
|
|
$(1): fw_$(1)_opfw
|
|
|
|
fw_$(1): fw_$(1)_opfw
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
|
|
|
|
fw_$(1)_%: uavobjects_flight
|
2013-04-16 21:26:36 +02:00
|
|
|
$(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
|
2013-04-15 20:47:23 +02:00
|
|
|
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
$$(MAKE) -r --no-print-directory \
|
2013-05-03 14:14:29 +02:00
|
|
|
BUILD_TYPE=fw \
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
BOARD_NAME=$(1) \
|
2013-04-15 17:09:47 +02:00
|
|
|
BOARD_SHORT_NAME=$(2) \
|
2013-04-15 20:47:23 +02:00
|
|
|
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
|
2013-03-15 20:33:25 +01:00
|
|
|
OUTDIR=$(BUILD_DIR)/fw_$(1) \
|
|
|
|
TARGET=fw_$(1) \
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
$$*
|
2011-02-23 05:18:56 +01:00
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
.PHONY: $(1)_clean
|
|
|
|
$(1)_clean: fw_$(1)_clean
|
|
|
|
fw_$(1)_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/fw_$(1))"
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
$(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
|
|
|
|
endef
|
2011-04-25 00:37:45 +02:00
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
2013-04-15 17:09:47 +02:00
|
|
|
# $(2) = Short name for board (e.g cc)
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
define BL_TEMPLATE
|
|
|
|
.PHONY: bl_$(1)
|
|
|
|
bl_$(1): bl_$(1)_bin
|
|
|
|
bl_$(1)_bino: bl_$(1)_bin
|
|
|
|
|
|
|
|
bl_$(1)_%:
|
2013-04-16 21:26:36 +02:00
|
|
|
$(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
|
2013-04-15 19:19:31 +02:00
|
|
|
$(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
$$(MAKE) -r --no-print-directory \
|
2013-05-03 14:14:29 +02:00
|
|
|
BUILD_TYPE=bl \
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
BOARD_NAME=$(1) \
|
2013-04-15 17:09:47 +02:00
|
|
|
BOARD_SHORT_NAME=$(2) \
|
2013-04-15 19:19:31 +02:00
|
|
|
TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
|
2013-03-14 08:45:21 +01:00
|
|
|
OUTDIR=$(BUILD_DIR)/bl_$(1) \
|
|
|
|
TARGET=bl_$(1) \
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
$$*
|
2011-02-23 05:18:56 +01:00
|
|
|
|
2011-06-08 04:53:08 +02:00
|
|
|
.PHONY: unbrick_$(1)
|
|
|
|
unbrick_$(1): bl_$(1)_hex
|
|
|
|
$(if $(filter-out undefined,$(origin UNBRICK_TTY)),
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)"
|
2011-06-08 04:53:08 +02:00
|
|
|
$(V1) $(STM32FLASH_DIR)/stm32flash \
|
|
|
|
-w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \
|
|
|
|
-g 0x0 \
|
|
|
|
$$(UNBRICK_TTY)
|
|
|
|
,
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V0) @$(ECHO)
|
|
|
|
$(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
|
|
|
|
$(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
|
2011-06-08 04:53:08 +02:00
|
|
|
)
|
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
.PHONY: bl_$(1)_clean
|
|
|
|
bl_$(1)_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bl_$(1))"
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
$(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
|
|
|
|
endef
|
2011-02-23 05:19:02 +01:00
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
2013-04-15 17:09:47 +02:00
|
|
|
# $(2) = Short name for board (e.g cc)
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
define BU_TEMPLATE
|
|
|
|
.PHONY: bu_$(1)
|
2011-05-25 06:20:02 +02:00
|
|
|
bu_$(1): bu_$(1)_opfw
|
2011-04-25 00:37:45 +02:00
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
bu_$(1)_%: bl_$(1)_bino
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
|
2013-04-15 16:25:04 +02:00
|
|
|
$(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
$$(MAKE) -r --no-print-directory \
|
2013-05-03 14:14:29 +02:00
|
|
|
BUILD_TYPE=bu \
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
BOARD_NAME=$(1) \
|
2013-04-15 17:09:47 +02:00
|
|
|
BOARD_SHORT_NAME=$(2) \
|
2013-04-15 16:25:04 +02:00
|
|
|
TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
|
2013-03-16 23:38:11 +01:00
|
|
|
OUTDIR=$(BUILD_DIR)/bu_$(1) \
|
|
|
|
TARGET=bu_$(1) \
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
$$*
|
2011-02-23 05:18:56 +01:00
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
.PHONY: bu_$(1)_clean
|
|
|
|
bu_$(1)_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bu_$(1))"
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
$(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
|
|
|
|
endef
|
2011-02-23 05:19:02 +01:00
|
|
|
|
2012-02-03 06:18:06 +01:00
|
|
|
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
2013-04-15 17:09:47 +02:00
|
|
|
# $(2) = Short name for board (e.g cc)
|
2012-02-03 06:18:06 +01:00
|
|
|
define EF_TEMPLATE
|
|
|
|
.PHONY: ef_$(1)
|
2012-02-04 18:03:42 +01:00
|
|
|
ef_$(1): ef_$(1)_bin
|
2012-02-03 06:18:06 +01:00
|
|
|
|
2012-05-28 03:39:15 +02:00
|
|
|
ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
|
2013-03-21 15:21:45 +01:00
|
|
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
|
2013-04-15 16:25:04 +02:00
|
|
|
$(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
|
2012-02-04 18:03:42 +01:00
|
|
|
$$(MAKE) -r --no-print-directory \
|
2013-05-03 14:14:29 +02:00
|
|
|
BUILD_TYPE=ef \
|
2012-02-04 18:03:42 +01:00
|
|
|
BOARD_NAME=$(1) \
|
2013-04-15 17:09:47 +02:00
|
|
|
BOARD_SHORT_NAME=$(2) \
|
2012-02-04 18:03:42 +01:00
|
|
|
DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
|
2013-04-15 16:25:04 +02:00
|
|
|
TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
|
2012-11-28 04:32:51 +01:00
|
|
|
OUTDIR=$(BUILD_DIR)/ef_$(1) \
|
2013-03-21 15:21:45 +01:00
|
|
|
TARGET=ef_$(1) \
|
2012-02-04 18:03:42 +01:00
|
|
|
$$*
|
2012-02-03 06:18:06 +01:00
|
|
|
|
|
|
|
.PHONY: ef_$(1)_clean
|
|
|
|
ef_$(1)_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/ef_$(1))"
|
2012-02-03 06:18:06 +01:00
|
|
|
$(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
|
|
|
|
endef
|
|
|
|
|
2011-05-24 04:04:54 +02:00
|
|
|
# $(1) = Canonical board name all in lower case (e.g. coptercontrol)
|
|
|
|
define BOARD_PHONY_TEMPLATE
|
|
|
|
.PHONY: all_$(1)
|
|
|
|
all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
|
|
|
|
all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
|
|
|
|
all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
|
2012-02-03 06:18:06 +01:00
|
|
|
all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
|
2011-05-24 04:04:54 +02:00
|
|
|
|
|
|
|
.PHONY: all_$(1)_clean
|
|
|
|
all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
|
|
|
|
all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
|
|
|
|
all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
|
2012-02-03 06:18:06 +01:00
|
|
|
all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
|
2011-05-24 04:04:54 +02:00
|
|
|
endef
|
|
|
|
|
2013-03-18 19:24:50 +01:00
|
|
|
# Generate flight build rules
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
.PHONY: all_fw all_fw_clean
|
2011-05-25 06:20:02 +02:00
|
|
|
all_fw: $(addsuffix _opfw, $(FW_TARGETS))
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
|
2011-04-14 14:46:39 +02:00
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
.PHONY: all_bl all_bl_clean
|
|
|
|
all_bl: $(addsuffix _bin, $(BL_TARGETS))
|
|
|
|
all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
|
2011-04-14 14:46:39 +02:00
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
.PHONY: all_bu all_bu_clean
|
2011-05-25 06:20:02 +02:00
|
|
|
all_bu: $(addsuffix _opfw, $(BU_TARGETS))
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
|
2011-04-14 14:46:39 +02:00
|
|
|
|
2012-02-03 06:18:06 +01:00
|
|
|
.PHONY: all_ef all_ef_clean
|
2012-05-28 03:51:55 +02:00
|
|
|
all_ef: $(EF_TARGETS)
|
2012-02-03 06:18:06 +01:00
|
|
|
all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
|
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
.PHONY: all_flight all_flight_clean
|
2012-02-03 06:18:06 +01:00
|
|
|
all_flight: all_fw all_bl all_bu all_ef
|
|
|
|
all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
|
2011-04-14 14:46:39 +02:00
|
|
|
|
2011-06-08 04:47:07 +02:00
|
|
|
# Expand the groups of targets for each board
|
2011-05-24 04:04:54 +02:00
|
|
|
$(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
|
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
# Expand the firmware rules
|
2013-04-15 17:09:47 +02:00
|
|
|
$(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_short))))
|
2011-04-14 14:46:39 +02:00
|
|
|
|
build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
- BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
- MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
- START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 21:11:53 +02:00
|
|
|
# Expand the bootloader rules
|
2013-04-15 17:09:47 +02:00
|
|
|
$(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_short))))
|
2011-04-14 14:46:39 +02:00
|
|
|
|
2013-03-18 19:24:50 +01:00
|
|
|
# Expand the bootloader updater rules
|
2013-04-15 17:09:47 +02:00
|
|
|
$(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_short))))
|
2013-03-18 19:24:50 +01:00
|
|
|
|
2012-02-03 06:18:06 +01:00
|
|
|
# Expand the entire-flash rules
|
2013-04-15 17:09:47 +02:00
|
|
|
$(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_short))))
|
2012-02-03 06:18:06 +01:00
|
|
|
|
2011-02-23 05:18:56 +01:00
|
|
|
.PHONY: sim_win32
|
|
|
|
sim_win32: sim_win32_exe
|
|
|
|
|
|
|
|
sim_win32_%: uavobjects_flight
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32
|
2011-04-02 17:06:01 +02:00
|
|
|
$(V1) $(MAKE) --no-print-directory \
|
2012-11-27 07:23:44 +01:00
|
|
|
-C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $*
|
2011-05-19 00:57:35 +02:00
|
|
|
|
2012-03-11 13:40:58 +01:00
|
|
|
.PHONY: sim_osx
|
|
|
|
sim_osx: sim_osx_elf
|
2012-06-03 02:31:57 +02:00
|
|
|
|
2012-03-11 13:40:58 +01:00
|
|
|
sim_osx_%: uavobjects_flight
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx
|
2012-03-11 13:40:58 +01:00
|
|
|
$(V1) $(MAKE) --no-print-directory \
|
2013-04-13 00:28:44 +02:00
|
|
|
-C $(ROOT_DIR)/flight/targets/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
|
2012-12-14 06:25:02 +01:00
|
|
|
|
2013-03-18 19:24:50 +01:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# GCS related components
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
.PHONY: all_ground
|
2014-09-07 23:01:20 +02:00
|
|
|
all_ground: openpilotgcs uploader
|
2013-03-18 19:24:50 +01:00
|
|
|
|
|
|
|
# Convenience target for the GCS
|
2015-04-01 22:26:37 +02:00
|
|
|
.PHONY: gcs gcs_qmake gcs_clean
|
2013-03-18 19:24:50 +01:00
|
|
|
gcs: openpilotgcs
|
2015-04-01 22:26:37 +02:00
|
|
|
gcs_qmake: openpilotgcs_qmake
|
2013-03-18 19:24:50 +01:00
|
|
|
gcs_clean: openpilotgcs_clean
|
|
|
|
|
|
|
|
ifeq ($(V), 1)
|
|
|
|
GCS_SILENT :=
|
|
|
|
else
|
|
|
|
GCS_SILENT := silent
|
|
|
|
endif
|
|
|
|
|
2015-05-18 19:03:11 +02:00
|
|
|
OPENPILOTGCS_DIR := $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)
|
2015-04-01 04:06:04 +02:00
|
|
|
DIRS += $(OPENPILOTGCS_DIR)
|
|
|
|
|
2015-04-01 22:26:37 +02:00
|
|
|
OPENPILOTGCS_MAKEFILE := $(OPENPILOTGCS_DIR)/Makefile
|
|
|
|
|
2014-02-17 22:29:16 +01:00
|
|
|
.PHONY: openpilotgcs_qmake
|
2015-04-01 22:26:37 +02:00
|
|
|
openpilotgcs_qmake $(OPENPILOTGCS_MAKEFILE): | $(OPENPILOTGCS_DIR)
|
2015-04-20 23:20:13 +02:00
|
|
|
$(V1) cd $(OPENPILOTGCS_DIR) && \
|
|
|
|
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro \
|
2015-05-18 19:03:11 +02:00
|
|
|
-spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) \
|
2015-07-12 18:23:18 +02:00
|
|
|
'GCS_BIG_NAME="$(GCS_BIG_NAME)"' GCS_SMALL_NAME=$(GCS_SMALL_NAME) \
|
|
|
|
'ORG_BIG_NAME="$(ORG_BIG_NAME)"' ORG_SMALL_NAME=$(ORG_SMALL_NAME) \
|
|
|
|
$(GCS_QMAKE_OPTS)
|
2014-02-17 22:29:16 +01:00
|
|
|
|
2015-04-01 22:26:37 +02:00
|
|
|
.PHONY: openpilotgcs
|
2015-05-17 15:06:27 +02:00
|
|
|
openpilotgcs: uavobjgenerator $(OPENPILOTGCS_MAKEFILE)
|
2015-04-01 04:06:04 +02:00
|
|
|
$(V1) $(MAKE) -w -C $(OPENPILOTGCS_DIR)/$(MAKE_DIR);
|
2013-03-18 19:24:50 +01:00
|
|
|
|
|
|
|
.PHONY: openpilotgcs_clean
|
|
|
|
openpilotgcs_clean:
|
2015-04-01 04:06:04 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(OPENPILOTGCS_DIR))"
|
|
|
|
$(V1) [ ! -d "$(OPENPILOTGCS_DIR)" ] || $(RM) -r "$(OPENPILOTGCS_DIR)"
|
2013-03-18 19:24:50 +01:00
|
|
|
|
2015-04-05 18:51:56 +02:00
|
|
|
|
|
|
|
|
2014-09-07 23:01:20 +02:00
|
|
|
################################
|
|
|
|
#
|
|
|
|
# Serial Uploader tool
|
|
|
|
#
|
|
|
|
################################
|
|
|
|
|
2015-04-01 04:06:04 +02:00
|
|
|
UPLOADER_DIR := $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
|
|
|
|
DIRS += $(UPLOADER_DIR)
|
|
|
|
|
2015-04-01 22:26:37 +02:00
|
|
|
UPLOADER_MAKEFILE := $(UPLOADER_DIR)/Makefile
|
|
|
|
|
2014-09-07 23:01:20 +02:00
|
|
|
.PHONY: uploader_qmake
|
2015-04-01 22:26:37 +02:00
|
|
|
uploader_qmake $(UPLOADER_MAKEFILE): | $(UPLOADER_DIR)
|
2015-04-20 23:20:13 +02:00
|
|
|
$(V1) cd $(UPLOADER_DIR) && \
|
|
|
|
$(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/upload.pro \
|
|
|
|
-spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) $(GCS_QMAKE_OPTS)
|
2014-09-07 23:01:20 +02:00
|
|
|
|
2015-04-01 22:26:37 +02:00
|
|
|
.PHONY: uploader
|
|
|
|
uploader: $(UPLOADER_MAKEFILE)
|
2015-04-01 04:06:04 +02:00
|
|
|
$(V1) $(MAKE) -w -C $(UPLOADER_DIR)
|
2014-09-07 23:01:20 +02:00
|
|
|
|
|
|
|
.PHONY: uploader_clean
|
|
|
|
uploader_clean:
|
2015-04-01 04:06:04 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(UPLOADER_DIR))"
|
|
|
|
$(V1) [ ! -d "$(UPLOADER_DIR)" ] || $(RM) -r "$(UPLOADER_DIR)"
|
2014-09-07 23:01:20 +02:00
|
|
|
|
|
|
|
|
2013-03-18 19:24:50 +01:00
|
|
|
# We want to take snapshots of the UAVOs at each point that they change
|
|
|
|
# to allow the GCS to be compatible with as many versions as possible.
|
|
|
|
# We always include a pseudo collection called "srctree" which represents
|
|
|
|
# the UAVOs in the source tree. So not necessary to add current tree UAVO
|
|
|
|
# hash here, it is always included.
|
|
|
|
|
|
|
|
# Find the git hashes of each commit that changes uavobjects with:
|
|
|
|
# git log --format=%h -- shared/uavobjectdefinition/ | head -n 2
|
|
|
|
# List only UAVO hashes of past releases, do not list current hash.
|
2013-03-24 16:00:15 +01:00
|
|
|
# Past compatible versions are so far: RELEASE-12.10.2
|
2013-03-18 19:24:50 +01:00
|
|
|
UAVO_GIT_VERSIONS := 5e14f53
|
|
|
|
|
|
|
|
# All versions includes also the current source tree UAVO hash
|
|
|
|
UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree
|
|
|
|
|
|
|
|
# This is where the UAVO collections are stored
|
|
|
|
UAVO_COLLECTION_DIR := $(BUILD_DIR)/uavo-collections
|
|
|
|
|
|
|
|
# $(1) git hash of a UAVO snapshot
|
|
|
|
define UAVO_COLLECTION_GIT_TEMPLATE
|
|
|
|
|
|
|
|
# Make the output directory that will contain all of the synthetics for the
|
|
|
|
# uavo collection referenced by the git hash $(1)
|
|
|
|
$$(UAVO_COLLECTION_DIR)/$(1):
|
|
|
|
$$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1)
|
|
|
|
|
|
|
|
# Extract the snapshot of shared/uavobjectdefinition from git hash $(1)
|
|
|
|
$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1)
|
|
|
|
$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar:
|
|
|
|
$$(V0) @$(ECHO) " UAVOTAR $(1)"
|
|
|
|
$$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/
|
|
|
|
|
|
|
|
# Extract the uavo xml files from our snapshot
|
|
|
|
$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar
|
|
|
|
$$(V0) @$(ECHO) " UAVOUNTAR $(1)"
|
|
|
|
$$(V1) $(RM) -rf $$@
|
|
|
|
$$(V1) $(MKDIR) -p $$@
|
|
|
|
$$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Map the current working directory into the set of UAVO collections
|
|
|
|
$(UAVO_COLLECTION_DIR)/srctree:
|
|
|
|
$(V1) $(MKDIR) -p $@
|
|
|
|
|
|
|
|
$(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree
|
|
|
|
$(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR)
|
|
|
|
$(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml
|
|
|
|
|
|
|
|
# $(1) git hash (or symbolic name) of a UAVO snapshot
|
|
|
|
define UAVO_COLLECTION_BUILD_TEMPLATE
|
|
|
|
|
|
|
|
# This leaves us with a (broken) symlink that points to the full sha1sum of the collection
|
|
|
|
$$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
|
|
|
|
# Compute the sha1 hash for this UAVO collection
|
|
|
|
# The sed bit truncates the UAVO hash to 16 hex digits
|
|
|
|
$$(V1) $$(VERSION_INFO) \
|
|
|
|
--uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
|
2013-05-25 16:40:58 +02:00
|
|
|
--format='$$$${UAVO_HASH}' | \
|
2013-03-18 19:24:50 +01:00
|
|
|
$(SED) -e 's|\(................\).*|\1|' > $$@
|
|
|
|
|
|
|
|
$$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
|
|
|
|
|
|
|
|
# Generate the java uavobjects for this UAVO collection
|
|
|
|
$$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash
|
|
|
|
$$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
|
|
|
|
$$(V1) $(MKDIR) -p $$@
|
|
|
|
$$(V1) ( \
|
|
|
|
cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
|
|
|
|
$$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \
|
|
|
|
)
|
|
|
|
|
|
|
|
# Build a jar file for this UAVO collection
|
|
|
|
$$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos
|
|
|
|
$$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java
|
|
|
|
$$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
|
|
|
|
$$(V1) ( \
|
|
|
|
HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \
|
|
|
|
cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
|
|
|
|
$(JAVAC) java/*.java \
|
|
|
|
$$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \
|
|
|
|
$$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \
|
|
|
|
$$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \
|
|
|
|
-d . && \
|
|
|
|
find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \
|
|
|
|
$(JAR) cf tmp_uavobjects.jar @classlist.txt && \
|
|
|
|
$$(ANDROID_DX) \
|
|
|
|
--dex \
|
|
|
|
--output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \
|
|
|
|
tmp_uavobjects.jar && \
|
|
|
|
$(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \
|
|
|
|
)
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
# One of these for each element of UAVO_GIT_VERSIONS so we can extract the UAVOs from git
|
|
|
|
$(foreach githash, $(UAVO_GIT_VERSIONS), $(eval $(call UAVO_COLLECTION_GIT_TEMPLATE,$(githash))))
|
|
|
|
|
|
|
|
# One of these for each UAVO_ALL_VERSIONS which includes the ones in the srctree
|
|
|
|
$(foreach githash, $(UAVO_ALL_VERSIONS), $(eval $(call UAVO_COLLECTION_BUILD_TEMPLATE,$(githash))))
|
|
|
|
|
|
|
|
.PHONY: uavo-collections_java
|
|
|
|
uavo-collections_java: $(foreach githash, $(UAVO_ALL_VERSIONS), $(UAVO_COLLECTION_DIR)/$(githash)/java-build/uavobjects.jar)
|
|
|
|
|
|
|
|
.PHONY: uavo-collections
|
|
|
|
uavo-collections: uavo-collections_java
|
|
|
|
|
|
|
|
.PHONY: uavo-collections_clean
|
|
|
|
uavo-collections_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(UAVO_COLLECTION_DIR))"
|
2013-03-18 19:24:50 +01:00
|
|
|
$(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR)
|
|
|
|
|
2012-12-14 06:25:02 +01:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Unit Tests
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2014-09-29 21:26:31 +02:00
|
|
|
ALL_UNITTESTS := logfs math lednotification
|
2012-12-14 06:25:02 +01:00
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
# Build the directory for the unit tests
|
2012-12-14 06:25:02 +01:00
|
|
|
UT_OUT_DIR := $(BUILD_DIR)/unit_tests
|
2015-04-01 04:06:04 +02:00
|
|
|
DIRS += $(UT_OUT_DIR)
|
2012-12-14 06:25:02 +01:00
|
|
|
|
2012-12-20 08:02:35 +01:00
|
|
|
.PHONY: all_ut
|
|
|
|
all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
|
|
|
|
|
2013-01-09 07:09:55 +01:00
|
|
|
.PHONY: all_ut_xml
|
|
|
|
all_ut_xml: $(addsuffix _xml, $(addprefix ut_, $(ALL_UNITTESTS)))
|
2012-12-20 08:02:35 +01:00
|
|
|
|
|
|
|
.PHONY: all_ut_run
|
|
|
|
all_ut_run: $(addsuffix _run, $(addprefix ut_, $(ALL_UNITTESTS)))
|
|
|
|
|
2013-01-04 01:58:29 +01:00
|
|
|
.PHONY: all_ut_clean
|
2012-12-20 08:02:35 +01:00
|
|
|
all_ut_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR))"
|
2012-12-20 08:02:35 +01:00
|
|
|
$(V1) [ ! -d "$(UT_OUT_DIR)" ] || $(RM) -r "$(UT_OUT_DIR)"
|
|
|
|
|
|
|
|
# $(1) = Unit test name
|
|
|
|
define UT_TEMPLATE
|
|
|
|
.PHONY: ut_$(1)
|
|
|
|
ut_$(1): ut_$(1)_run
|
|
|
|
|
|
|
|
ut_$(1)_%: $$(UT_OUT_DIR)
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(MKDIR) -p $(UT_OUT_DIR)/$(1)
|
2012-12-20 08:02:35 +01:00
|
|
|
$(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
|
|
|
|
$$(MAKE) -r --no-print-directory \
|
2012-12-14 06:25:02 +01:00
|
|
|
BUILD_TYPE=ut \
|
2013-05-12 14:13:39 +02:00
|
|
|
BOARD_SHORT_NAME=$(1) \
|
2013-05-03 14:14:29 +02:00
|
|
|
TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
|
2012-12-20 08:02:35 +01:00
|
|
|
OUTDIR="$(UT_OUT_DIR)/$(1)" \
|
2013-05-03 14:14:29 +02:00
|
|
|
TARGET=$(1) \
|
2013-02-23 17:04:20 +01:00
|
|
|
$$*
|
2012-12-14 06:25:02 +01:00
|
|
|
|
2012-12-20 08:02:35 +01:00
|
|
|
.PHONY: ut_$(1)_clean
|
|
|
|
ut_$(1)_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR)/$(1))"
|
2012-12-20 08:02:35 +01:00
|
|
|
$(V1) [ ! -d "$(UT_OUT_DIR)/$(1)" ] || $(RM) -r "$(UT_OUT_DIR)/$(1)"
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Expand the unittest rules
|
|
|
|
$(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut))))
|
|
|
|
|
|
|
|
# Disable parallel make when the all_ut_run target is requested otherwise the TAP
|
|
|
|
# output is interleaved with the rest of the make output.
|
|
|
|
ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),)
|
|
|
|
.NOTPARALLEL:
|
2013-03-31 16:57:25 +02:00
|
|
|
$(info $(EMPTY) NOTE Parallel make disabled by all_ut_run target so we have sane console output)
|
2012-12-20 08:02:35 +01:00
|
|
|
endif
|
2012-12-14 06:25:02 +01:00
|
|
|
|
2011-05-19 00:57:35 +02:00
|
|
|
##############################
|
|
|
|
#
|
2011-05-28 02:14:51 +02:00
|
|
|
# Packaging components
|
2011-05-19 00:57:35 +02:00
|
|
|
#
|
|
|
|
##############################
|
2012-10-05 22:23:42 +02:00
|
|
|
|
2013-03-23 22:24:15 +01:00
|
|
|
# Firmware files to package
|
2014-09-16 23:12:16 +02:00
|
|
|
PACKAGE_FW_EXCLUDE := fw_simposix $(if $(PACKAGE_FW_INCLUDE_DISCOVERYF4BARE),,fw_discoveryf4bare)
|
|
|
|
PACKAGE_FW_TARGETS := $(filter-out $(PACKAGE_FW_EXCLUDE), $(FW_TARGETS))
|
2014-04-26 22:56:34 +02:00
|
|
|
PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS))
|
2013-03-23 22:24:15 +01:00
|
|
|
|
2013-03-19 16:52:24 +01:00
|
|
|
# Rules to generate GCS resources used to embed firmware binaries into the GCS.
|
|
|
|
# They are used later by the vehicle setup wizard to update board firmware.
|
|
|
|
# To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
|
2013-03-30 16:33:38 +01:00
|
|
|
OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc
|
|
|
|
OPFW_RESOURCE_PREFIX := ../../
|
2013-03-23 22:24:15 +01:00
|
|
|
OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
|
2013-03-19 16:52:24 +01:00
|
|
|
OPFW_CONTENTS := \
|
|
|
|
<!DOCTYPE RCC><RCC version="1.0"> \
|
|
|
|
<qresource prefix="/firmware"> \
|
|
|
|
$(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
|
|
|
|
</qresource> \
|
|
|
|
</RCC>
|
|
|
|
|
|
|
|
.PHONY: opfw_resource
|
|
|
|
opfw_resource: $(OPFW_RESOURCE)
|
|
|
|
|
2015-04-01 04:06:04 +02:00
|
|
|
$(OPFW_RESOURCE): $(FW_TARGETS) | $(OPGCSSYNTHDIR)
|
2013-03-19 16:52:24 +01:00
|
|
|
@$(ECHO) Generating OPFW resource file $(call toprel, $@)
|
|
|
|
$(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
|
|
|
|
|
2013-04-10 09:01:03 +02:00
|
|
|
# If opfw_resource or all firmware are requested, GCS should depend on the resource
|
2015-01-30 22:14:46 +01:00
|
|
|
ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),)
|
2015-04-20 23:05:59 +02:00
|
|
|
$(OPENPILOTGCS_MAKEFILE): $(OPFW_RESOURCE)
|
2013-03-21 22:11:30 +01:00
|
|
|
endif
|
|
|
|
|
2015-01-29 21:47:48 +01:00
|
|
|
# Packaging targets: package
|
2013-03-21 20:28:44 +01:00
|
|
|
# - builds all firmware, opfw_resource, gcs
|
|
|
|
# - copies firmware into a package directory
|
|
|
|
# - calls paltform-specific packaging script
|
|
|
|
|
2015-01-30 22:14:46 +01:00
|
|
|
# Define some variables
|
2015-02-10 06:37:35 +01:00
|
|
|
PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL})
|
2015-07-12 18:15:53 +02:00
|
|
|
PACKAGE_NAME := $(subst $(SPACE),,$(ORG_BIG_NAME))
|
2015-02-10 06:37:35 +01:00
|
|
|
PACKAGE_SEP := -
|
|
|
|
PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)
|
|
|
|
|
2015-03-17 22:18:04 +01:00
|
|
|
# Source distribution is never dirty because it uses git archive
|
|
|
|
DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar
|
2013-02-04 14:56:11 +01:00
|
|
|
|
2015-06-25 18:30:01 +02:00
|
|
|
include $(ROOT_DIR)/package/$(UNAME).mk
|
|
|
|
|
2013-04-22 01:43:53 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Source code formatting
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2013-04-29 10:51:39 +02:00
|
|
|
UNCRUSTIFY_TARGETS := flight ground
|
|
|
|
|
2013-04-22 01:43:53 +02:00
|
|
|
# $(1) = Uncrustify target (e.g flight or ground)
|
|
|
|
# $(2) = Target root directory
|
|
|
|
define UNCRUSTIFY_TEMPLATE
|
|
|
|
|
|
|
|
.PHONY: uncrustify_$(1)
|
|
|
|
uncrustify_$(1):
|
|
|
|
@$(ECHO) "Auto-formatting $(1) source code"
|
2013-04-24 21:49:17 +02:00
|
|
|
$(V1) UNCRUSTIFY_CONFIG="$(ROOT_DIR)/make/uncrustify/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
|
2013-04-22 01:43:53 +02:00
|
|
|
endef
|
|
|
|
|
2013-04-29 10:51:39 +02:00
|
|
|
$(foreach uncrustify_targ, $(UNCRUSTIFY_TARGETS), $(eval $(call UNCRUSTIFY_TEMPLATE,$(uncrustify_targ),$(ROOT_DIR)/$(uncrustify_targ))))
|
2013-04-22 01:43:53 +02:00
|
|
|
|
|
|
|
.PHONY: uncrustify_all
|
2013-04-29 10:51:39 +02:00
|
|
|
uncrustify_all: $(addprefix uncrustify_,$(UNCRUSTIFY_TARGETS))
|
2013-04-22 01:43:53 +02:00
|
|
|
|
2013-04-29 02:02:29 +02:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Doxygen documentation
|
|
|
|
#
|
|
|
|
# Each target should have own Doxyfile.$(target) with build directory build/docs/$(target),
|
|
|
|
# proper source directory (e.g. $(target)) and appropriate other doxygen options.
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2013-04-29 10:51:39 +02:00
|
|
|
DOCS_TARGETS := flight ground uavobjects
|
|
|
|
|
2013-04-29 02:02:29 +02:00
|
|
|
# $(1) = Doxygen target (e.g flight or ground)
|
|
|
|
define DOXYGEN_TEMPLATE
|
|
|
|
|
|
|
|
.PHONY: docs_$(1)
|
|
|
|
docs_$(1): docs_$(1)_clean
|
|
|
|
@$(ECHO) "Generating $(1) documentation"
|
|
|
|
$(V1) $(MKDIR) -p $(BUILD_DIR)/docs/$(1)
|
|
|
|
$(V1) $(DOXYGEN) $(ROOT_DIR)/make/doxygen/Doxyfile.$(1)
|
|
|
|
|
|
|
|
.PHONY: docs_$(1)_clean
|
|
|
|
docs_$(1)_clean:
|
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs/$(1))"
|
|
|
|
$(V1) [ ! -d "$(BUILD_DIR)/docs/$(1)" ] || $(RM) -r "$(BUILD_DIR)/docs/$(1)"
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2013-04-29 10:51:39 +02:00
|
|
|
$(foreach docs_targ, $(DOCS_TARGETS), $(eval $(call DOXYGEN_TEMPLATE,$(docs_targ))))
|
2013-04-29 02:02:29 +02:00
|
|
|
|
|
|
|
.PHONY: docs_all
|
2013-04-29 10:51:39 +02:00
|
|
|
docs_all: $(addprefix docs_,$(DOCS_TARGETS))
|
2013-04-29 02:02:29 +02:00
|
|
|
|
|
|
|
.PHONY: docs_all_clean
|
2013-04-29 10:51:39 +02:00
|
|
|
docs_all_clean:
|
2013-04-29 11:11:32 +02:00
|
|
|
@$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs)"
|
|
|
|
$(V1) [ ! -d "$(BUILD_DIR)/docs" ] || $(RM) -rf "$(BUILD_DIR)/docs"
|
2013-04-29 02:02:29 +02:00
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Build info
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2013-02-04 14:56:11 +01:00
|
|
|
.PHONY: build-info
|
2015-04-01 04:06:04 +02:00
|
|
|
build-info: | $(BUILD_DIR)
|
2013-04-30 22:23:57 +02:00
|
|
|
@$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
|
2013-03-11 20:54:36 +01:00
|
|
|
$(V1) $(VERSION_INFO) \
|
2013-02-04 14:56:11 +01:00
|
|
|
--uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
|
|
|
|
--template="make/templates/$@.txt" \
|
|
|
|
--outfile="$(BUILD_DIR)/$@.txt"
|
2013-03-11 20:54:36 +01:00
|
|
|
|
2014-11-30 22:06:10 +01:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Source for distribution
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2015-01-30 22:56:17 +01:00
|
|
|
DIST_VER_INFO := $(DIST_DIR)/version-info.json
|
|
|
|
|
2015-03-03 05:51:43 +01:00
|
|
|
$(DIST_VER_INFO): .git/index | $(DIST_DIR)
|
2015-01-30 22:56:17 +01:00
|
|
|
$(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
|
|
|
|
|
2015-02-10 06:47:35 +01:00
|
|
|
|
2015-02-16 04:57:57 +01:00
|
|
|
$(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR)
|
2015-02-10 06:37:35 +01:00
|
|
|
@$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)"
|
2015-02-11 05:51:53 +01:00
|
|
|
$(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD
|
2014-12-04 09:32:05 +01:00
|
|
|
$(V1) tar --append --file="$(DIST_NAME)" \
|
2015-02-11 05:51:53 +01:00
|
|
|
--transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
|
2015-01-30 22:56:17 +01:00
|
|
|
$(call toprel, "$(DIST_VER_INFO)")
|
2014-12-04 09:32:05 +01:00
|
|
|
$(V1) gzip -f "$(DIST_NAME)"
|
2014-11-30 22:06:10 +01:00
|
|
|
|
2015-02-10 06:47:35 +01:00
|
|
|
.PHONY: dist
|
|
|
|
dist: $(DIST_NAME).gz
|
2014-11-30 22:06:10 +01:00
|
|
|
|
2015-04-01 04:06:04 +02:00
|
|
|
|
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Directories
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
|
|
|
$(DIRS):
|
|
|
|
$(V1) $(MKDIR) -p $@
|
|
|
|
|
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
##############################
|
|
|
|
#
|
|
|
|
# Help message, the default Makefile goal
|
|
|
|
#
|
|
|
|
##############################
|
|
|
|
|
2013-04-04 23:42:56 +02:00
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
2013-03-11 20:54:36 +01:00
|
|
|
.PHONY: help
|
|
|
|
help:
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment."
|
2013-05-01 21:44:11 +02:00
|
|
|
@$(ECHO) " It also works on Windows by following the instructions given on this wiki page:"
|
|
|
|
@$(ECHO) " http://wiki.openpilot.org/display/Doc/Windows%3A+Building+and+Packaging"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " Here is a summary of the available targets:"
|
|
|
|
@$(ECHO)
|
2014-01-13 12:24:23 +01:00
|
|
|
@$(ECHO) " [Source tree preparation]"
|
2014-01-15 11:19:35 +01:00
|
|
|
@$(ECHO) " prepare - Install GIT commit message template"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " [Tool Installers]"
|
|
|
|
@$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain"
|
2013-04-10 00:04:03 +02:00
|
|
|
@$(ECHO) " qt_sdk_install - Install the QT development tools"
|
2013-05-01 21:44:11 +02:00
|
|
|
@$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
|
2014-03-20 22:51:46 +01:00
|
|
|
@$(ECHO) " sdl_install - Install the SDL library (Windows only)"
|
2014-07-04 17:21:39 +02:00
|
|
|
@$(ECHO) " mesawin_install - Install the OpenGL32 DLL (Windows only)"
|
2013-12-01 23:17:48 +01:00
|
|
|
@$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)"
|
2013-04-22 01:43:53 +02:00
|
|
|
@$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
|
2013-05-01 21:44:11 +02:00
|
|
|
@$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
|
2013-05-03 12:39:33 +02:00
|
|
|
@$(ECHO) " gtest_install - Install the GoogleTest framework"
|
2013-05-01 21:44:11 +02:00
|
|
|
@$(ECHO) " These targets are not updated yet and are probably broken:"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
|
2013-03-19 17:20:09 +01:00
|
|
|
@$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
|
2013-05-01 21:44:11 +02:00
|
|
|
@$(ECHO) " Install all available tools:"
|
2013-04-04 17:26:59 +02:00
|
|
|
@$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
|
2013-05-03 12:39:33 +02:00
|
|
|
@$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
|
2013-04-04 17:26:59 +02:00
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " Other tool options are:"
|
|
|
|
@$(ECHO) " <tool>_version - Display <tool> version"
|
|
|
|
@$(ECHO) " <tool>_clean - Remove installed <tool>"
|
|
|
|
@$(ECHO) " <tool>_distclean - Remove downloaded <tool> distribution file(s)"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " [Big Hammer]"
|
|
|
|
@$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs"
|
|
|
|
@$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters"
|
|
|
|
@$(ECHO) " all_fw - Build only firmware for all boards"
|
|
|
|
@$(ECHO) " all_bl - Build only bootloaders for all boards"
|
|
|
|
@$(ECHO) " all_bu - Build only bootloader updaters for all boards"
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " all_clean - Remove your build directory ($(BUILD_DIR))"
|
|
|
|
@$(ECHO) " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
|
|
|
|
@$(ECHO) " all_fw_clean - Remove firmware for all boards"
|
2013-04-04 17:26:59 +02:00
|
|
|
@$(ECHO) " all_bl_clean - Remove bootloaders for all boards"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " all_bu_clean - Remove bootloader updaters for all boards"
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " all_<board> - Build all available images for <board>"
|
|
|
|
@$(ECHO) " all_<board>_clean - Remove all available images for <board>"
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " all_ut - Build all unit tests"
|
|
|
|
@$(ECHO) " all_ut_tap - Run all unit tests and capture all TAP output to files"
|
|
|
|
@$(ECHO) " all_ut_run - Run all unit tests and dump TAP output to console"
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " [Firmware]"
|
|
|
|
@$(ECHO) " <board> - Build firmware for <board>"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " Supported boards are ($(ALL_BOARDS))"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " fw_<board> - Build firmware for <board>"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " Supported boards are ($(FW_BOARDS))"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " fw_<board>_clean - Remove firmware for <board>"
|
|
|
|
@$(ECHO) " fw_<board>_program - Use OpenOCD + JTAG to write firmware to <board>"
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " [Bootloader]"
|
|
|
|
@$(ECHO) " bl_<board> - Build bootloader for <board>"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " Supported boards are ($(BL_BOARDS))"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " bl_<board>_clean - Remove bootloader for <board>"
|
|
|
|
@$(ECHO) " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
|
|
|
|
@$(ECHO)
|
2013-03-19 17:20:09 +01:00
|
|
|
@$(ECHO) " [Entire Flash]"
|
|
|
|
@$(ECHO) " ef_<board> - Build entire flash image for <board>"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " Supported boards are ($(EF_BOARDS))"
|
2013-03-19 17:20:09 +01:00
|
|
|
@$(ECHO) " ef_<board>_clean - Remove entire flash image for <board>"
|
|
|
|
@$(ECHO) " ef_<board>_program - Use OpenOCD + JTAG to write entire flash image to <board>"
|
|
|
|
@$(ECHO)
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " [Bootloader Updater]"
|
|
|
|
@$(ECHO) " bu_<board> - Build bootloader updater for <board>"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " Supported boards are ($(BU_BOARDS))"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " bu_<board>_clean - Remove bootloader updater for <board>"
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " [Unbrick a board]"
|
|
|
|
@$(ECHO) " unbrick_<board> - Use the STM32's built in boot ROM to write a bootloader to <board>"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " Supported boards are ($(BL_BOARDS))"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " [Unittests]"
|
|
|
|
@$(ECHO) " ut_<test> - Build unit test <test>"
|
2013-03-19 17:20:09 +01:00
|
|
|
@$(ECHO) " ut_<test>_xml - Run test and capture XML output into a file"
|
|
|
|
@$(ECHO) " ut_<test>_run - Run test and dump output to console"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " [Simulation]"
|
|
|
|
@$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
|
|
|
|
@$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
|
|
|
|
@$(ECHO) " using mingw and msys"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " [GCS]"
|
2013-03-19 23:48:02 +01:00
|
|
|
@$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)"
|
2014-03-22 15:25:01 +01:00
|
|
|
@$(ECHO) " Compile specific directory: MAKE_DIR=<dir>"
|
2015-04-01 22:26:37 +02:00
|
|
|
@$(ECHO) " Example: make gcs MAKE_DIR=src/plugins/coreplugin"
|
|
|
|
@$(ECHO) " gcs_qmake - Run qmake for the Ground Control System (GCS) application (debug|release)"
|
2013-03-19 23:48:02 +01:00
|
|
|
@$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO)
|
2014-09-17 15:43:45 +02:00
|
|
|
@$(ECHO) " [Uploader Tool]"
|
2014-09-07 23:01:20 +02:00
|
|
|
@$(ECHO) " uploader - Build the serial uploader tool (debug|release)"
|
2015-04-01 22:26:37 +02:00
|
|
|
@$(ECHO) " uploader_qmake - Run qmake for the serial uploader tool (debug|release)"
|
2014-09-07 23:01:20 +02:00
|
|
|
@$(ECHO) " uploader_clean - Remove the serial uploader tool (debug|release)"
|
|
|
|
@$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO)
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " [UAVObjects]"
|
|
|
|
@$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..."
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO)
|
2013-03-19 17:20:09 +01:00
|
|
|
@$(ECHO) " [Packaging]"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " package - Build and package the OpenPilot platform-dependent package (no clean)"
|
|
|
|
@$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
|
2014-12-04 09:32:05 +01:00
|
|
|
@$(ECHO) " dist - Generate source archive for distribution"
|
2014-12-09 22:51:29 +01:00
|
|
|
@$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)"
|
2013-03-19 17:20:09 +01:00
|
|
|
@$(ECHO)
|
2013-04-22 01:43:53 +02:00
|
|
|
@$(ECHO) " [Code Formatting]"
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " uncrustify_<source> - Reformat <source> code according to the project's standards"
|
|
|
|
@$(ECHO) " Supported sources are ($(UNCRUSTIFY_TARGETS))"
|
2013-04-22 01:43:53 +02:00
|
|
|
@$(ECHO) " uncrustify_all - Reformat all source code"
|
|
|
|
@$(ECHO)
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " [Code Documentation]"
|
|
|
|
@$(ECHO) " docs_<source> - Generate HTML documentation for <source>"
|
|
|
|
@$(ECHO) " Supported sources are ($(DOCS_TARGETS))"
|
|
|
|
@$(ECHO) " docs_all - Generate HTML documentation for all"
|
|
|
|
@$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
|
|
|
|
@$(ECHO) " docs_all_clean - Delete all generated documentation"
|
|
|
|
@$(ECHO)
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
|
|
|
|
@$(ECHO)
|
2013-05-03 10:54:25 +02:00
|
|
|
@$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
|
|
|
|
@$(ECHO) " All tools will be installed into $(TOOLS_DIR)"
|
|
|
|
@$(ECHO) " All build output will be placed in $(BUILD_DIR)"
|
|
|
|
@$(ECHO)
|
|
|
|
@$(ECHO) " Tool download and install directories can be changed using environment variables:"
|
|
|
|
@$(ECHO) " OPENPILOT_DL_DIR full path to downloads directory [downloads if not set]"
|
|
|
|
@$(ECHO) " OPENPILOT_TOOLS_DIR full path to installed tools directory [tools if not set]"
|
|
|
|
@$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
|
2013-03-11 20:54:36 +01:00
|
|
|
@$(ECHO)
|