OP-1516 fixed boundf mistake
[librepilot.git] / Makefile
blob1bfdd426974c6f56c7d6a012c270c51804d03b64
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 discoveryf4bare gpsplatinum
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'
209 discoveryf4bare_short := 'df4b'
210 gpsplatinum_short := 'gps9 '
212 # SimPosix only builds on Linux so drop it from the list for
213 # all other platforms.
214 ifneq ($(UNAME), Linux)
215 ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
216 endif
218 # Start out assuming that we'll build fw, bl and bu for all boards
219 FW_BOARDS := $(ALL_BOARDS)
220 BL_BOARDS := $(ALL_BOARDS)
221 BU_BOARDS := $(ALL_BOARDS)
222 EF_BOARDS := $(ALL_BOARDS)
224 # SimPosix doesn't have a BL, BU or EF target so we need to
225 # filter them out to prevent errors on the all_flight target.
226 BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
227 BU_BOARDS := $(filter-out simposix gpsplatinum, $(BU_BOARDS))
228 EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
230 # Generate the targets for whatever boards are left in each list
231 FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
232 BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
233 BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
234 EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
236 # When building any of the "all_*" targets, tell all sub makefiles to display
237 # additional details on each line of output to describe which build and target
238 # that each line applies to. The same applies also to all, opfw_resource,
239 # package and clean_package targets
240 ifneq ($(strip $(filter all_% all opfw_resource package clean_package,$(MAKECMDGOALS))),)
241 export ENABLE_MSG_EXTRA := yes
242 endif
244 # When building more than one goal in a single make invocation, also
245 # enable the extra context for each output line
246 ifneq ($(word 2,$(MAKECMDGOALS)),)
247 export ENABLE_MSG_EXTRA := yes
248 endif
250 # TEMPLATES (used to generate build rules)
252 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
253 # $(2) = Short name for board (e.g cc)
254 define FW_TEMPLATE
255 .PHONY: $(1) fw_$(1)
256 $(1): fw_$(1)_opfw
257 fw_$(1): fw_$(1)_opfw
259 fw_$(1)_%: uavobjects_flight
260 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
261 $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
262 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
263 $$(MAKE) -r --no-print-directory \
264 BUILD_TYPE=fw \
265 BOARD_NAME=$(1) \
266 BOARD_SHORT_NAME=$(2) \
267 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
268 OUTDIR=$(BUILD_DIR)/fw_$(1) \
269 TARGET=fw_$(1) \
272 .PHONY: $(1)_clean
273 $(1)_clean: fw_$(1)_clean
274 fw_$(1)_clean:
275 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/fw_$(1))"
276 $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
277 endef
279 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
280 # $(2) = Short name for board (e.g cc)
281 define BL_TEMPLATE
282 .PHONY: bl_$(1)
283 bl_$(1): bl_$(1)_bin
284 bl_$(1)_bino: bl_$(1)_bin
286 bl_$(1)_%:
287 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
288 $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
289 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
290 $$(MAKE) -r --no-print-directory \
291 BUILD_TYPE=bl \
292 BOARD_NAME=$(1) \
293 BOARD_SHORT_NAME=$(2) \
294 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
295 OUTDIR=$(BUILD_DIR)/bl_$(1) \
296 TARGET=bl_$(1) \
299 .PHONY: unbrick_$(1)
300 unbrick_$(1): bl_$(1)_hex
301 $(if $(filter-out undefined,$(origin UNBRICK_TTY)),
302 $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)"
303 $(V1) $(STM32FLASH_DIR)/stm32flash \
304 -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \
305 -g 0x0 \
306 $$(UNBRICK_TTY)
308 $(V0) @$(ECHO)
309 $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
310 $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
313 .PHONY: bl_$(1)_clean
314 bl_$(1)_clean:
315 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bl_$(1))"
316 $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
317 endef
319 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
320 # $(2) = Short name for board (e.g cc)
321 define BU_TEMPLATE
322 .PHONY: bu_$(1)
323 bu_$(1): bu_$(1)_opfw
325 bu_$(1)_%: bl_$(1)_bino
326 $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
327 $(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
328 $$(MAKE) -r --no-print-directory \
329 BUILD_TYPE=bu \
330 BOARD_NAME=$(1) \
331 BOARD_SHORT_NAME=$(2) \
332 TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
333 OUTDIR=$(BUILD_DIR)/bu_$(1) \
334 TARGET=bu_$(1) \
337 .PHONY: bu_$(1)_clean
338 bu_$(1)_clean:
339 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bu_$(1))"
340 $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
341 endef
343 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
344 # $(2) = Short name for board (e.g cc)
345 define EF_TEMPLATE
346 .PHONY: ef_$(1)
347 ef_$(1): ef_$(1)_bin
349 ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
350 $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
351 $(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
352 $$(MAKE) -r --no-print-directory \
353 BUILD_TYPE=ef \
354 BOARD_NAME=$(1) \
355 BOARD_SHORT_NAME=$(2) \
356 DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
357 TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
358 OUTDIR=$(BUILD_DIR)/ef_$(1) \
359 TARGET=ef_$(1) \
362 .PHONY: ef_$(1)_clean
363 ef_$(1)_clean:
364 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/ef_$(1))"
365 $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
366 endef
368 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
369 define BOARD_PHONY_TEMPLATE
370 .PHONY: all_$(1)
371 all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
372 all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
373 all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
374 all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
376 .PHONY: all_$(1)_clean
377 all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
378 all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
379 all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
380 all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
381 endef
383 # Generate flight build rules
384 .PHONY: all_fw all_fw_clean
385 all_fw: $(addsuffix _opfw, $(FW_TARGETS))
386 all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
388 .PHONY: all_bl all_bl_clean
389 all_bl: $(addsuffix _bin, $(BL_TARGETS))
390 all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
392 .PHONY: all_bu all_bu_clean
393 all_bu: $(addsuffix _opfw, $(BU_TARGETS))
394 all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
396 .PHONY: all_ef all_ef_clean
397 all_ef: $(EF_TARGETS)
398 all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
400 .PHONY: all_flight all_flight_clean
401 all_flight: all_fw all_bl all_bu all_ef
402 all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
404 # Expand the groups of targets for each board
405 $(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
407 # Expand the firmware rules
408 $(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_short))))
410 # Expand the bootloader rules
411 $(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_short))))
413 # Expand the bootloader updater rules
414 $(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_short))))
416 # Expand the entire-flash rules
417 $(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_short))))
419 .PHONY: sim_win32
420 sim_win32: sim_win32_exe
422 sim_win32_%: uavobjects_flight
423 $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32
424 $(V1) $(MAKE) --no-print-directory \
425 -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $*
427 .PHONY: sim_osx
428 sim_osx: sim_osx_elf
430 sim_osx_%: uavobjects_flight
431 $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx
432 $(V1) $(MAKE) --no-print-directory \
433 -C $(ROOT_DIR)/flight/targets/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
435 ##############################
437 # GCS related components
439 ##############################
441 .PHONY: all_ground
442 all_ground: openpilotgcs uploader
444 # Convenience target for the GCS
445 .PHONY: gcs gcs_clean
446 gcs: openpilotgcs
447 gcs_clean: openpilotgcs_clean
449 ifeq ($(V), 1)
450 GCS_SILENT :=
451 else
452 GCS_SILENT := silent
453 endif
455 .NOTPARALLEL:
456 .PHONY: openpilotgcs
457 openpilotgcs: uavobjects_gcs openpilotgcs_qmake openpilotgcs_make
459 .PHONY: openpilotgcs_qmake
460 openpilotgcs_qmake:
461 ifeq ($(QMAKE_SKIP),)
462 $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
463 $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF) && \
464 $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \
466 else
467 @$(ECHO) "skipping qmake"
468 endif
470 .PHONY: openpilotgcs_make
471 openpilotgcs_make:
472 $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
473 $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \
474 $(MAKE) -w ; \
477 .PHONY: openpilotgcs_clean
478 openpilotgcs_clean:
479 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF))"
480 $(V1) [ ! -d "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)"
482 ################################
484 # Serial Uploader tool
486 ################################
488 .NOTPARALLEL:
489 .PHONY: uploader
490 uploader: uploader_qmake uploader_make
492 .PHONY: uploader_qmake
493 uploader_qmake:
494 ifeq ($(QMAKE_SKIP),)
495 $(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
496 $(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF) && \
497 $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/upload.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \
499 else
500 @$(ECHO) "skipping qmake"
501 endif
503 .PHONY: uploader_make
504 uploader_make:
505 $(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
506 $(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \
507 $(MAKE) -w ; \
510 .PHONY: uploader_clean
511 uploader_clean:
512 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF))"
513 $(V1) [ ! -d "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)"
516 ################################
518 # Android GCS related components
520 ################################
522 # Build the output directory for the Android GCS build
523 ANDROIDGCS_OUT_DIR := $(BUILD_DIR)/androidgcs
524 $(ANDROIDGCS_OUT_DIR):
525 $(V1) $(MKDIR) -p $@
527 # Build the asset directory for the android assets
528 ANDROIDGCS_ASSETS_DIR := $(ANDROIDGCS_OUT_DIR)/assets
529 $(ANDROIDGCS_ASSETS_DIR)/uavos:
530 $(V1) $(MKDIR) -p $@
532 ifeq ($(V), 1)
533 ANT_QUIET :=
534 ANDROID_SILENT :=
535 else
536 ANT_QUIET := -q
537 ANDROID_SILENT := -s
538 endif
540 .PHONY: androidgcs
541 androidgcs: uavo-collections_java
542 $(V0) @$(ECHO) " ANDROID $(call toprel, $(ANDROIDGCS_OUT_DIR))"
543 $(V1) $(MKDIR) -p $(ANDROIDGCS_OUT_DIR)
544 $(V1) $(ANDROID) $(ANDROID_SILENT) update project \
545 --target "Google Inc.:Google APIs:$(GOOGLE_API_VERSION)" \
546 --name androidgcs \
547 --path ./androidgcs
548 $(V1) $(ANT) -f ./androidgcs/build.xml \
549 $(ANT_QUIET) \
550 -Dout.dir="../$(call toprel, $(ANDROIDGCS_OUT_DIR)/bin)" \
551 -Dgen.absolute.dir="$(ANDROIDGCS_OUT_DIR)/gen" \
552 $(ANDROIDGCS_BUILD_CONF)
554 .PHONY: androidgcs_clean
555 androidgcs_clean:
556 @$(ECHO) " CLEAN $(call toprel, $(ANDROIDGCS_OUT_DIR))"
557 $(V1) [ ! -d "$(ANDROIDGCS_OUT_DIR)" ] || $(RM) -r "$(ANDROIDGCS_OUT_DIR)"
559 # We want to take snapshots of the UAVOs at each point that they change
560 # to allow the GCS to be compatible with as many versions as possible.
561 # We always include a pseudo collection called "srctree" which represents
562 # the UAVOs in the source tree. So not necessary to add current tree UAVO
563 # hash here, it is always included.
565 # Find the git hashes of each commit that changes uavobjects with:
566 # git log --format=%h -- shared/uavobjectdefinition/ | head -n 2
567 # List only UAVO hashes of past releases, do not list current hash.
568 # Past compatible versions are so far: RELEASE-12.10.2
569 UAVO_GIT_VERSIONS := 5e14f53
571 # All versions includes also the current source tree UAVO hash
572 UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree
574 # This is where the UAVO collections are stored
575 UAVO_COLLECTION_DIR := $(BUILD_DIR)/uavo-collections
577 # $(1) git hash of a UAVO snapshot
578 define UAVO_COLLECTION_GIT_TEMPLATE
580 # Make the output directory that will contain all of the synthetics for the
581 # uavo collection referenced by the git hash $(1)
582 $$(UAVO_COLLECTION_DIR)/$(1):
583 $$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1)
585 # Extract the snapshot of shared/uavobjectdefinition from git hash $(1)
586 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1)
587 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar:
588 $$(V0) @$(ECHO) " UAVOTAR $(1)"
589 $$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/
591 # Extract the uavo xml files from our snapshot
592 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar
593 $$(V0) @$(ECHO) " UAVOUNTAR $(1)"
594 $$(V1) $(RM) -rf $$@
595 $$(V1) $(MKDIR) -p $$@
596 $$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@
597 endef
599 # Map the current working directory into the set of UAVO collections
600 $(UAVO_COLLECTION_DIR)/srctree:
601 $(V1) $(MKDIR) -p $@
603 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree
604 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR)
605 $(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml
607 # $(1) git hash (or symbolic name) of a UAVO snapshot
608 define UAVO_COLLECTION_BUILD_TEMPLATE
610 # This leaves us with a (broken) symlink that points to the full sha1sum of the collection
611 $$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
612 # Compute the sha1 hash for this UAVO collection
613 # The sed bit truncates the UAVO hash to 16 hex digits
614 $$(V1) $$(VERSION_INFO) \
615 --uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
616 --format='$$$${UAVO_HASH}' | \
617 $(SED) -e 's|\(................\).*|\1|' > $$@
619 $$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
621 # Generate the java uavobjects for this UAVO collection
622 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash
623 $$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
624 $$(V1) $(MKDIR) -p $$@
625 $$(V1) ( \
626 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
627 $$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \
630 # Build a jar file for this UAVO collection
631 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos
632 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java
633 $$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
634 $$(V1) ( \
635 HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \
636 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
637 $(JAVAC) java/*.java \
638 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \
639 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \
640 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \
641 -d . && \
642 find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \
643 $(JAR) cf tmp_uavobjects.jar @classlist.txt && \
644 $$(ANDROID_DX) \
645 --dex \
646 --output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \
647 tmp_uavobjects.jar && \
648 $(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \
651 endef
653 # One of these for each element of UAVO_GIT_VERSIONS so we can extract the UAVOs from git
654 $(foreach githash, $(UAVO_GIT_VERSIONS), $(eval $(call UAVO_COLLECTION_GIT_TEMPLATE,$(githash))))
656 # One of these for each UAVO_ALL_VERSIONS which includes the ones in the srctree
657 $(foreach githash, $(UAVO_ALL_VERSIONS), $(eval $(call UAVO_COLLECTION_BUILD_TEMPLATE,$(githash))))
659 .PHONY: uavo-collections_java
660 uavo-collections_java: $(foreach githash, $(UAVO_ALL_VERSIONS), $(UAVO_COLLECTION_DIR)/$(githash)/java-build/uavobjects.jar)
662 .PHONY: uavo-collections
663 uavo-collections: uavo-collections_java
665 .PHONY: uavo-collections_clean
666 uavo-collections_clean:
667 @$(ECHO) " CLEAN $(call toprel, $(UAVO_COLLECTION_DIR))"
668 $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR)
670 ##############################
672 # Unit Tests
674 ##############################
676 ALL_UNITTESTS := logfs math lednotification
678 # Build the directory for the unit tests
679 UT_OUT_DIR := $(BUILD_DIR)/unit_tests
680 $(UT_OUT_DIR):
681 $(V1) $(MKDIR) -p $@
683 .PHONY: all_ut
684 all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
686 .PHONY: all_ut_xml
687 all_ut_xml: $(addsuffix _xml, $(addprefix ut_, $(ALL_UNITTESTS)))
689 .PHONY: all_ut_run
690 all_ut_run: $(addsuffix _run, $(addprefix ut_, $(ALL_UNITTESTS)))
692 .PHONY: all_ut_clean
693 all_ut_clean:
694 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR))"
695 $(V1) [ ! -d "$(UT_OUT_DIR)" ] || $(RM) -r "$(UT_OUT_DIR)"
697 # $(1) = Unit test name
698 define UT_TEMPLATE
699 .PHONY: ut_$(1)
700 ut_$(1): ut_$(1)_run
702 ut_$(1)_%: $$(UT_OUT_DIR)
703 $(V1) $(MKDIR) -p $(UT_OUT_DIR)/$(1)
704 $(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
705 $$(MAKE) -r --no-print-directory \
706 BUILD_TYPE=ut \
707 BOARD_SHORT_NAME=$(1) \
708 TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
709 OUTDIR="$(UT_OUT_DIR)/$(1)" \
710 TARGET=$(1) \
713 .PHONY: ut_$(1)_clean
714 ut_$(1)_clean:
715 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR)/$(1))"
716 $(V1) [ ! -d "$(UT_OUT_DIR)/$(1)" ] || $(RM) -r "$(UT_OUT_DIR)/$(1)"
717 endef
719 # Expand the unittest rules
720 $(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut))))
722 # Disable parallel make when the all_ut_run target is requested otherwise the TAP
723 # output is interleaved with the rest of the make output.
724 ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),)
725 .NOTPARALLEL:
726 $(info $(EMPTY) NOTE Parallel make disabled by all_ut_run target so we have sane console output)
727 endif
729 ##############################
731 # Packaging components
733 ##############################
735 # Firmware files to package
736 PACKAGE_FW_EXCLUDE := fw_simposix $(if $(PACKAGE_FW_INCLUDE_DISCOVERYF4BARE),,fw_discoveryf4bare)
737 PACKAGE_FW_TARGETS := $(filter-out $(PACKAGE_FW_EXCLUDE), $(FW_TARGETS))
738 PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS))
740 # Rules to generate GCS resources used to embed firmware binaries into the GCS.
741 # They are used later by the vehicle setup wizard to update board firmware.
742 # To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
743 OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc
744 OPFW_RESOURCE_PREFIX := ../../
745 OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
746 OPFW_CONTENTS := \
747 <!DOCTYPE RCC><RCC version="1.0"> \
748 <qresource prefix="/firmware"> \
749 $(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
750 </qresource> \
751 </RCC>
753 .PHONY: opfw_resource
754 opfw_resource: $(OPFW_RESOURCE)
756 $(OPFW_RESOURCE): $(FW_TARGETS)
757 @$(ECHO) Generating OPFW resource file $(call toprel, $@)
758 $(V1) $(MKDIR) -p $(dir $@)
759 $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
761 # If opfw_resource or all firmware are requested, GCS should depend on the resource
762 ifneq ($(strip $(filter opfw_resource all all_fw all_flight,$(MAKECMDGOALS))),)
763 $(eval openpilotgcs_qmake: $(OPFW_RESOURCE))
764 endif
766 # Packaging targets: package, clean_package
767 # - removes build directory (clean_package only)
768 # - builds all firmware, opfw_resource, gcs
769 # - copies firmware into a package directory
770 # - calls paltform-specific packaging script
772 # Do some checks and define some values if package is requested
773 ifneq ($(strip $(filter package clean_package,$(MAKECMDGOALS))),)
774 # Define some variables
775 export PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL})
776 export PACKAGE_NAME := OpenPilot
777 export PACKAGE_SEP := -
779 # Copy the Qt libraries regardless whether the building machine needs them to run GCS
780 export FORCE_COPY_QT := true
782 # We can only package release builds
783 ifneq ($(GCS_BUILD_CONF),release)
784 $(error Packaging is currently supported for release builds only)
785 endif
787 # Packaged GCS should depend on opfw_resource
788 ifneq ($(strip $(filter package clean_package,$(MAKECMDGOALS))),)
789 $(eval openpilotgcs_qmake: $(OPFW_RESOURCE))
790 endif
792 # Clean the build directory if clean_package is requested
793 ifneq ($(strip $(filter clean_package,$(MAKECMDGOALS))),)
794 $(info Cleaning build directory before packaging...)
795 ifneq ($(shell $(MAKE) all_clean >/dev/null 2>&1 && $(ECHO) "clean"), clean)
796 $(error Cannot clean build directory)
797 endif
799 .PHONY: clean_package
800 clean_package: package
801 endif
802 endif
804 # Copy file template. Empty line before the endef is required, do not remove
805 # $(1) = copy file name without extension
806 # $(2) = source file extension
807 # $(3) = destination file extension
808 define COPY_FW_FILES
809 $(V1) $(CP) "$(BUILD_DIR)/$(1)/$(1)$(2)" "$(PACKAGE_DIR)/firmware/$(1)$(PACKAGE_SEP)$(PACKAGE_LBL)$(3)"
811 endef
813 # Build and copy package files into the package directory
814 # and call platform-specific packaging script
815 .PHONY: package
816 package: all_fw all_ground uavobjects_matlab
817 @$(ECHO) "Packaging for $(UNAME) $(ARCH) into $(call toprel, $(PACKAGE_DIR)) directory"
818 $(V1) [ ! -d "$(PACKAGE_DIR)" ] || $(RM) -rf "$(PACKAGE_DIR)"
819 $(V1) $(MKDIR) -p "$(PACKAGE_DIR)/firmware"
820 $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call COPY_FW_FILES,$(fw_targ),.opfw,.opfw))
821 $(foreach fw_targ, $(PACKAGE_ELF_TARGETS), $(call COPY_FW_FILES,$(fw_targ),.elf,.elf))
822 $(MAKE) --no-print-directory -C $(ROOT_DIR)/package --file=$(UNAME).mk $@
824 ##############################
826 # Source code formatting
828 ##############################
830 UNCRUSTIFY_TARGETS := flight ground
832 # $(1) = Uncrustify target (e.g flight or ground)
833 # $(2) = Target root directory
834 define UNCRUSTIFY_TEMPLATE
836 .PHONY: uncrustify_$(1)
837 uncrustify_$(1):
838 @$(ECHO) "Auto-formatting $(1) source code"
839 $(V1) UNCRUSTIFY_CONFIG="$(ROOT_DIR)/make/uncrustify/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
840 endef
842 $(foreach uncrustify_targ, $(UNCRUSTIFY_TARGETS), $(eval $(call UNCRUSTIFY_TEMPLATE,$(uncrustify_targ),$(ROOT_DIR)/$(uncrustify_targ))))
844 .PHONY: uncrustify_all
845 uncrustify_all: $(addprefix uncrustify_,$(UNCRUSTIFY_TARGETS))
847 ##############################
849 # Doxygen documentation
851 # Each target should have own Doxyfile.$(target) with build directory build/docs/$(target),
852 # proper source directory (e.g. $(target)) and appropriate other doxygen options.
854 ##############################
856 DOCS_TARGETS := flight ground uavobjects
858 # $(1) = Doxygen target (e.g flight or ground)
859 define DOXYGEN_TEMPLATE
861 .PHONY: docs_$(1)
862 docs_$(1): docs_$(1)_clean
863 @$(ECHO) "Generating $(1) documentation"
864 $(V1) $(MKDIR) -p $(BUILD_DIR)/docs/$(1)
865 $(V1) $(DOXYGEN) $(ROOT_DIR)/make/doxygen/Doxyfile.$(1)
867 .PHONY: docs_$(1)_clean
868 docs_$(1)_clean:
869 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs/$(1))"
870 $(V1) [ ! -d "$(BUILD_DIR)/docs/$(1)" ] || $(RM) -r "$(BUILD_DIR)/docs/$(1)"
872 endef
874 $(foreach docs_targ, $(DOCS_TARGETS), $(eval $(call DOXYGEN_TEMPLATE,$(docs_targ))))
876 .PHONY: docs_all
877 docs_all: $(addprefix docs_,$(DOCS_TARGETS))
879 .PHONY: docs_all_clean
880 docs_all_clean:
881 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs)"
882 $(V1) [ ! -d "$(BUILD_DIR)/docs" ] || $(RM) -rf "$(BUILD_DIR)/docs"
884 ##############################
886 # Build info
888 ##############################
890 .PHONY: build-info
891 build-info:
892 @$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
893 $(V1) $(MKDIR) -p $(BUILD_DIR)
894 $(V1) $(VERSION_INFO) \
895 --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
896 --template="make/templates/$@.txt" \
897 --outfile="$(BUILD_DIR)/$@.txt"
899 ##############################
901 # Help message, the default Makefile goal
903 ##############################
905 .DEFAULT_GOAL := help
907 .PHONY: help
908 help:
909 @$(ECHO)
910 @$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment."
911 @$(ECHO) " It also works on Windows by following the instructions given on this wiki page:"
912 @$(ECHO) " http://wiki.openpilot.org/display/Doc/Windows%3A+Building+and+Packaging"
913 @$(ECHO)
914 @$(ECHO) " Here is a summary of the available targets:"
915 @$(ECHO)
916 @$(ECHO) " [Source tree preparation]"
917 @$(ECHO) " prepare - Install GIT commit message template"
918 @$(ECHO) " [Tool Installers]"
919 @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain"
920 @$(ECHO) " qt_sdk_install - Install the QT development tools"
921 @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
922 @$(ECHO) " sdl_install - Install the SDL library (Windows only)"
923 @$(ECHO) " mesawin_install - Install the OpenGL32 DLL (Windows only)"
924 @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)"
925 @$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
926 @$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
927 @$(ECHO) " gtest_install - Install the GoogleTest framework"
928 @$(ECHO) " These targets are not updated yet and are probably broken:"
929 @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
930 @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
931 @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
932 @$(ECHO) " android_sdk_install - Install the Android SDK tools"
933 @$(ECHO) " Install all available tools:"
934 @$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
935 @$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
936 @$(ECHO)
937 @$(ECHO) " Other tool options are:"
938 @$(ECHO) " <tool>_version - Display <tool> version"
939 @$(ECHO) " <tool>_clean - Remove installed <tool>"
940 @$(ECHO) " <tool>_distclean - Remove downloaded <tool> distribution file(s)"
941 @$(ECHO)
942 @$(ECHO) " [Big Hammer]"
943 @$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs"
944 @$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters"
945 @$(ECHO) " all_fw - Build only firmware for all boards"
946 @$(ECHO) " all_bl - Build only bootloaders for all boards"
947 @$(ECHO) " all_bu - Build only bootloader updaters for all boards"
948 @$(ECHO)
949 @$(ECHO) " all_clean - Remove your build directory ($(BUILD_DIR))"
950 @$(ECHO) " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
951 @$(ECHO) " all_fw_clean - Remove firmware for all boards"
952 @$(ECHO) " all_bl_clean - Remove bootloaders for all boards"
953 @$(ECHO) " all_bu_clean - Remove bootloader updaters for all boards"
954 @$(ECHO)
955 @$(ECHO) " all_<board> - Build all available images for <board>"
956 @$(ECHO) " all_<board>_clean - Remove all available images for <board>"
957 @$(ECHO)
958 @$(ECHO) " all_ut - Build all unit tests"
959 @$(ECHO) " all_ut_tap - Run all unit tests and capture all TAP output to files"
960 @$(ECHO) " all_ut_run - Run all unit tests and dump TAP output to console"
961 @$(ECHO)
962 @$(ECHO) " [Firmware]"
963 @$(ECHO) " <board> - Build firmware for <board>"
964 @$(ECHO) " Supported boards are ($(ALL_BOARDS))"
965 @$(ECHO) " fw_<board> - Build firmware for <board>"
966 @$(ECHO) " Supported boards are ($(FW_BOARDS))"
967 @$(ECHO) " fw_<board>_clean - Remove firmware for <board>"
968 @$(ECHO) " fw_<board>_program - Use OpenOCD + JTAG to write firmware to <board>"
969 @$(ECHO)
970 @$(ECHO) " [Bootloader]"
971 @$(ECHO) " bl_<board> - Build bootloader for <board>"
972 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
973 @$(ECHO) " bl_<board>_clean - Remove bootloader for <board>"
974 @$(ECHO) " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
975 @$(ECHO)
976 @$(ECHO) " [Entire Flash]"
977 @$(ECHO) " ef_<board> - Build entire flash image for <board>"
978 @$(ECHO) " Supported boards are ($(EF_BOARDS))"
979 @$(ECHO) " ef_<board>_clean - Remove entire flash image for <board>"
980 @$(ECHO) " ef_<board>_program - Use OpenOCD + JTAG to write entire flash image to <board>"
981 @$(ECHO)
982 @$(ECHO) " [Bootloader Updater]"
983 @$(ECHO) " bu_<board> - Build bootloader updater for <board>"
984 @$(ECHO) " Supported boards are ($(BU_BOARDS))"
985 @$(ECHO) " bu_<board>_clean - Remove bootloader updater for <board>"
986 @$(ECHO)
987 @$(ECHO) " [Unbrick a board]"
988 @$(ECHO) " unbrick_<board> - Use the STM32's built in boot ROM to write a bootloader to <board>"
989 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
990 @$(ECHO) " [Unittests]"
991 @$(ECHO) " ut_<test> - Build unit test <test>"
992 @$(ECHO) " ut_<test>_xml - Run test and capture XML output into a file"
993 @$(ECHO) " ut_<test>_run - Run test and dump output to console"
994 @$(ECHO)
995 @$(ECHO) " [Simulation]"
996 @$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
997 @$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
998 @$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
999 @$(ECHO) " using mingw and msys"
1000 @$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
1001 @$(ECHO)
1002 @$(ECHO) " [GCS]"
1003 @$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)"
1004 @$(ECHO) " Skip qmake: QMAKE_SKIP=1"
1005 @$(ECHO) " Compile specific directory: MAKE_DIR=<dir>"
1006 @$(ECHO) " Example: make gcs QMAKE_SKIP=1 MAKE_DIR=src/plugins/coreplugin"
1007 @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)"
1008 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
1009 @$(ECHO)
1010 @$(ECHO) " [Uploader Tool]"
1011 @$(ECHO) " uploader - Build the serial uploader tool (debug|release)"
1012 @$(ECHO) " Skip qmake: QMAKE_SKIP=1"
1013 @$(ECHO) " Example: make uploader QMAKE_SKIP=1"
1014 @$(ECHO) " uploader_clean - Remove the serial uploader tool (debug|release)"
1015 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
1016 @$(ECHO)
1017 @$(ECHO)
1018 @$(ECHO) " [AndroidGCS]"
1019 @$(ECHO) " androidgcs - Build the Android Ground Control System (GCS) application"
1020 @$(ECHO) " androidgcs_install - Use ADB to install the Android GCS application"
1021 @$(ECHO) " androidgcs_run - Run the Android GCS application"
1022 @$(ECHO) " androidgcs_clean - Remove the Android GCS application"
1023 @$(ECHO)
1024 @$(ECHO) " [UAVObjects]"
1025 @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files"
1026 @$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..."
1027 @$(ECHO) " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
1028 @$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
1029 @$(ECHO)
1030 @$(ECHO) " [Packaging]"
1031 @$(ECHO) " clean_package - Clean, build and package the OpenPilot platform-dependent package"
1032 @$(ECHO) " package - Build and package the OpenPilot platform-dependent package (no clean)"
1033 @$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
1034 @$(ECHO)
1035 @$(ECHO) " [Code Formatting]"
1036 @$(ECHO) " uncrustify_<source> - Reformat <source> code according to the project's standards"
1037 @$(ECHO) " Supported sources are ($(UNCRUSTIFY_TARGETS))"
1038 @$(ECHO) " uncrustify_all - Reformat all source code"
1039 @$(ECHO)
1040 @$(ECHO) " [Code Documentation]"
1041 @$(ECHO) " docs_<source> - Generate HTML documentation for <source>"
1042 @$(ECHO) " Supported sources are ($(DOCS_TARGETS))"
1043 @$(ECHO) " docs_all - Generate HTML documentation for all"
1044 @$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
1045 @$(ECHO) " docs_all_clean - Delete all generated documentation"
1046 @$(ECHO)
1047 @$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
1048 @$(ECHO)
1049 @$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
1050 @$(ECHO) " All tools will be installed into $(TOOLS_DIR)"
1051 @$(ECHO) " All build output will be placed in $(BUILD_DIR)"
1052 @$(ECHO)
1053 @$(ECHO) " Tool download and install directories can be changed using environment variables:"
1054 @$(ECHO) " OPENPILOT_DL_DIR full path to downloads directory [downloads if not set]"
1055 @$(ECHO) " OPENPILOT_TOOLS_DIR full path to installed tools directory [tools if not set]"
1056 @$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
1057 @$(ECHO)