OP-1161 reimplemented magnetometer plausibikity check using vector
[librepilot.git] / Makefile
blob112654a14ee32fd0e1afa9c1812b78696927573f
2 # Top level Makefile for the OpenPilot project build system.
3 # Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
4 # Use 'make help' for instructions.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # This top level Makefile passes down some variables to sub-makes through
22 # the environment. They are explicitly exported using the export keyword.
23 # Lower level makefiles assume that these variables are defined. To ensure
24 # that a special magic variable is exported here. It must be checked for
25 # existance by each sub-make.
26 export OPENPILOT_IS_COOL := Fuck Yeah!
28 # It is possible to set OPENPILOT_DL_DIR and/or OPENPILOT_TOOLS_DIR environment
29 # variables to override local tools download and installation directorys. So the
30 # same toolchains can be used for all working copies. Particularly useful for CI
31 # server build agents, but also for local installations.
33 # If no OPENPILOT_* variables found, makefile internal DL_DIR and TOOLS_DIR paths
34 # will be used. They still can be overriden by the make command line parameters:
35 # make DL_DIR=/path/to/download/directory TOOLS_DIR=/path/to/tools/directory targets...
37 # Function for converting Windows style slashes into Unix style
38 slashfix = $(subst \,/,$(1))
40 # Function for converting an absolute path to one relative
41 # to the top of the source tree
42 toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1)))
44 # Set up some macros for common directories within the tree
45 export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
46 export DL_DIR := $(if $(OPENPILOT_DL_DIR),$(call slashfix,$(OPENPILOT_DL_DIR)),$(ROOT_DIR)/downloads)
47 export TOOLS_DIR := $(if $(OPENPILOT_TOOLS_DIR),$(call slashfix,$(OPENPILOT_TOOLS_DIR)),$(ROOT_DIR)/tools)
48 export BUILD_DIR := $(ROOT_DIR)/build
49 export PACKAGE_DIR := $(ROOT_DIR)/build/package
51 # Set up default build configurations (debug | release)
52 GCS_BUILD_CONF := release
53 UAVOGEN_BUILD_CONF := release
54 ANDROIDGCS_BUILD_CONF := debug
55 GOOGLE_API_VERSION := 14
57 # Clean out undesirable variables from the environment and command-line
58 # to remove the chance that they will cause problems with our build
59 define SANITIZE_VAR
60 $(if $(filter-out undefined,$(origin $(1))),
61 $(info $(EMPTY) NOTE Sanitized $(2) variable '$(1)' from $(origin $(1)))
62 MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES))
63 override $(1) :=
64 unexport $(1)
66 endef
68 # These specific variables can influence gcc in unexpected (and undesirable) ways
69 SANITIZE_GCC_VARS := TMPDIR GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH
70 SANITIZE_GCC_VARS += CFLAGS CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH DEPENDENCIES_OUTPUT
71 $(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowed)))
73 # These specific variables used to be valid but now they make no sense
74 SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER CLEAN_BUILD
75 $(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated)))
77 # Make sure this isn't being run as root (no whoami on Windows, but that is ok here)
78 ifeq ($(shell whoami 2>/dev/null),root)
79 $(error You should not be running this as root)
80 endif
82 # Decide on a verbosity level based on the V= parameter
83 export AT := @
84 ifndef V
85 export V0 :=
86 export V1 := $(AT)
87 else ifeq ($(V), 0)
88 export V0 := $(AT)
89 export V1 := $(AT)
90 else ifeq ($(V), 1)
91 endif
93 # Make sure we know few things about the architecture before including
94 # the tools.mk to ensure that we download/install the right tools.
95 UNAME := $(shell uname)
96 ARCH := $(shell uname -m)
97 # Here and everywhere if not Linux or Mac then assume Windows
98 ifeq ($(filter Linux Darwin, $(UNAME)), )
99 UNAME := Windows
100 endif
102 # Include tools installers
103 include $(ROOT_DIR)/make/tools.mk
105 # We almost need to consider autoconf/automake instead of this
106 ifeq ($(UNAME), Linux)
107 QT_SPEC = linux-g++
108 UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/uavobjgenerator"
109 else ifeq ($(UNAME), Darwin)
110 QT_SPEC = macx-g++
111 UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/uavobjgenerator"
112 else ifeq ($(UNAME), Windows)
113 QT_SPEC = win32-g++
114 UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/$(UAVOGEN_BUILD_CONF)/uavobjgenerator.exe"
115 endif
117 ##############################
119 # All targets
121 ##############################
123 .PHONY: all
124 all: uavobjects all_ground all_flight
126 .PHONY: all_clean
127 all_clean:
128 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR))"
129 $(V1) [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)"
131 $(DL_DIR):
132 $(MKDIR) -p $@
134 $(TOOLS_DIR):
135 $(MKDIR) -p $@
137 $(BUILD_DIR):
138 $(MKDIR) -p $@
140 ##############################
142 # UAVObjects
144 ##############################
146 ifeq ($(V), 1)
147 UAVOGEN_SILENT :=
148 else
149 UAVOGEN_SILENT := silent
150 endif
152 .PHONY: uavobjgenerator
153 uavobjgenerator:
154 $(V1) $(MKDIR) -p $(BUILD_DIR)/$@
155 $(V1) ( cd $(BUILD_DIR)/$@ && \
156 $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+="$(UAVOGEN_BUILD_CONF) $(UAVOGEN_SILENT)" && \
157 $(MAKE) --no-print-directory -w ; \
160 UAVOBJ_TARGETS := gcs flight python matlab java wireshark
162 .PHONY: uavobjects
163 uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
165 UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
166 UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
168 $(UAVOBJ_OUT_DIR):
169 $(V1) $(MKDIR) -p $@
171 uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator
172 $(V1) ( cd $(UAVOBJ_OUT_DIR) && \
173 $(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
176 uavobjects_test: $(UAVOBJ_OUT_DIR) uavobjgenerator
177 $(V1) $(UAVOBJGENERATOR) -v -none $(UAVOBJ_XML_DIR) $(ROOT_DIR)
179 uavobjects_clean:
180 @$(ECHO) " CLEAN $(call toprel, $(UAVOBJ_OUT_DIR))"
181 $(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)"
183 ##############################
185 # Flight related components
187 ##############################
189 # Define some pointers to the various important pieces of the flight code
190 # to prevent these being repeated in every sub makefile
191 export PIOS := $(ROOT_DIR)/flight/pios
192 export FLIGHTLIB := $(ROOT_DIR)/flight/libraries
193 export OPMODULEDIR := $(ROOT_DIR)/flight/modules
194 export OPUAVOBJ := $(ROOT_DIR)/flight/uavobjects
195 export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
196 export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
197 export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
199 # Define supported board lists
200 ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix
202 # Short names of each board (used to display board name in parallel builds)
203 coptercontrol_short := 'cc '
204 oplinkmini_short := 'oplm'
205 revolution_short := 'revo'
206 osd_short := 'osd '
207 revoproto_short := 'revp'
208 simposix_short := 'posx'
210 # SimPosix only builds on Linux so drop it from the list for
211 # all other platforms.
212 ifneq ($(UNAME), Linux)
213 ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
214 endif
216 # Start out assuming that we'll build fw, bl and bu for all boards
217 FW_BOARDS := $(ALL_BOARDS)
218 BL_BOARDS := $(ALL_BOARDS)
219 BU_BOARDS := $(ALL_BOARDS)
220 EF_BOARDS := $(ALL_BOARDS)
222 # SimPosix doesn't have a BL, BU or EF target so we need to
223 # filter them out to prevent errors on the all_flight target.
224 BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
225 BU_BOARDS := $(filter-out simposix, $(BU_BOARDS))
226 EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
228 # Generate the targets for whatever boards are left in each list
229 FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
230 BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
231 BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
232 EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
234 # When building any of the "all_*" targets, tell all sub makefiles to display
235 # additional details on each line of output to describe which build and target
236 # that each line applies to. The same applies also to all, opfw_resource,
237 # package and clean_package targets
238 ifneq ($(strip $(filter all_% all opfw_resource package clean_package,$(MAKECMDGOALS))),)
239 export ENABLE_MSG_EXTRA := yes
240 endif
242 # When building more than one goal in a single make invocation, also
243 # enable the extra context for each output line
244 ifneq ($(word 2,$(MAKECMDGOALS)),)
245 export ENABLE_MSG_EXTRA := yes
246 endif
248 # TEMPLATES (used to generate build rules)
250 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
251 # $(2) = Short name for board (e.g cc)
252 define FW_TEMPLATE
253 .PHONY: $(1) fw_$(1)
254 $(1): fw_$(1)_opfw
255 fw_$(1): fw_$(1)_opfw
257 fw_$(1)_%: uavobjects_flight
258 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
259 $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
260 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
261 $$(MAKE) -r --no-print-directory \
262 BUILD_TYPE=fw \
263 BOARD_NAME=$(1) \
264 BOARD_SHORT_NAME=$(2) \
265 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
266 OUTDIR=$(BUILD_DIR)/fw_$(1) \
267 TARGET=fw_$(1) \
270 .PHONY: $(1)_clean
271 $(1)_clean: fw_$(1)_clean
272 fw_$(1)_clean:
273 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/fw_$(1))"
274 $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
275 endef
277 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
278 # $(2) = Short name for board (e.g cc)
279 define BL_TEMPLATE
280 .PHONY: bl_$(1)
281 bl_$(1): bl_$(1)_bin
282 bl_$(1)_bino: bl_$(1)_bin
284 bl_$(1)_%:
285 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
286 $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
287 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
288 $$(MAKE) -r --no-print-directory \
289 BUILD_TYPE=bl \
290 BOARD_NAME=$(1) \
291 BOARD_SHORT_NAME=$(2) \
292 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
293 OUTDIR=$(BUILD_DIR)/bl_$(1) \
294 TARGET=bl_$(1) \
297 .PHONY: unbrick_$(1)
298 unbrick_$(1): bl_$(1)_hex
299 $(if $(filter-out undefined,$(origin UNBRICK_TTY)),
300 $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)"
301 $(V1) $(STM32FLASH_DIR)/stm32flash \
302 -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \
303 -g 0x0 \
304 $$(UNBRICK_TTY)
306 $(V0) @$(ECHO)
307 $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
308 $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
311 .PHONY: bl_$(1)_clean
312 bl_$(1)_clean:
313 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bl_$(1))"
314 $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
315 endef
317 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
318 # $(2) = Short name for board (e.g cc)
319 define BU_TEMPLATE
320 .PHONY: bu_$(1)
321 bu_$(1): bu_$(1)_opfw
323 bu_$(1)_%: bl_$(1)_bino
324 $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
325 $(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
326 $$(MAKE) -r --no-print-directory \
327 BUILD_TYPE=bu \
328 BOARD_NAME=$(1) \
329 BOARD_SHORT_NAME=$(2) \
330 TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
331 OUTDIR=$(BUILD_DIR)/bu_$(1) \
332 TARGET=bu_$(1) \
335 .PHONY: bu_$(1)_clean
336 bu_$(1)_clean:
337 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bu_$(1))"
338 $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
339 endef
341 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
342 # $(2) = Short name for board (e.g cc)
343 define EF_TEMPLATE
344 .PHONY: ef_$(1)
345 ef_$(1): ef_$(1)_bin
347 ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
348 $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
349 $(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
350 $$(MAKE) -r --no-print-directory \
351 BUILD_TYPE=ef \
352 BOARD_NAME=$(1) \
353 BOARD_SHORT_NAME=$(2) \
354 DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
355 TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
356 OUTDIR=$(BUILD_DIR)/ef_$(1) \
357 TARGET=ef_$(1) \
360 .PHONY: ef_$(1)_clean
361 ef_$(1)_clean:
362 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/ef_$(1))"
363 $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
364 endef
366 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
367 define BOARD_PHONY_TEMPLATE
368 .PHONY: all_$(1)
369 all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
370 all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
371 all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
372 all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
374 .PHONY: all_$(1)_clean
375 all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
376 all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
377 all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
378 all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
379 endef
381 # Generate flight build rules
382 .PHONY: all_fw all_fw_clean
383 all_fw: $(addsuffix _opfw, $(FW_TARGETS))
384 all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
386 .PHONY: all_bl all_bl_clean
387 all_bl: $(addsuffix _bin, $(BL_TARGETS))
388 all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
390 .PHONY: all_bu all_bu_clean
391 all_bu: $(addsuffix _opfw, $(BU_TARGETS))
392 all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
394 .PHONY: all_ef all_ef_clean
395 all_ef: $(EF_TARGETS)
396 all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
398 .PHONY: all_flight all_flight_clean
399 all_flight: all_fw all_bl all_bu all_ef
400 all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
402 # Expand the groups of targets for each board
403 $(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
405 # Expand the firmware rules
406 $(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_short))))
408 # Expand the bootloader rules
409 $(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_short))))
411 # Expand the bootloader updater rules
412 $(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_short))))
414 # Expand the entire-flash rules
415 $(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_short))))
417 .PHONY: sim_win32
418 sim_win32: sim_win32_exe
420 sim_win32_%: uavobjects_flight
421 $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32
422 $(V1) $(MAKE) --no-print-directory \
423 -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $*
425 .PHONY: sim_osx
426 sim_osx: sim_osx_elf
428 sim_osx_%: uavobjects_flight
429 $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx
430 $(V1) $(MAKE) --no-print-directory \
431 -C $(ROOT_DIR)/flight/targets/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
433 ##############################
435 # GCS related components
437 ##############################
439 .PHONY: all_ground
440 all_ground: openpilotgcs
442 # Convenience target for the GCS
443 .PHONY: gcs gcs_clean
444 gcs: openpilotgcs
445 gcs_clean: openpilotgcs_clean
447 ifeq ($(V), 1)
448 GCS_SILENT :=
449 else
450 GCS_SILENT := silent
451 endif
453 .NOTPARALLEL:
454 .PHONY: openpilotgcs
455 openpilotgcs: uavobjects_gcs openpilotgcs_qmake openpilotgcs_make
457 .PHONY: openpilotgcs_qmake
458 openpilotgcs_qmake:
459 ifeq ($(QMAKE_SKIP),)
460 $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
461 $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF) && \
462 $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \
464 else
465 @$(ECHO) "skipping qmake"
466 endif
468 .PHONY: openpilotgcs_make
469 openpilotgcs_make:
470 $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
471 $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \
472 $(MAKE) -w ; \
475 .PHONY: openpilotgcs_clean
476 openpilotgcs_clean:
477 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF))"
478 $(V1) [ ! -d "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)"
480 ################################
482 # Android GCS related components
484 ################################
486 # Build the output directory for the Android GCS build
487 ANDROIDGCS_OUT_DIR := $(BUILD_DIR)/androidgcs
488 $(ANDROIDGCS_OUT_DIR):
489 $(V1) $(MKDIR) -p $@
491 # Build the asset directory for the android assets
492 ANDROIDGCS_ASSETS_DIR := $(ANDROIDGCS_OUT_DIR)/assets
493 $(ANDROIDGCS_ASSETS_DIR)/uavos:
494 $(V1) $(MKDIR) -p $@
496 ifeq ($(V), 1)
497 ANT_QUIET :=
498 ANDROID_SILENT :=
499 else
500 ANT_QUIET := -q
501 ANDROID_SILENT := -s
502 endif
504 .PHONY: androidgcs
505 androidgcs: uavo-collections_java
506 $(V0) @$(ECHO) " ANDROID $(call toprel, $(ANDROIDGCS_OUT_DIR))"
507 $(V1) $(MKDIR) -p $(ANDROIDGCS_OUT_DIR)
508 $(V1) $(ANDROID) $(ANDROID_SILENT) update project \
509 --target "Google Inc.:Google APIs:$(GOOGLE_API_VERSION)" \
510 --name androidgcs \
511 --path ./androidgcs
512 $(V1) $(ANT) -f ./androidgcs/build.xml \
513 $(ANT_QUIET) \
514 -Dout.dir="../$(call toprel, $(ANDROIDGCS_OUT_DIR)/bin)" \
515 -Dgen.absolute.dir="$(ANDROIDGCS_OUT_DIR)/gen" \
516 $(ANDROIDGCS_BUILD_CONF)
518 .PHONY: androidgcs_clean
519 androidgcs_clean:
520 @$(ECHO) " CLEAN $(call toprel, $(ANDROIDGCS_OUT_DIR))"
521 $(V1) [ ! -d "$(ANDROIDGCS_OUT_DIR)" ] || $(RM) -r "$(ANDROIDGCS_OUT_DIR)"
523 # We want to take snapshots of the UAVOs at each point that they change
524 # to allow the GCS to be compatible with as many versions as possible.
525 # We always include a pseudo collection called "srctree" which represents
526 # the UAVOs in the source tree. So not necessary to add current tree UAVO
527 # hash here, it is always included.
529 # Find the git hashes of each commit that changes uavobjects with:
530 # git log --format=%h -- shared/uavobjectdefinition/ | head -n 2
531 # List only UAVO hashes of past releases, do not list current hash.
532 # Past compatible versions are so far: RELEASE-12.10.2
533 UAVO_GIT_VERSIONS := 5e14f53
535 # All versions includes also the current source tree UAVO hash
536 UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree
538 # This is where the UAVO collections are stored
539 UAVO_COLLECTION_DIR := $(BUILD_DIR)/uavo-collections
541 # $(1) git hash of a UAVO snapshot
542 define UAVO_COLLECTION_GIT_TEMPLATE
544 # Make the output directory that will contain all of the synthetics for the
545 # uavo collection referenced by the git hash $(1)
546 $$(UAVO_COLLECTION_DIR)/$(1):
547 $$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1)
549 # Extract the snapshot of shared/uavobjectdefinition from git hash $(1)
550 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1)
551 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar:
552 $$(V0) @$(ECHO) " UAVOTAR $(1)"
553 $$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/
555 # Extract the uavo xml files from our snapshot
556 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar
557 $$(V0) @$(ECHO) " UAVOUNTAR $(1)"
558 $$(V1) $(RM) -rf $$@
559 $$(V1) $(MKDIR) -p $$@
560 $$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@
561 endef
563 # Map the current working directory into the set of UAVO collections
564 $(UAVO_COLLECTION_DIR)/srctree:
565 $(V1) $(MKDIR) -p $@
567 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree
568 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR)
569 $(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml
571 # $(1) git hash (or symbolic name) of a UAVO snapshot
572 define UAVO_COLLECTION_BUILD_TEMPLATE
574 # This leaves us with a (broken) symlink that points to the full sha1sum of the collection
575 $$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
576 # Compute the sha1 hash for this UAVO collection
577 # The sed bit truncates the UAVO hash to 16 hex digits
578 $$(V1) $$(VERSION_INFO) \
579 --uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
580 --format='$$$${UAVO_HASH}' | \
581 $(SED) -e 's|\(................\).*|\1|' > $$@
583 $$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
585 # Generate the java uavobjects for this UAVO collection
586 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash
587 $$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
588 $$(V1) $(MKDIR) -p $$@
589 $$(V1) ( \
590 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
591 $$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \
594 # Build a jar file for this UAVO collection
595 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos
596 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java
597 $$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
598 $$(V1) ( \
599 HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \
600 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
601 $(JAVAC) java/*.java \
602 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \
603 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \
604 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \
605 -d . && \
606 find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \
607 $(JAR) cf tmp_uavobjects.jar @classlist.txt && \
608 $$(ANDROID_DX) \
609 --dex \
610 --output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \
611 tmp_uavobjects.jar && \
612 $(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \
615 endef
617 # One of these for each element of UAVO_GIT_VERSIONS so we can extract the UAVOs from git
618 $(foreach githash, $(UAVO_GIT_VERSIONS), $(eval $(call UAVO_COLLECTION_GIT_TEMPLATE,$(githash))))
620 # One of these for each UAVO_ALL_VERSIONS which includes the ones in the srctree
621 $(foreach githash, $(UAVO_ALL_VERSIONS), $(eval $(call UAVO_COLLECTION_BUILD_TEMPLATE,$(githash))))
623 .PHONY: uavo-collections_java
624 uavo-collections_java: $(foreach githash, $(UAVO_ALL_VERSIONS), $(UAVO_COLLECTION_DIR)/$(githash)/java-build/uavobjects.jar)
626 .PHONY: uavo-collections
627 uavo-collections: uavo-collections_java
629 .PHONY: uavo-collections_clean
630 uavo-collections_clean:
631 @$(ECHO) " CLEAN $(call toprel, $(UAVO_COLLECTION_DIR))"
632 $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR)
634 ##############################
636 # Unit Tests
638 ##############################
640 ALL_UNITTESTS := logfs
642 # Build the directory for the unit tests
643 UT_OUT_DIR := $(BUILD_DIR)/unit_tests
644 $(UT_OUT_DIR):
645 $(V1) $(MKDIR) -p $@
647 .PHONY: all_ut
648 all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
650 .PHONY: all_ut_xml
651 all_ut_xml: $(addsuffix _xml, $(addprefix ut_, $(ALL_UNITTESTS)))
653 .PHONY: all_ut_run
654 all_ut_run: $(addsuffix _run, $(addprefix ut_, $(ALL_UNITTESTS)))
656 .PHONY: all_ut_clean
657 all_ut_clean:
658 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR))"
659 $(V1) [ ! -d "$(UT_OUT_DIR)" ] || $(RM) -r "$(UT_OUT_DIR)"
661 # $(1) = Unit test name
662 define UT_TEMPLATE
663 .PHONY: ut_$(1)
664 ut_$(1): ut_$(1)_run
666 ut_$(1)_%: $$(UT_OUT_DIR)
667 $(V1) $(MKDIR) -p $(UT_OUT_DIR)/$(1)
668 $(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
669 $$(MAKE) -r --no-print-directory \
670 BUILD_TYPE=ut \
671 BOARD_SHORT_NAME=$(1) \
672 TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
673 OUTDIR="$(UT_OUT_DIR)/$(1)" \
674 TARGET=$(1) \
677 .PHONY: ut_$(1)_clean
678 ut_$(1)_clean:
679 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR)/$(1))"
680 $(V1) [ ! -d "$(UT_OUT_DIR)/$(1)" ] || $(RM) -r "$(UT_OUT_DIR)/$(1)"
681 endef
683 # Expand the unittest rules
684 $(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut))))
686 # Disable parallel make when the all_ut_run target is requested otherwise the TAP
687 # output is interleaved with the rest of the make output.
688 ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),)
689 .NOTPARALLEL:
690 $(info $(EMPTY) NOTE Parallel make disabled by all_ut_run target so we have sane console output)
691 endif
693 ##############################
695 # Packaging components
697 ##############################
699 # Firmware files to package
700 PACKAGE_FW_TARGETS := $(filter-out fw_simposix, $(FW_TARGETS))
701 PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS))
703 # Rules to generate GCS resources used to embed firmware binaries into the GCS.
704 # They are used later by the vehicle setup wizard to update board firmware.
705 # To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
706 OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc
707 OPFW_RESOURCE_PREFIX := ../../
708 OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
709 OPFW_CONTENTS := \
710 <!DOCTYPE RCC><RCC version="1.0"> \
711 <qresource prefix="/firmware"> \
712 $(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
713 </qresource> \
714 </RCC>
716 .PHONY: opfw_resource
717 opfw_resource: $(OPFW_RESOURCE)
719 $(OPFW_RESOURCE): $(FW_TARGETS)
720 @$(ECHO) Generating OPFW resource file $(call toprel, $@)
721 $(V1) $(MKDIR) -p $(dir $@)
722 $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
724 # If opfw_resource or all firmware are requested, GCS should depend on the resource
725 ifneq ($(strip $(filter opfw_resource all all_fw all_flight,$(MAKECMDGOALS))),)
726 $(eval openpilotgcs_qmake: $(OPFW_RESOURCE))
727 endif
729 # Packaging targets: package, clean_package
730 # - removes build directory (clean_package only)
731 # - builds all firmware, opfw_resource, gcs
732 # - copies firmware into a package directory
733 # - calls paltform-specific packaging script
735 # Do some checks and define some values if package is requested
736 ifneq ($(strip $(filter package clean_package,$(MAKECMDGOALS))),)
737 # Define some variables
738 export PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL})
739 export PACKAGE_NAME := OpenPilot
740 export PACKAGE_SEP := -
742 # We can only package release builds
743 ifneq ($(GCS_BUILD_CONF),release)
744 $(error Packaging is currently supported for release builds only)
745 endif
747 # Packaged GCS should depend on opfw_resource
748 ifneq ($(strip $(filter package clean_package,$(MAKECMDGOALS))),)
749 $(eval openpilotgcs: $(OPFW_RESOURCE))
750 endif
752 # Clean the build directory if clean_package is requested
753 ifneq ($(strip $(filter clean_package,$(MAKECMDGOALS))),)
754 $(info Cleaning build directory before packaging...)
755 ifneq ($(shell $(MAKE) all_clean >/dev/null 2>&1 && $(ECHO) "clean"), clean)
756 $(error Cannot clean build directory)
757 endif
759 .PHONY: clean_package
760 clean_package: package
761 endif
762 endif
764 # Copy file template. Empty line before the endef is required, do not remove
765 # $(1) = copy file name without extension
766 # $(2) = source file extension
767 # $(3) = destination file extension
768 define COPY_FW_FILES
769 $(V1) $(CP) "$(BUILD_DIR)/$(1)/$(1)$(2)" "$(PACKAGE_DIR)/firmware/$(1)$(PACKAGE_SEP)$(PACKAGE_LBL)$(3)"
771 endef
773 # Build and copy package files into the package directory
774 # and call platform-specific packaging script
775 .PHONY: package
776 package: all_fw all_ground uavobjects_matlab
777 @$(ECHO) "Packaging for $(UNAME) $(ARCH) into $(call toprel, $(PACKAGE_DIR)) directory"
778 $(V1) [ ! -d "$(PACKAGE_DIR)" ] || $(RM) -rf "$(PACKAGE_DIR)"
779 $(V1) $(MKDIR) -p "$(PACKAGE_DIR)/firmware"
780 $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call COPY_FW_FILES,$(fw_targ),.opfw,.opfw))
781 $(foreach fw_targ, $(PACKAGE_ELF_TARGETS), $(call COPY_FW_FILES,$(fw_targ),.elf,.elf))
782 $(MAKE) --no-print-directory -C $(ROOT_DIR)/package --file=$(UNAME).mk $@
784 ##############################
786 # Source code formatting
788 ##############################
790 UNCRUSTIFY_TARGETS := flight ground
792 # $(1) = Uncrustify target (e.g flight or ground)
793 # $(2) = Target root directory
794 define UNCRUSTIFY_TEMPLATE
796 .PHONY: uncrustify_$(1)
797 uncrustify_$(1):
798 @$(ECHO) "Auto-formatting $(1) source code"
799 $(V1) UNCRUSTIFY_CONFIG="$(ROOT_DIR)/make/uncrustify/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
800 endef
802 $(foreach uncrustify_targ, $(UNCRUSTIFY_TARGETS), $(eval $(call UNCRUSTIFY_TEMPLATE,$(uncrustify_targ),$(ROOT_DIR)/$(uncrustify_targ))))
804 .PHONY: uncrustify_all
805 uncrustify_all: $(addprefix uncrustify_,$(UNCRUSTIFY_TARGETS))
807 ##############################
809 # Doxygen documentation
811 # Each target should have own Doxyfile.$(target) with build directory build/docs/$(target),
812 # proper source directory (e.g. $(target)) and appropriate other doxygen options.
814 ##############################
816 DOCS_TARGETS := flight ground uavobjects
818 # $(1) = Doxygen target (e.g flight or ground)
819 define DOXYGEN_TEMPLATE
821 .PHONY: docs_$(1)
822 docs_$(1): docs_$(1)_clean
823 @$(ECHO) "Generating $(1) documentation"
824 $(V1) $(MKDIR) -p $(BUILD_DIR)/docs/$(1)
825 $(V1) $(DOXYGEN) $(ROOT_DIR)/make/doxygen/Doxyfile.$(1)
827 .PHONY: docs_$(1)_clean
828 docs_$(1)_clean:
829 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs/$(1))"
830 $(V1) [ ! -d "$(BUILD_DIR)/docs/$(1)" ] || $(RM) -r "$(BUILD_DIR)/docs/$(1)"
832 endef
834 $(foreach docs_targ, $(DOCS_TARGETS), $(eval $(call DOXYGEN_TEMPLATE,$(docs_targ))))
836 .PHONY: docs_all
837 docs_all: $(addprefix docs_,$(DOCS_TARGETS))
839 .PHONY: docs_all_clean
840 docs_all_clean:
841 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs)"
842 $(V1) [ ! -d "$(BUILD_DIR)/docs" ] || $(RM) -rf "$(BUILD_DIR)/docs"
844 ##############################
846 # Build info
848 ##############################
850 .PHONY: build-info
851 build-info:
852 @$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
853 $(V1) $(MKDIR) -p $(BUILD_DIR)
854 $(V1) $(VERSION_INFO) \
855 --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
856 --template="make/templates/$@.txt" \
857 --outfile="$(BUILD_DIR)/$@.txt"
859 ##############################
861 # Help message, the default Makefile goal
863 ##############################
865 .DEFAULT_GOAL := help
867 .PHONY: help
868 help:
869 @$(ECHO)
870 @$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment."
871 @$(ECHO) " It also works on Windows by following the instructions given on this wiki page:"
872 @$(ECHO) " http://wiki.openpilot.org/display/Doc/Windows%3A+Building+and+Packaging"
873 @$(ECHO)
874 @$(ECHO) " Here is a summary of the available targets:"
875 @$(ECHO)
876 @$(ECHO) " [Source tree preparation]"
877 @$(ECHO) " prepare - Install GIT commit message template"
878 @$(ECHO) " [Tool Installers]"
879 @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain"
880 @$(ECHO) " qt_sdk_install - Install the QT development tools"
881 @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
882 @$(ECHO) " sdl_install - Install the SDL library (Windows only)"
883 @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)"
884 @$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
885 @$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
886 @$(ECHO) " gtest_install - Install the GoogleTest framework"
887 @$(ECHO) " These targets are not updated yet and are probably broken:"
888 @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
889 @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
890 @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
891 @$(ECHO) " android_sdk_install - Install the Android SDK tools"
892 @$(ECHO) " Install all available tools:"
893 @$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
894 @$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
895 @$(ECHO)
896 @$(ECHO) " Other tool options are:"
897 @$(ECHO) " <tool>_version - Display <tool> version"
898 @$(ECHO) " <tool>_clean - Remove installed <tool>"
899 @$(ECHO) " <tool>_distclean - Remove downloaded <tool> distribution file(s)"
900 @$(ECHO)
901 @$(ECHO) " [Big Hammer]"
902 @$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs"
903 @$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters"
904 @$(ECHO) " all_fw - Build only firmware for all boards"
905 @$(ECHO) " all_bl - Build only bootloaders for all boards"
906 @$(ECHO) " all_bu - Build only bootloader updaters for all boards"
907 @$(ECHO)
908 @$(ECHO) " all_clean - Remove your build directory ($(BUILD_DIR))"
909 @$(ECHO) " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
910 @$(ECHO) " all_fw_clean - Remove firmware for all boards"
911 @$(ECHO) " all_bl_clean - Remove bootloaders for all boards"
912 @$(ECHO) " all_bu_clean - Remove bootloader updaters for all boards"
913 @$(ECHO)
914 @$(ECHO) " all_<board> - Build all available images for <board>"
915 @$(ECHO) " all_<board>_clean - Remove all available images for <board>"
916 @$(ECHO)
917 @$(ECHO) " all_ut - Build all unit tests"
918 @$(ECHO) " all_ut_tap - Run all unit tests and capture all TAP output to files"
919 @$(ECHO) " all_ut_run - Run all unit tests and dump TAP output to console"
920 @$(ECHO)
921 @$(ECHO) " [Firmware]"
922 @$(ECHO) " <board> - Build firmware for <board>"
923 @$(ECHO) " Supported boards are ($(ALL_BOARDS))"
924 @$(ECHO) " fw_<board> - Build firmware for <board>"
925 @$(ECHO) " Supported boards are ($(FW_BOARDS))"
926 @$(ECHO) " fw_<board>_clean - Remove firmware for <board>"
927 @$(ECHO) " fw_<board>_program - Use OpenOCD + JTAG to write firmware to <board>"
928 @$(ECHO)
929 @$(ECHO) " [Bootloader]"
930 @$(ECHO) " bl_<board> - Build bootloader for <board>"
931 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
932 @$(ECHO) " bl_<board>_clean - Remove bootloader for <board>"
933 @$(ECHO) " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
934 @$(ECHO)
935 @$(ECHO) " [Entire Flash]"
936 @$(ECHO) " ef_<board> - Build entire flash image for <board>"
937 @$(ECHO) " Supported boards are ($(EF_BOARDS))"
938 @$(ECHO) " ef_<board>_clean - Remove entire flash image for <board>"
939 @$(ECHO) " ef_<board>_program - Use OpenOCD + JTAG to write entire flash image to <board>"
940 @$(ECHO)
941 @$(ECHO) " [Bootloader Updater]"
942 @$(ECHO) " bu_<board> - Build bootloader updater for <board>"
943 @$(ECHO) " Supported boards are ($(BU_BOARDS))"
944 @$(ECHO) " bu_<board>_clean - Remove bootloader updater for <board>"
945 @$(ECHO)
946 @$(ECHO) " [Unbrick a board]"
947 @$(ECHO) " unbrick_<board> - Use the STM32's built in boot ROM to write a bootloader to <board>"
948 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
949 @$(ECHO) " [Unittests]"
950 @$(ECHO) " ut_<test> - Build unit test <test>"
951 @$(ECHO) " ut_<test>_xml - Run test and capture XML output into a file"
952 @$(ECHO) " ut_<test>_run - Run test and dump output to console"
953 @$(ECHO)
954 @$(ECHO) " [Simulation]"
955 @$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
956 @$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
957 @$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
958 @$(ECHO) " using mingw and msys"
959 @$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
960 @$(ECHO)
961 @$(ECHO) " [GCS]"
962 @$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)"
963 @$(ECHO) " Skip qmake: QMAKE_SKIP=1"
964 @$(ECHO) " Compile specific directory: MAKE_DIR=<dir>"
965 @$(ECHO) " Example: make gcs QMAKE_SKIP=1 MAKE_DIR=src/plugins/coreplugin"
966 @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)"
967 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
968 @$(ECHO)
969 @$(ECHO) " [AndroidGCS]"
970 @$(ECHO) " androidgcs - Build the Android Ground Control System (GCS) application"
971 @$(ECHO) " androidgcs_install - Use ADB to install the Android GCS application"
972 @$(ECHO) " androidgcs_run - Run the Android GCS application"
973 @$(ECHO) " androidgcs_clean - Remove the Android GCS application"
974 @$(ECHO)
975 @$(ECHO) " [UAVObjects]"
976 @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files"
977 @$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..."
978 @$(ECHO) " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
979 @$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
980 @$(ECHO)
981 @$(ECHO) " [Packaging]"
982 @$(ECHO) " clean_package - Clean, build and package the OpenPilot platform-dependent package"
983 @$(ECHO) " package - Build and package the OpenPilot platform-dependent package (no clean)"
984 @$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
985 @$(ECHO)
986 @$(ECHO) " [Code Formatting]"
987 @$(ECHO) " uncrustify_<source> - Reformat <source> code according to the project's standards"
988 @$(ECHO) " Supported sources are ($(UNCRUSTIFY_TARGETS))"
989 @$(ECHO) " uncrustify_all - Reformat all source code"
990 @$(ECHO)
991 @$(ECHO) " [Code Documentation]"
992 @$(ECHO) " docs_<source> - Generate HTML documentation for <source>"
993 @$(ECHO) " Supported sources are ($(DOCS_TARGETS))"
994 @$(ECHO) " docs_all - Generate HTML documentation for all"
995 @$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
996 @$(ECHO) " docs_all_clean - Delete all generated documentation"
997 @$(ECHO)
998 @$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
999 @$(ECHO)
1000 @$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
1001 @$(ECHO) " All tools will be installed into $(TOOLS_DIR)"
1002 @$(ECHO) " All build output will be placed in $(BUILD_DIR)"
1003 @$(ECHO)
1004 @$(ECHO) " Tool download and install directories can be changed using environment variables:"
1005 @$(ECHO) " OPENPILOT_DL_DIR full path to downloads directory [downloads if not set]"
1006 @$(ECHO) " OPENPILOT_TOOLS_DIR full path to installed tools directory [tools if not set]"
1007 @$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
1008 @$(ECHO)