OP-1822 Check visibility and avoid false error that skip Mixer table to populate
[librepilot.git] / Makefile
blob97ff2d923b49821427dec93911caa2ca8e60751d
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
50 export DIST_DIR := $(ROOT_DIR)/build/dist
52 # Set up default build configurations (debug | release)
53 GCS_BUILD_CONF := release
54 UAVOGEN_BUILD_CONF := release
55 ANDROIDGCS_BUILD_CONF := debug
56 GOOGLE_API_VERSION := 14
58 # Clean out undesirable variables from the environment and command-line
59 # to remove the chance that they will cause problems with our build
60 define SANITIZE_VAR
61 $(if $(filter-out undefined,$(origin $(1))),
62 $(info $(EMPTY) NOTE Sanitized $(2) variable '$(1)' from $(origin $(1)))
63 MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES))
64 override $(1) :=
65 unexport $(1)
67 endef
69 # These specific variables can influence compilation in unexpected (and undesirable) ways
70 # gcc flags
71 SANITIZE_GCC_VARS := TMPDIR GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH
72 # preprocessor flags
73 SANITIZE_GCC_VARS += CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH DEPENDENCIES_OUTPUT
74 # make flags
75 SANITIZE_GCC_VARS += CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LDLIBS
76 $(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowed)))
78 # These specific variables used to be valid but now they make no sense
79 SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER CLEAN_BUILD
80 $(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated)))
82 # Make sure this isn't being run as root unless installing (no whoami on Windows, but that is ok here)
83 ifeq ($(shell whoami 2>/dev/null),root)
84 ifeq ($(filter install,$(MAKECMDGOALS)),)
85 ifndef FAKEROOTKEY
86 $(error You should not be running this as root)
87 endif
88 endif
89 endif
91 # Decide on a verbosity level based on the V= parameter
92 export AT := @
93 ifndef V
94 export V0 :=
95 export V1 := $(AT)
96 else ifeq ($(V), 0)
97 export V0 := $(AT)
98 export V1 := $(AT)
99 else ifeq ($(V), 1)
100 endif
102 # Make sure we know few things about the architecture before including
103 # the tools.mk to ensure that we download/install the right tools.
104 UNAME := $(shell uname)
105 ARCH := $(shell uname -m)
106 # Here and everywhere if not Linux or Mac then assume Windows
107 ifeq ($(filter Linux Darwin, $(UNAME)), )
108 UNAME := Windows
109 endif
111 # Include tools installers
112 include $(ROOT_DIR)/make/tools.mk
114 # We almost need to consider autoconf/automake instead of this
115 ifeq ($(UNAME), Linux)
116 QT_SPEC = linux-g++
117 UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/uavobjgenerator"
118 else ifeq ($(UNAME), Darwin)
119 QT_SPEC = macx-g++
120 UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/uavobjgenerator"
121 else ifeq ($(UNAME), Windows)
122 QT_SPEC = win32-g++
123 UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/$(UAVOGEN_BUILD_CONF)/uavobjgenerator.exe"
124 endif
126 ##############################
128 # All targets
130 ##############################
132 .PHONY: all
133 all: uavobjects all_ground all_flight
135 .PHONY: all_clean
136 all_clean:
137 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR))"
138 $(V1) [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)"
140 .PONY: clean
141 clean: all_clean
143 $(DL_DIR):
144 $(MKDIR) -p $@
146 $(TOOLS_DIR):
147 $(MKDIR) -p $@
149 $(BUILD_DIR):
150 $(MKDIR) -p $@
152 $(PACKAGE_DIR):
153 $(MKDIR) -p $@
155 $(DIST_DIR):
156 $(MKDIR) -p $@
158 ##############################
160 # UAVObjects
162 ##############################
164 ifeq ($(V), 1)
165 UAVOGEN_SILENT :=
166 else
167 UAVOGEN_SILENT := silent
168 endif
170 .PHONY: uavobjgenerator
171 uavobjgenerator:
172 $(V1) $(MKDIR) -p $(BUILD_DIR)/$@
173 $(V1) ( cd $(BUILD_DIR)/$@ && \
174 $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+="$(UAVOGEN_BUILD_CONF) $(UAVOGEN_SILENT)" && \
175 $(MAKE) --no-print-directory -w ; \
178 UAVOBJ_TARGETS := gcs flight python matlab java wireshark
180 .PHONY: uavobjects
181 uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
183 UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
184 UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
186 $(UAVOBJ_OUT_DIR):
187 $(V1) $(MKDIR) -p $@
189 uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator
190 $(V1) ( cd $(UAVOBJ_OUT_DIR) && \
191 $(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
194 uavobjects_test: $(UAVOBJ_OUT_DIR) uavobjgenerator
195 $(V1) $(UAVOBJGENERATOR) -v -none $(UAVOBJ_XML_DIR) $(ROOT_DIR)
197 uavobjects_clean:
198 @$(ECHO) " CLEAN $(call toprel, $(UAVOBJ_OUT_DIR))"
199 $(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)"
201 ##############################
203 # Flight related components
205 ##############################
207 # Define some pointers to the various important pieces of the flight code
208 # to prevent these being repeated in every sub makefile
209 export PIOS := $(ROOT_DIR)/flight/pios
210 export FLIGHTLIB := $(ROOT_DIR)/flight/libraries
211 export OPMODULEDIR := $(ROOT_DIR)/flight/modules
212 export OPUAVOBJ := $(ROOT_DIR)/flight/uavobjects
213 export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
214 export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
215 export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
217 # Define supported board lists
218 ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum
220 # Short names of each board (used to display board name in parallel builds)
221 coptercontrol_short := 'cc '
222 oplinkmini_short := 'oplm'
223 revolution_short := 'revo'
224 osd_short := 'osd '
225 revoproto_short := 'revp'
226 simposix_short := 'posx'
227 discoveryf4bare_short := 'df4b'
228 gpsplatinum_short := 'gps9 '
230 # SimPosix only builds on Linux so drop it from the list for
231 # all other platforms.
232 ifneq ($(UNAME), Linux)
233 ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
234 endif
236 # Start out assuming that we'll build fw, bl and bu for all boards
237 FW_BOARDS := $(ALL_BOARDS)
238 BL_BOARDS := $(ALL_BOARDS)
239 BU_BOARDS := $(ALL_BOARDS)
240 EF_BOARDS := $(ALL_BOARDS)
242 # SimPosix doesn't have a BL, BU or EF target so we need to
243 # filter them out to prevent errors on the all_flight target.
244 BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
245 BU_BOARDS := $(filter-out simposix gpsplatinum, $(BU_BOARDS))
246 EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
248 # Generate the targets for whatever boards are left in each list
249 FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
250 BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
251 BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
252 EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
254 # When building any of the "all_*" targets, tell all sub makefiles to display
255 # additional details on each line of output to describe which build and target
256 # that each line applies to. The same applies also to all, opfw_resource,
257 # package targets
258 ifneq ($(strip $(filter all_% all opfw_resource package,$(MAKECMDGOALS))),)
259 export ENABLE_MSG_EXTRA := yes
260 endif
262 # When building more than one goal in a single make invocation, also
263 # enable the extra context for each output line
264 ifneq ($(word 2,$(MAKECMDGOALS)),)
265 export ENABLE_MSG_EXTRA := yes
266 endif
268 # TEMPLATES (used to generate build rules)
270 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
271 # $(2) = Short name for board (e.g cc)
272 define FW_TEMPLATE
273 .PHONY: $(1) fw_$(1)
274 $(1): fw_$(1)_opfw
275 fw_$(1): fw_$(1)_opfw
277 fw_$(1)_%: uavobjects_flight
278 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
279 $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
280 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
281 $$(MAKE) -r --no-print-directory \
282 BUILD_TYPE=fw \
283 BOARD_NAME=$(1) \
284 BOARD_SHORT_NAME=$(2) \
285 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
286 OUTDIR=$(BUILD_DIR)/fw_$(1) \
287 TARGET=fw_$(1) \
290 .PHONY: $(1)_clean
291 $(1)_clean: fw_$(1)_clean
292 fw_$(1)_clean:
293 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/fw_$(1))"
294 $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
295 endef
297 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
298 # $(2) = Short name for board (e.g cc)
299 define BL_TEMPLATE
300 .PHONY: bl_$(1)
301 bl_$(1): bl_$(1)_bin
302 bl_$(1)_bino: bl_$(1)_bin
304 bl_$(1)_%:
305 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
306 $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
307 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
308 $$(MAKE) -r --no-print-directory \
309 BUILD_TYPE=bl \
310 BOARD_NAME=$(1) \
311 BOARD_SHORT_NAME=$(2) \
312 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
313 OUTDIR=$(BUILD_DIR)/bl_$(1) \
314 TARGET=bl_$(1) \
317 .PHONY: unbrick_$(1)
318 unbrick_$(1): bl_$(1)_hex
319 $(if $(filter-out undefined,$(origin UNBRICK_TTY)),
320 $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)"
321 $(V1) $(STM32FLASH_DIR)/stm32flash \
322 -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \
323 -g 0x0 \
324 $$(UNBRICK_TTY)
326 $(V0) @$(ECHO)
327 $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
328 $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
331 .PHONY: bl_$(1)_clean
332 bl_$(1)_clean:
333 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bl_$(1))"
334 $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
335 endef
337 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
338 # $(2) = Short name for board (e.g cc)
339 define BU_TEMPLATE
340 .PHONY: bu_$(1)
341 bu_$(1): bu_$(1)_opfw
343 bu_$(1)_%: bl_$(1)_bino
344 $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
345 $(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
346 $$(MAKE) -r --no-print-directory \
347 BUILD_TYPE=bu \
348 BOARD_NAME=$(1) \
349 BOARD_SHORT_NAME=$(2) \
350 TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
351 OUTDIR=$(BUILD_DIR)/bu_$(1) \
352 TARGET=bu_$(1) \
355 .PHONY: bu_$(1)_clean
356 bu_$(1)_clean:
357 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bu_$(1))"
358 $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
359 endef
361 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
362 # $(2) = Short name for board (e.g cc)
363 define EF_TEMPLATE
364 .PHONY: ef_$(1)
365 ef_$(1): ef_$(1)_bin
367 ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
368 $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
369 $(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
370 $$(MAKE) -r --no-print-directory \
371 BUILD_TYPE=ef \
372 BOARD_NAME=$(1) \
373 BOARD_SHORT_NAME=$(2) \
374 DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
375 TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
376 OUTDIR=$(BUILD_DIR)/ef_$(1) \
377 TARGET=ef_$(1) \
380 .PHONY: ef_$(1)_clean
381 ef_$(1)_clean:
382 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/ef_$(1))"
383 $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
384 endef
386 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
387 define BOARD_PHONY_TEMPLATE
388 .PHONY: all_$(1)
389 all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
390 all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
391 all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
392 all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
394 .PHONY: all_$(1)_clean
395 all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
396 all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
397 all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
398 all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
399 endef
401 # Generate flight build rules
402 .PHONY: all_fw all_fw_clean
403 all_fw: $(addsuffix _opfw, $(FW_TARGETS))
404 all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
406 .PHONY: all_bl all_bl_clean
407 all_bl: $(addsuffix _bin, $(BL_TARGETS))
408 all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
410 .PHONY: all_bu all_bu_clean
411 all_bu: $(addsuffix _opfw, $(BU_TARGETS))
412 all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
414 .PHONY: all_ef all_ef_clean
415 all_ef: $(EF_TARGETS)
416 all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
418 .PHONY: all_flight all_flight_clean
419 all_flight: all_fw all_bl all_bu all_ef
420 all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
422 # Expand the groups of targets for each board
423 $(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
425 # Expand the firmware rules
426 $(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_short))))
428 # Expand the bootloader rules
429 $(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_short))))
431 # Expand the bootloader updater rules
432 $(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_short))))
434 # Expand the entire-flash rules
435 $(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_short))))
437 .PHONY: sim_win32
438 sim_win32: sim_win32_exe
440 sim_win32_%: uavobjects_flight
441 $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32
442 $(V1) $(MAKE) --no-print-directory \
443 -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $*
445 .PHONY: sim_osx
446 sim_osx: sim_osx_elf
448 sim_osx_%: uavobjects_flight
449 $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx
450 $(V1) $(MAKE) --no-print-directory \
451 -C $(ROOT_DIR)/flight/targets/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
453 ##############################
455 # GCS related components
457 ##############################
459 .PHONY: all_ground
460 all_ground: openpilotgcs uploader
462 # Convenience target for the GCS
463 .PHONY: gcs gcs_clean
464 gcs: openpilotgcs
465 gcs_clean: openpilotgcs_clean
467 ifeq ($(V), 1)
468 GCS_SILENT :=
469 else
470 GCS_SILENT := silent
471 endif
473 .NOTPARALLEL:
474 .PHONY: openpilotgcs
475 openpilotgcs: uavobjects_gcs openpilotgcs_qmake openpilotgcs_make
477 .PHONY: openpilotgcs_qmake
478 openpilotgcs_qmake:
479 ifeq ($(QMAKE_SKIP),)
480 $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
481 $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF) && \
482 $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \
484 else
485 @$(ECHO) "skipping qmake"
486 endif
488 .PHONY: openpilotgcs_make
489 openpilotgcs_make:
490 $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
491 $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \
492 $(MAKE) -w ; \
495 .PHONY: openpilotgcs_clean
496 openpilotgcs_clean:
497 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF))"
498 $(V1) [ ! -d "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)"
500 ################################
502 # Serial Uploader tool
504 ################################
506 .NOTPARALLEL:
507 .PHONY: uploader
508 uploader: uploader_qmake uploader_make
510 .PHONY: uploader_qmake
511 uploader_qmake:
512 ifeq ($(QMAKE_SKIP),)
513 $(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
514 $(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF) && \
515 $(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) \
517 else
518 @$(ECHO) "skipping qmake"
519 endif
521 .PHONY: uploader_make
522 uploader_make:
523 $(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
524 $(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \
525 $(MAKE) -w ; \
528 .PHONY: uploader_clean
529 uploader_clean:
530 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF))"
531 $(V1) [ ! -d "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)"
534 ################################
536 # Android GCS related components
538 ################################
540 # Build the output directory for the Android GCS build
541 ANDROIDGCS_OUT_DIR := $(BUILD_DIR)/androidgcs
542 $(ANDROIDGCS_OUT_DIR):
543 $(V1) $(MKDIR) -p $@
545 # Build the asset directory for the android assets
546 ANDROIDGCS_ASSETS_DIR := $(ANDROIDGCS_OUT_DIR)/assets
547 $(ANDROIDGCS_ASSETS_DIR)/uavos:
548 $(V1) $(MKDIR) -p $@
550 ifeq ($(V), 1)
551 ANT_QUIET :=
552 ANDROID_SILENT :=
553 else
554 ANT_QUIET := -q
555 ANDROID_SILENT := -s
556 endif
558 .PHONY: androidgcs
559 androidgcs: uavo-collections_java
560 $(V0) @$(ECHO) " ANDROID $(call toprel, $(ANDROIDGCS_OUT_DIR))"
561 $(V1) $(MKDIR) -p $(ANDROIDGCS_OUT_DIR)
562 $(V1) $(ANDROID) $(ANDROID_SILENT) update project \
563 --target "Google Inc.:Google APIs:$(GOOGLE_API_VERSION)" \
564 --name androidgcs \
565 --path ./androidgcs
566 $(V1) $(ANT) -f ./androidgcs/build.xml \
567 $(ANT_QUIET) \
568 -Dout.dir="../$(call toprel, $(ANDROIDGCS_OUT_DIR)/bin)" \
569 -Dgen.absolute.dir="$(ANDROIDGCS_OUT_DIR)/gen" \
570 $(ANDROIDGCS_BUILD_CONF)
572 .PHONY: androidgcs_clean
573 androidgcs_clean:
574 @$(ECHO) " CLEAN $(call toprel, $(ANDROIDGCS_OUT_DIR))"
575 $(V1) [ ! -d "$(ANDROIDGCS_OUT_DIR)" ] || $(RM) -r "$(ANDROIDGCS_OUT_DIR)"
577 # We want to take snapshots of the UAVOs at each point that they change
578 # to allow the GCS to be compatible with as many versions as possible.
579 # We always include a pseudo collection called "srctree" which represents
580 # the UAVOs in the source tree. So not necessary to add current tree UAVO
581 # hash here, it is always included.
583 # Find the git hashes of each commit that changes uavobjects with:
584 # git log --format=%h -- shared/uavobjectdefinition/ | head -n 2
585 # List only UAVO hashes of past releases, do not list current hash.
586 # Past compatible versions are so far: RELEASE-12.10.2
587 UAVO_GIT_VERSIONS := 5e14f53
589 # All versions includes also the current source tree UAVO hash
590 UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree
592 # This is where the UAVO collections are stored
593 UAVO_COLLECTION_DIR := $(BUILD_DIR)/uavo-collections
595 # $(1) git hash of a UAVO snapshot
596 define UAVO_COLLECTION_GIT_TEMPLATE
598 # Make the output directory that will contain all of the synthetics for the
599 # uavo collection referenced by the git hash $(1)
600 $$(UAVO_COLLECTION_DIR)/$(1):
601 $$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1)
603 # Extract the snapshot of shared/uavobjectdefinition from git hash $(1)
604 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1)
605 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar:
606 $$(V0) @$(ECHO) " UAVOTAR $(1)"
607 $$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/
609 # Extract the uavo xml files from our snapshot
610 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar
611 $$(V0) @$(ECHO) " UAVOUNTAR $(1)"
612 $$(V1) $(RM) -rf $$@
613 $$(V1) $(MKDIR) -p $$@
614 $$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@
615 endef
617 # Map the current working directory into the set of UAVO collections
618 $(UAVO_COLLECTION_DIR)/srctree:
619 $(V1) $(MKDIR) -p $@
621 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree
622 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR)
623 $(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml
625 # $(1) git hash (or symbolic name) of a UAVO snapshot
626 define UAVO_COLLECTION_BUILD_TEMPLATE
628 # This leaves us with a (broken) symlink that points to the full sha1sum of the collection
629 $$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
630 # Compute the sha1 hash for this UAVO collection
631 # The sed bit truncates the UAVO hash to 16 hex digits
632 $$(V1) $$(VERSION_INFO) \
633 --uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
634 --format='$$$${UAVO_HASH}' | \
635 $(SED) -e 's|\(................\).*|\1|' > $$@
637 $$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
639 # Generate the java uavobjects for this UAVO collection
640 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash
641 $$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
642 $$(V1) $(MKDIR) -p $$@
643 $$(V1) ( \
644 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
645 $$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \
648 # Build a jar file for this UAVO collection
649 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos
650 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java
651 $$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
652 $$(V1) ( \
653 HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \
654 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
655 $(JAVAC) java/*.java \
656 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \
657 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \
658 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \
659 -d . && \
660 find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \
661 $(JAR) cf tmp_uavobjects.jar @classlist.txt && \
662 $$(ANDROID_DX) \
663 --dex \
664 --output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \
665 tmp_uavobjects.jar && \
666 $(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \
669 endef
671 # One of these for each element of UAVO_GIT_VERSIONS so we can extract the UAVOs from git
672 $(foreach githash, $(UAVO_GIT_VERSIONS), $(eval $(call UAVO_COLLECTION_GIT_TEMPLATE,$(githash))))
674 # One of these for each UAVO_ALL_VERSIONS which includes the ones in the srctree
675 $(foreach githash, $(UAVO_ALL_VERSIONS), $(eval $(call UAVO_COLLECTION_BUILD_TEMPLATE,$(githash))))
677 .PHONY: uavo-collections_java
678 uavo-collections_java: $(foreach githash, $(UAVO_ALL_VERSIONS), $(UAVO_COLLECTION_DIR)/$(githash)/java-build/uavobjects.jar)
680 .PHONY: uavo-collections
681 uavo-collections: uavo-collections_java
683 .PHONY: uavo-collections_clean
684 uavo-collections_clean:
685 @$(ECHO) " CLEAN $(call toprel, $(UAVO_COLLECTION_DIR))"
686 $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR)
688 ##############################
690 # Unit Tests
692 ##############################
694 ALL_UNITTESTS := logfs math lednotification
696 # Build the directory for the unit tests
697 UT_OUT_DIR := $(BUILD_DIR)/unit_tests
698 $(UT_OUT_DIR):
699 $(V1) $(MKDIR) -p $@
701 .PHONY: all_ut
702 all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
704 .PHONY: all_ut_xml
705 all_ut_xml: $(addsuffix _xml, $(addprefix ut_, $(ALL_UNITTESTS)))
707 .PHONY: all_ut_run
708 all_ut_run: $(addsuffix _run, $(addprefix ut_, $(ALL_UNITTESTS)))
710 .PHONY: all_ut_clean
711 all_ut_clean:
712 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR))"
713 $(V1) [ ! -d "$(UT_OUT_DIR)" ] || $(RM) -r "$(UT_OUT_DIR)"
715 # $(1) = Unit test name
716 define UT_TEMPLATE
717 .PHONY: ut_$(1)
718 ut_$(1): ut_$(1)_run
720 ut_$(1)_%: $$(UT_OUT_DIR)
721 $(V1) $(MKDIR) -p $(UT_OUT_DIR)/$(1)
722 $(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
723 $$(MAKE) -r --no-print-directory \
724 BUILD_TYPE=ut \
725 BOARD_SHORT_NAME=$(1) \
726 TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
727 OUTDIR="$(UT_OUT_DIR)/$(1)" \
728 TARGET=$(1) \
731 .PHONY: ut_$(1)_clean
732 ut_$(1)_clean:
733 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR)/$(1))"
734 $(V1) [ ! -d "$(UT_OUT_DIR)/$(1)" ] || $(RM) -r "$(UT_OUT_DIR)/$(1)"
735 endef
737 # Expand the unittest rules
738 $(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut))))
740 # Disable parallel make when the all_ut_run target is requested otherwise the TAP
741 # output is interleaved with the rest of the make output.
742 ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),)
743 .NOTPARALLEL:
744 $(info $(EMPTY) NOTE Parallel make disabled by all_ut_run target so we have sane console output)
745 endif
747 ##############################
749 # Packaging components
751 ##############################
753 # Firmware files to package
754 PACKAGE_FW_EXCLUDE := fw_simposix $(if $(PACKAGE_FW_INCLUDE_DISCOVERYF4BARE),,fw_discoveryf4bare)
755 PACKAGE_FW_TARGETS := $(filter-out $(PACKAGE_FW_EXCLUDE), $(FW_TARGETS))
756 PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS))
758 # Rules to generate GCS resources used to embed firmware binaries into the GCS.
759 # They are used later by the vehicle setup wizard to update board firmware.
760 # To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
761 OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc
762 OPFW_RESOURCE_PREFIX := ../../
763 OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
764 OPFW_CONTENTS := \
765 <!DOCTYPE RCC><RCC version="1.0"> \
766 <qresource prefix="/firmware"> \
767 $(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
768 </qresource> \
769 </RCC>
771 .PHONY: opfw_resource
772 opfw_resource: $(OPFW_RESOURCE)
774 $(OPFW_RESOURCE): $(FW_TARGETS)
775 @$(ECHO) Generating OPFW resource file $(call toprel, $@)
776 $(V1) $(MKDIR) -p $(dir $@)
777 $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
779 # If opfw_resource or all firmware are requested, GCS should depend on the resource
780 ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),)
781 $(eval openpilotgcs_qmake: $(OPFW_RESOURCE))
782 endif
784 # Packaging targets: package
785 # - builds all firmware, opfw_resource, gcs
786 # - copies firmware into a package directory
787 # - calls paltform-specific packaging script
789 # Define some variables
790 PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL})
791 PACKAGE_NAME := OpenPilot
792 PACKAGE_SEP := -
793 PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)
795 include $(ROOT_DIR)/package/$(UNAME).mk
797 # Source distribution is never dirty because it uses git archive
798 DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar
800 ##############################
802 # Source code formatting
804 ##############################
806 UNCRUSTIFY_TARGETS := flight ground
808 # $(1) = Uncrustify target (e.g flight or ground)
809 # $(2) = Target root directory
810 define UNCRUSTIFY_TEMPLATE
812 .PHONY: uncrustify_$(1)
813 uncrustify_$(1):
814 @$(ECHO) "Auto-formatting $(1) source code"
815 $(V1) UNCRUSTIFY_CONFIG="$(ROOT_DIR)/make/uncrustify/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
816 endef
818 $(foreach uncrustify_targ, $(UNCRUSTIFY_TARGETS), $(eval $(call UNCRUSTIFY_TEMPLATE,$(uncrustify_targ),$(ROOT_DIR)/$(uncrustify_targ))))
820 .PHONY: uncrustify_all
821 uncrustify_all: $(addprefix uncrustify_,$(UNCRUSTIFY_TARGETS))
823 ##############################
825 # Doxygen documentation
827 # Each target should have own Doxyfile.$(target) with build directory build/docs/$(target),
828 # proper source directory (e.g. $(target)) and appropriate other doxygen options.
830 ##############################
832 DOCS_TARGETS := flight ground uavobjects
834 # $(1) = Doxygen target (e.g flight or ground)
835 define DOXYGEN_TEMPLATE
837 .PHONY: docs_$(1)
838 docs_$(1): docs_$(1)_clean
839 @$(ECHO) "Generating $(1) documentation"
840 $(V1) $(MKDIR) -p $(BUILD_DIR)/docs/$(1)
841 $(V1) $(DOXYGEN) $(ROOT_DIR)/make/doxygen/Doxyfile.$(1)
843 .PHONY: docs_$(1)_clean
844 docs_$(1)_clean:
845 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs/$(1))"
846 $(V1) [ ! -d "$(BUILD_DIR)/docs/$(1)" ] || $(RM) -r "$(BUILD_DIR)/docs/$(1)"
848 endef
850 $(foreach docs_targ, $(DOCS_TARGETS), $(eval $(call DOXYGEN_TEMPLATE,$(docs_targ))))
852 .PHONY: docs_all
853 docs_all: $(addprefix docs_,$(DOCS_TARGETS))
855 .PHONY: docs_all_clean
856 docs_all_clean:
857 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs)"
858 $(V1) [ ! -d "$(BUILD_DIR)/docs" ] || $(RM) -rf "$(BUILD_DIR)/docs"
860 ##############################
862 # Build info
864 ##############################
866 .PHONY: build-info
867 build-info:
868 @$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
869 $(V1) $(MKDIR) -p $(BUILD_DIR)
870 $(V1) $(VERSION_INFO) \
871 --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
872 --template="make/templates/$@.txt" \
873 --outfile="$(BUILD_DIR)/$@.txt"
875 ##############################
877 # Source for distribution
879 ##############################
881 DIST_VER_INFO := $(DIST_DIR)/version-info.json
883 $(DIST_VER_INFO): .git/index | $(DIST_DIR)
884 $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
887 $(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR)
888 @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)"
889 $(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD
890 $(V1) tar --append --file="$(DIST_NAME)" \
891 --transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
892 $(call toprel, "$(DIST_VER_INFO)")
893 $(V1) gzip -f "$(DIST_NAME)"
895 .PHONY: dist
896 dist: $(DIST_NAME).gz
898 ##############################
900 # Help message, the default Makefile goal
902 ##############################
904 .DEFAULT_GOAL := help
906 .PHONY: help
907 help:
908 @$(ECHO)
909 @$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment."
910 @$(ECHO) " It also works on Windows by following the instructions given on this wiki page:"
911 @$(ECHO) " http://wiki.openpilot.org/display/Doc/Windows%3A+Building+and+Packaging"
912 @$(ECHO)
913 @$(ECHO) " Here is a summary of the available targets:"
914 @$(ECHO)
915 @$(ECHO) " [Source tree preparation]"
916 @$(ECHO) " prepare - Install GIT commit message template"
917 @$(ECHO) " [Tool Installers]"
918 @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain"
919 @$(ECHO) " qt_sdk_install - Install the QT development tools"
920 @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
921 @$(ECHO) " sdl_install - Install the SDL library (Windows only)"
922 @$(ECHO) " mesawin_install - Install the OpenGL32 DLL (Windows only)"
923 @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)"
924 @$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
925 @$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
926 @$(ECHO) " gtest_install - Install the GoogleTest framework"
927 @$(ECHO) " These targets are not updated yet and are probably broken:"
928 @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
929 @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
930 @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
931 @$(ECHO) " android_sdk_install - Install the Android SDK tools"
932 @$(ECHO) " Install all available tools:"
933 @$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
934 @$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
935 @$(ECHO)
936 @$(ECHO) " Other tool options are:"
937 @$(ECHO) " <tool>_version - Display <tool> version"
938 @$(ECHO) " <tool>_clean - Remove installed <tool>"
939 @$(ECHO) " <tool>_distclean - Remove downloaded <tool> distribution file(s)"
940 @$(ECHO)
941 @$(ECHO) " [Big Hammer]"
942 @$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs"
943 @$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters"
944 @$(ECHO) " all_fw - Build only firmware for all boards"
945 @$(ECHO) " all_bl - Build only bootloaders for all boards"
946 @$(ECHO) " all_bu - Build only bootloader updaters for all boards"
947 @$(ECHO)
948 @$(ECHO) " all_clean - Remove your build directory ($(BUILD_DIR))"
949 @$(ECHO) " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
950 @$(ECHO) " all_fw_clean - Remove firmware for all boards"
951 @$(ECHO) " all_bl_clean - Remove bootloaders for all boards"
952 @$(ECHO) " all_bu_clean - Remove bootloader updaters for all boards"
953 @$(ECHO)
954 @$(ECHO) " all_<board> - Build all available images for <board>"
955 @$(ECHO) " all_<board>_clean - Remove all available images for <board>"
956 @$(ECHO)
957 @$(ECHO) " all_ut - Build all unit tests"
958 @$(ECHO) " all_ut_tap - Run all unit tests and capture all TAP output to files"
959 @$(ECHO) " all_ut_run - Run all unit tests and dump TAP output to console"
960 @$(ECHO)
961 @$(ECHO) " [Firmware]"
962 @$(ECHO) " <board> - Build firmware for <board>"
963 @$(ECHO) " Supported boards are ($(ALL_BOARDS))"
964 @$(ECHO) " fw_<board> - Build firmware for <board>"
965 @$(ECHO) " Supported boards are ($(FW_BOARDS))"
966 @$(ECHO) " fw_<board>_clean - Remove firmware for <board>"
967 @$(ECHO) " fw_<board>_program - Use OpenOCD + JTAG to write firmware to <board>"
968 @$(ECHO)
969 @$(ECHO) " [Bootloader]"
970 @$(ECHO) " bl_<board> - Build bootloader for <board>"
971 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
972 @$(ECHO) " bl_<board>_clean - Remove bootloader for <board>"
973 @$(ECHO) " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
974 @$(ECHO)
975 @$(ECHO) " [Entire Flash]"
976 @$(ECHO) " ef_<board> - Build entire flash image for <board>"
977 @$(ECHO) " Supported boards are ($(EF_BOARDS))"
978 @$(ECHO) " ef_<board>_clean - Remove entire flash image for <board>"
979 @$(ECHO) " ef_<board>_program - Use OpenOCD + JTAG to write entire flash image to <board>"
980 @$(ECHO)
981 @$(ECHO) " [Bootloader Updater]"
982 @$(ECHO) " bu_<board> - Build bootloader updater for <board>"
983 @$(ECHO) " Supported boards are ($(BU_BOARDS))"
984 @$(ECHO) " bu_<board>_clean - Remove bootloader updater for <board>"
985 @$(ECHO)
986 @$(ECHO) " [Unbrick a board]"
987 @$(ECHO) " unbrick_<board> - Use the STM32's built in boot ROM to write a bootloader to <board>"
988 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
989 @$(ECHO) " [Unittests]"
990 @$(ECHO) " ut_<test> - Build unit test <test>"
991 @$(ECHO) " ut_<test>_xml - Run test and capture XML output into a file"
992 @$(ECHO) " ut_<test>_run - Run test and dump output to console"
993 @$(ECHO)
994 @$(ECHO) " [Simulation]"
995 @$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
996 @$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
997 @$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
998 @$(ECHO) " using mingw and msys"
999 @$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
1000 @$(ECHO)
1001 @$(ECHO) " [GCS]"
1002 @$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)"
1003 @$(ECHO) " Skip qmake: QMAKE_SKIP=1"
1004 @$(ECHO) " Compile specific directory: MAKE_DIR=<dir>"
1005 @$(ECHO) " Example: make gcs QMAKE_SKIP=1 MAKE_DIR=src/plugins/coreplugin"
1006 @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)"
1007 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
1008 @$(ECHO)
1009 @$(ECHO) " [Uploader Tool]"
1010 @$(ECHO) " uploader - Build the serial uploader tool (debug|release)"
1011 @$(ECHO) " Skip qmake: QMAKE_SKIP=1"
1012 @$(ECHO) " Example: make uploader QMAKE_SKIP=1"
1013 @$(ECHO) " uploader_clean - Remove the serial uploader tool (debug|release)"
1014 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
1015 @$(ECHO)
1016 @$(ECHO)
1017 @$(ECHO) " [AndroidGCS]"
1018 @$(ECHO) " androidgcs - Build the Android Ground Control System (GCS) application"
1019 @$(ECHO) " androidgcs_install - Use ADB to install the Android GCS application"
1020 @$(ECHO) " androidgcs_run - Run the Android GCS application"
1021 @$(ECHO) " androidgcs_clean - Remove the Android GCS application"
1022 @$(ECHO)
1023 @$(ECHO) " [UAVObjects]"
1024 @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files"
1025 @$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..."
1026 @$(ECHO) " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
1027 @$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
1028 @$(ECHO)
1029 @$(ECHO) " [Packaging]"
1030 @$(ECHO) " package - Build and package the OpenPilot platform-dependent package (no clean)"
1031 @$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
1032 @$(ECHO) " dist - Generate source archive for distribution"
1033 @$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)"
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)