OP-1728 Remove unused code
[librepilot.git] / Makefile
blob45d8554ce709ca7b9c49df3e5705477d6c25af4e
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 all_clean,$(MAKECMDGOALS)),)
85 $(error You should not be running this as root)
86 endif
87 endif
89 # Decide on a verbosity level based on the V= parameter
90 export AT := @
91 ifndef V
92 export V0 :=
93 export V1 := $(AT)
94 else ifeq ($(V), 0)
95 export V0 := $(AT)
96 export V1 := $(AT)
97 else ifeq ($(V), 1)
98 endif
100 # Make sure we know few things about the architecture before including
101 # the tools.mk to ensure that we download/install the right tools.
102 UNAME := $(shell uname)
103 ARCH := $(shell uname -m)
104 # Here and everywhere if not Linux or Mac then assume Windows
105 ifeq ($(filter Linux Darwin, $(UNAME)), )
106 UNAME := Windows
107 endif
109 # Include tools installers
110 include $(ROOT_DIR)/make/tools.mk
112 # We almost need to consider autoconf/automake instead of this
113 ifeq ($(UNAME), Linux)
114 QT_SPEC = linux-g++
115 UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/uavobjgenerator"
116 else ifeq ($(UNAME), Darwin)
117 QT_SPEC = macx-g++
118 UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/uavobjgenerator"
119 else ifeq ($(UNAME), Windows)
120 QT_SPEC = win32-g++
121 UAVOBJGENERATOR = "$(BUILD_DIR)/uavobjgenerator/$(UAVOGEN_BUILD_CONF)/uavobjgenerator.exe"
122 endif
124 ##############################
126 # All targets
128 ##############################
130 .PHONY: all
131 all: uavobjects all_ground all_flight
133 .PHONY: all_clean
134 all_clean:
135 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR))"
136 $(V1) [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)"
138 .PONY: clean
139 clean: all_clean
141 $(DL_DIR):
142 $(MKDIR) -p $@
144 $(TOOLS_DIR):
145 $(MKDIR) -p $@
147 $(BUILD_DIR):
148 $(MKDIR) -p $@
150 $(PACKAGE_DIR):
151 $(MKDIR) -p $@
153 $(DIST_DIR):
154 $(MKDIR) -p $@
156 ##############################
158 # UAVObjects
160 ##############################
162 ifeq ($(V), 1)
163 UAVOGEN_SILENT :=
164 else
165 UAVOGEN_SILENT := silent
166 endif
168 .PHONY: uavobjgenerator
169 uavobjgenerator:
170 $(V1) $(MKDIR) -p $(BUILD_DIR)/$@
171 $(V1) ( cd $(BUILD_DIR)/$@ && \
172 $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro -spec $(QT_SPEC) -r CONFIG+="$(UAVOGEN_BUILD_CONF) $(UAVOGEN_SILENT)" && \
173 $(MAKE) --no-print-directory -w ; \
176 UAVOBJ_TARGETS := gcs flight python matlab java wireshark
178 .PHONY: uavobjects
179 uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
181 UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
182 UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
184 $(UAVOBJ_OUT_DIR):
185 $(V1) $(MKDIR) -p $@
187 uavobjects_%: $(UAVOBJ_OUT_DIR) uavobjgenerator
188 $(V1) ( cd $(UAVOBJ_OUT_DIR) && \
189 $(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
192 uavobjects_test: $(UAVOBJ_OUT_DIR) uavobjgenerator
193 $(V1) $(UAVOBJGENERATOR) -v -none $(UAVOBJ_XML_DIR) $(ROOT_DIR)
195 uavobjects_clean:
196 @$(ECHO) " CLEAN $(call toprel, $(UAVOBJ_OUT_DIR))"
197 $(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)"
199 ##############################
201 # Flight related components
203 ##############################
205 # Define some pointers to the various important pieces of the flight code
206 # to prevent these being repeated in every sub makefile
207 export PIOS := $(ROOT_DIR)/flight/pios
208 export FLIGHTLIB := $(ROOT_DIR)/flight/libraries
209 export OPMODULEDIR := $(ROOT_DIR)/flight/modules
210 export OPUAVOBJ := $(ROOT_DIR)/flight/uavobjects
211 export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
212 export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
213 export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
215 # Define supported board lists
216 ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum
218 # Short names of each board (used to display board name in parallel builds)
219 coptercontrol_short := 'cc '
220 oplinkmini_short := 'oplm'
221 revolution_short := 'revo'
222 osd_short := 'osd '
223 revoproto_short := 'revp'
224 simposix_short := 'posx'
225 discoveryf4bare_short := 'df4b'
226 gpsplatinum_short := 'gps9 '
228 # SimPosix only builds on Linux so drop it from the list for
229 # all other platforms.
230 ifneq ($(UNAME), Linux)
231 ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
232 endif
234 # Start out assuming that we'll build fw, bl and bu for all boards
235 FW_BOARDS := $(ALL_BOARDS)
236 BL_BOARDS := $(ALL_BOARDS)
237 BU_BOARDS := $(ALL_BOARDS)
238 EF_BOARDS := $(ALL_BOARDS)
240 # SimPosix doesn't have a BL, BU or EF target so we need to
241 # filter them out to prevent errors on the all_flight target.
242 BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
243 BU_BOARDS := $(filter-out simposix gpsplatinum, $(BU_BOARDS))
244 EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
246 # Generate the targets for whatever boards are left in each list
247 FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
248 BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
249 BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
250 EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
252 # When building any of the "all_*" targets, tell all sub makefiles to display
253 # additional details on each line of output to describe which build and target
254 # that each line applies to. The same applies also to all, opfw_resource,
255 # package targets
256 ifneq ($(strip $(filter all_% all opfw_resource package,$(MAKECMDGOALS))),)
257 export ENABLE_MSG_EXTRA := yes
258 endif
260 # When building more than one goal in a single make invocation, also
261 # enable the extra context for each output line
262 ifneq ($(word 2,$(MAKECMDGOALS)),)
263 export ENABLE_MSG_EXTRA := yes
264 endif
266 # TEMPLATES (used to generate build rules)
268 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
269 # $(2) = Short name for board (e.g cc)
270 define FW_TEMPLATE
271 .PHONY: $(1) fw_$(1)
272 $(1): fw_$(1)_opfw
273 fw_$(1): fw_$(1)_opfw
275 fw_$(1)_%: uavobjects_flight
276 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
277 $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
278 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
279 $$(MAKE) -r --no-print-directory \
280 BUILD_TYPE=fw \
281 BOARD_NAME=$(1) \
282 BOARD_SHORT_NAME=$(2) \
283 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
284 OUTDIR=$(BUILD_DIR)/fw_$(1) \
285 TARGET=fw_$(1) \
288 .PHONY: $(1)_clean
289 $(1)_clean: fw_$(1)_clean
290 fw_$(1)_clean:
291 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/fw_$(1))"
292 $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
293 endef
295 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
296 # $(2) = Short name for board (e.g cc)
297 define BL_TEMPLATE
298 .PHONY: bl_$(1)
299 bl_$(1): bl_$(1)_bin
300 bl_$(1)_bino: bl_$(1)_bin
302 bl_$(1)_%:
303 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
304 $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
305 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
306 $$(MAKE) -r --no-print-directory \
307 BUILD_TYPE=bl \
308 BOARD_NAME=$(1) \
309 BOARD_SHORT_NAME=$(2) \
310 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
311 OUTDIR=$(BUILD_DIR)/bl_$(1) \
312 TARGET=bl_$(1) \
315 .PHONY: unbrick_$(1)
316 unbrick_$(1): bl_$(1)_hex
317 $(if $(filter-out undefined,$(origin UNBRICK_TTY)),
318 $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)"
319 $(V1) $(STM32FLASH_DIR)/stm32flash \
320 -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \
321 -g 0x0 \
322 $$(UNBRICK_TTY)
324 $(V0) @$(ECHO)
325 $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
326 $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
329 .PHONY: bl_$(1)_clean
330 bl_$(1)_clean:
331 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bl_$(1))"
332 $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
333 endef
335 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
336 # $(2) = Short name for board (e.g cc)
337 define BU_TEMPLATE
338 .PHONY: bu_$(1)
339 bu_$(1): bu_$(1)_opfw
341 bu_$(1)_%: bl_$(1)_bino
342 $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
343 $(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
344 $$(MAKE) -r --no-print-directory \
345 BUILD_TYPE=bu \
346 BOARD_NAME=$(1) \
347 BOARD_SHORT_NAME=$(2) \
348 TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
349 OUTDIR=$(BUILD_DIR)/bu_$(1) \
350 TARGET=bu_$(1) \
353 .PHONY: bu_$(1)_clean
354 bu_$(1)_clean:
355 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bu_$(1))"
356 $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
357 endef
359 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
360 # $(2) = Short name for board (e.g cc)
361 define EF_TEMPLATE
362 .PHONY: ef_$(1)
363 ef_$(1): ef_$(1)_bin
365 ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
366 $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
367 $(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
368 $$(MAKE) -r --no-print-directory \
369 BUILD_TYPE=ef \
370 BOARD_NAME=$(1) \
371 BOARD_SHORT_NAME=$(2) \
372 DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
373 TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
374 OUTDIR=$(BUILD_DIR)/ef_$(1) \
375 TARGET=ef_$(1) \
378 .PHONY: ef_$(1)_clean
379 ef_$(1)_clean:
380 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/ef_$(1))"
381 $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
382 endef
384 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
385 define BOARD_PHONY_TEMPLATE
386 .PHONY: all_$(1)
387 all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
388 all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
389 all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
390 all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
392 .PHONY: all_$(1)_clean
393 all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
394 all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
395 all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
396 all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
397 endef
399 # Generate flight build rules
400 .PHONY: all_fw all_fw_clean
401 all_fw: $(addsuffix _opfw, $(FW_TARGETS))
402 all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
404 .PHONY: all_bl all_bl_clean
405 all_bl: $(addsuffix _bin, $(BL_TARGETS))
406 all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
408 .PHONY: all_bu all_bu_clean
409 all_bu: $(addsuffix _opfw, $(BU_TARGETS))
410 all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
412 .PHONY: all_ef all_ef_clean
413 all_ef: $(EF_TARGETS)
414 all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
416 .PHONY: all_flight all_flight_clean
417 all_flight: all_fw all_bl all_bu all_ef
418 all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
420 # Expand the groups of targets for each board
421 $(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
423 # Expand the firmware rules
424 $(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_short))))
426 # Expand the bootloader rules
427 $(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_short))))
429 # Expand the bootloader updater rules
430 $(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_short))))
432 # Expand the entire-flash rules
433 $(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_short))))
435 .PHONY: sim_win32
436 sim_win32: sim_win32_exe
438 sim_win32_%: uavobjects_flight
439 $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32
440 $(V1) $(MAKE) --no-print-directory \
441 -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $*
443 .PHONY: sim_osx
444 sim_osx: sim_osx_elf
446 sim_osx_%: uavobjects_flight
447 $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx
448 $(V1) $(MAKE) --no-print-directory \
449 -C $(ROOT_DIR)/flight/targets/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
451 ##############################
453 # GCS related components
455 ##############################
457 .PHONY: all_ground
458 all_ground: openpilotgcs uploader
460 # Convenience target for the GCS
461 .PHONY: gcs gcs_clean
462 gcs: openpilotgcs
463 gcs_clean: openpilotgcs_clean
465 ifeq ($(V), 1)
466 GCS_SILENT :=
467 else
468 GCS_SILENT := silent
469 endif
471 .NOTPARALLEL:
472 .PHONY: openpilotgcs
473 openpilotgcs: uavobjects_gcs openpilotgcs_qmake openpilotgcs_make
475 .PHONY: openpilotgcs_qmake
476 openpilotgcs_qmake:
477 ifeq ($(QMAKE_SKIP),)
478 $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
479 $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF) && \
480 $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro -spec $(QT_SPEC) -r CONFIG+="$(GCS_BUILD_CONF) $(GCS_SILENT)" $(GCS_QMAKE_OPTS) \
482 else
483 @$(ECHO) "skipping qmake"
484 endif
486 .PHONY: openpilotgcs_make
487 openpilotgcs_make:
488 $(V1) $(MKDIR) -p $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)
489 $(V1) ( cd $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \
490 $(MAKE) -w ; \
493 .PHONY: openpilotgcs_clean
494 openpilotgcs_clean:
495 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF))"
496 $(V1) [ ! -d "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/openpilotgcs_$(GCS_BUILD_CONF)"
498 ################################
500 # Serial Uploader tool
502 ################################
504 .NOTPARALLEL:
505 .PHONY: uploader
506 uploader: uploader_qmake uploader_make
508 .PHONY: uploader_qmake
509 uploader_qmake:
510 ifeq ($(QMAKE_SKIP),)
511 $(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
512 $(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF) && \
513 $(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) \
515 else
516 @$(ECHO) "skipping qmake"
517 endif
519 .PHONY: uploader_make
520 uploader_make:
521 $(V1) $(MKDIR) -p $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
522 $(V1) ( cd $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)/$(MAKE_DIR) && \
523 $(MAKE) -w ; \
526 .PHONY: uploader_clean
527 uploader_clean:
528 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF))"
529 $(V1) [ ! -d "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)" ] || $(RM) -r "$(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)"
532 ################################
534 # Android GCS related components
536 ################################
538 # Build the output directory for the Android GCS build
539 ANDROIDGCS_OUT_DIR := $(BUILD_DIR)/androidgcs
540 $(ANDROIDGCS_OUT_DIR):
541 $(V1) $(MKDIR) -p $@
543 # Build the asset directory for the android assets
544 ANDROIDGCS_ASSETS_DIR := $(ANDROIDGCS_OUT_DIR)/assets
545 $(ANDROIDGCS_ASSETS_DIR)/uavos:
546 $(V1) $(MKDIR) -p $@
548 ifeq ($(V), 1)
549 ANT_QUIET :=
550 ANDROID_SILENT :=
551 else
552 ANT_QUIET := -q
553 ANDROID_SILENT := -s
554 endif
556 .PHONY: androidgcs
557 androidgcs: uavo-collections_java
558 $(V0) @$(ECHO) " ANDROID $(call toprel, $(ANDROIDGCS_OUT_DIR))"
559 $(V1) $(MKDIR) -p $(ANDROIDGCS_OUT_DIR)
560 $(V1) $(ANDROID) $(ANDROID_SILENT) update project \
561 --target "Google Inc.:Google APIs:$(GOOGLE_API_VERSION)" \
562 --name androidgcs \
563 --path ./androidgcs
564 $(V1) $(ANT) -f ./androidgcs/build.xml \
565 $(ANT_QUIET) \
566 -Dout.dir="../$(call toprel, $(ANDROIDGCS_OUT_DIR)/bin)" \
567 -Dgen.absolute.dir="$(ANDROIDGCS_OUT_DIR)/gen" \
568 $(ANDROIDGCS_BUILD_CONF)
570 .PHONY: androidgcs_clean
571 androidgcs_clean:
572 @$(ECHO) " CLEAN $(call toprel, $(ANDROIDGCS_OUT_DIR))"
573 $(V1) [ ! -d "$(ANDROIDGCS_OUT_DIR)" ] || $(RM) -r "$(ANDROIDGCS_OUT_DIR)"
575 # We want to take snapshots of the UAVOs at each point that they change
576 # to allow the GCS to be compatible with as many versions as possible.
577 # We always include a pseudo collection called "srctree" which represents
578 # the UAVOs in the source tree. So not necessary to add current tree UAVO
579 # hash here, it is always included.
581 # Find the git hashes of each commit that changes uavobjects with:
582 # git log --format=%h -- shared/uavobjectdefinition/ | head -n 2
583 # List only UAVO hashes of past releases, do not list current hash.
584 # Past compatible versions are so far: RELEASE-12.10.2
585 UAVO_GIT_VERSIONS := 5e14f53
587 # All versions includes also the current source tree UAVO hash
588 UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree
590 # This is where the UAVO collections are stored
591 UAVO_COLLECTION_DIR := $(BUILD_DIR)/uavo-collections
593 # $(1) git hash of a UAVO snapshot
594 define UAVO_COLLECTION_GIT_TEMPLATE
596 # Make the output directory that will contain all of the synthetics for the
597 # uavo collection referenced by the git hash $(1)
598 $$(UAVO_COLLECTION_DIR)/$(1):
599 $$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1)
601 # Extract the snapshot of shared/uavobjectdefinition from git hash $(1)
602 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1)
603 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar:
604 $$(V0) @$(ECHO) " UAVOTAR $(1)"
605 $$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/
607 # Extract the uavo xml files from our snapshot
608 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar
609 $$(V0) @$(ECHO) " UAVOUNTAR $(1)"
610 $$(V1) $(RM) -rf $$@
611 $$(V1) $(MKDIR) -p $$@
612 $$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@
613 endef
615 # Map the current working directory into the set of UAVO collections
616 $(UAVO_COLLECTION_DIR)/srctree:
617 $(V1) $(MKDIR) -p $@
619 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree
620 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR)
621 $(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml
623 # $(1) git hash (or symbolic name) of a UAVO snapshot
624 define UAVO_COLLECTION_BUILD_TEMPLATE
626 # This leaves us with a (broken) symlink that points to the full sha1sum of the collection
627 $$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
628 # Compute the sha1 hash for this UAVO collection
629 # The sed bit truncates the UAVO hash to 16 hex digits
630 $$(V1) $$(VERSION_INFO) \
631 --uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
632 --format='$$$${UAVO_HASH}' | \
633 $(SED) -e 's|\(................\).*|\1|' > $$@
635 $$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
637 # Generate the java uavobjects for this UAVO collection
638 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash
639 $$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
640 $$(V1) $(MKDIR) -p $$@
641 $$(V1) ( \
642 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
643 $$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \
646 # Build a jar file for this UAVO collection
647 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos
648 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java
649 $$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
650 $$(V1) ( \
651 HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \
652 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
653 $(JAVAC) java/*.java \
654 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \
655 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \
656 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \
657 -d . && \
658 find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \
659 $(JAR) cf tmp_uavobjects.jar @classlist.txt && \
660 $$(ANDROID_DX) \
661 --dex \
662 --output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \
663 tmp_uavobjects.jar && \
664 $(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \
667 endef
669 # One of these for each element of UAVO_GIT_VERSIONS so we can extract the UAVOs from git
670 $(foreach githash, $(UAVO_GIT_VERSIONS), $(eval $(call UAVO_COLLECTION_GIT_TEMPLATE,$(githash))))
672 # One of these for each UAVO_ALL_VERSIONS which includes the ones in the srctree
673 $(foreach githash, $(UAVO_ALL_VERSIONS), $(eval $(call UAVO_COLLECTION_BUILD_TEMPLATE,$(githash))))
675 .PHONY: uavo-collections_java
676 uavo-collections_java: $(foreach githash, $(UAVO_ALL_VERSIONS), $(UAVO_COLLECTION_DIR)/$(githash)/java-build/uavobjects.jar)
678 .PHONY: uavo-collections
679 uavo-collections: uavo-collections_java
681 .PHONY: uavo-collections_clean
682 uavo-collections_clean:
683 @$(ECHO) " CLEAN $(call toprel, $(UAVO_COLLECTION_DIR))"
684 $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR)
686 ##############################
688 # Unit Tests
690 ##############################
692 ALL_UNITTESTS := logfs math lednotification
694 # Build the directory for the unit tests
695 UT_OUT_DIR := $(BUILD_DIR)/unit_tests
696 $(UT_OUT_DIR):
697 $(V1) $(MKDIR) -p $@
699 .PHONY: all_ut
700 all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
702 .PHONY: all_ut_xml
703 all_ut_xml: $(addsuffix _xml, $(addprefix ut_, $(ALL_UNITTESTS)))
705 .PHONY: all_ut_run
706 all_ut_run: $(addsuffix _run, $(addprefix ut_, $(ALL_UNITTESTS)))
708 .PHONY: all_ut_clean
709 all_ut_clean:
710 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR))"
711 $(V1) [ ! -d "$(UT_OUT_DIR)" ] || $(RM) -r "$(UT_OUT_DIR)"
713 # $(1) = Unit test name
714 define UT_TEMPLATE
715 .PHONY: ut_$(1)
716 ut_$(1): ut_$(1)_run
718 ut_$(1)_%: $$(UT_OUT_DIR)
719 $(V1) $(MKDIR) -p $(UT_OUT_DIR)/$(1)
720 $(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
721 $$(MAKE) -r --no-print-directory \
722 BUILD_TYPE=ut \
723 BOARD_SHORT_NAME=$(1) \
724 TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
725 OUTDIR="$(UT_OUT_DIR)/$(1)" \
726 TARGET=$(1) \
729 .PHONY: ut_$(1)_clean
730 ut_$(1)_clean:
731 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR)/$(1))"
732 $(V1) [ ! -d "$(UT_OUT_DIR)/$(1)" ] || $(RM) -r "$(UT_OUT_DIR)/$(1)"
733 endef
735 # Expand the unittest rules
736 $(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut))))
738 # Disable parallel make when the all_ut_run target is requested otherwise the TAP
739 # output is interleaved with the rest of the make output.
740 ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),)
741 .NOTPARALLEL:
742 $(info $(EMPTY) NOTE Parallel make disabled by all_ut_run target so we have sane console output)
743 endif
745 ##############################
747 # Packaging components
749 ##############################
751 # Firmware files to package
752 PACKAGE_FW_EXCLUDE := fw_simposix $(if $(PACKAGE_FW_INCLUDE_DISCOVERYF4BARE),,fw_discoveryf4bare)
753 PACKAGE_FW_TARGETS := $(filter-out $(PACKAGE_FW_EXCLUDE), $(FW_TARGETS))
754 PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS))
756 # Rules to generate GCS resources used to embed firmware binaries into the GCS.
757 # They are used later by the vehicle setup wizard to update board firmware.
758 # To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
759 OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc
760 OPFW_RESOURCE_PREFIX := ../../
761 OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
762 OPFW_CONTENTS := \
763 <!DOCTYPE RCC><RCC version="1.0"> \
764 <qresource prefix="/firmware"> \
765 $(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
766 </qresource> \
767 </RCC>
769 .PHONY: opfw_resource
770 opfw_resource: $(OPFW_RESOURCE)
772 $(OPFW_RESOURCE): $(FW_TARGETS)
773 @$(ECHO) Generating OPFW resource file $(call toprel, $@)
774 $(V1) $(MKDIR) -p $(dir $@)
775 $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
777 # If opfw_resource or all firmware are requested, GCS should depend on the resource
778 ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),)
779 $(eval openpilotgcs_qmake: $(OPFW_RESOURCE))
780 endif
782 # Packaging targets: package
783 # - builds all firmware, opfw_resource, gcs
784 # - copies firmware into a package directory
785 # - calls paltform-specific packaging script
787 # Define some variables
788 export PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL})
789 export PACKAGE_NAME := OpenPilot
790 export PACKAGE_SEP := -
792 .PHONY: package
794 include $(ROOT_DIR)/package/$(UNAME).mk
796 package: all_fw all_ground uavobjects_matlab $(PACKAGE_DIR)
797 ifneq ($(GCS_BUILD_CONF),release)
798 # We can only package release builds
799 $(error Packaging is currently supported for release builds only)
800 endif
802 ##############################
804 # Source code formatting
806 ##############################
808 UNCRUSTIFY_TARGETS := flight ground
810 # $(1) = Uncrustify target (e.g flight or ground)
811 # $(2) = Target root directory
812 define UNCRUSTIFY_TEMPLATE
814 .PHONY: uncrustify_$(1)
815 uncrustify_$(1):
816 @$(ECHO) "Auto-formatting $(1) source code"
817 $(V1) UNCRUSTIFY_CONFIG="$(ROOT_DIR)/make/uncrustify/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
818 endef
820 $(foreach uncrustify_targ, $(UNCRUSTIFY_TARGETS), $(eval $(call UNCRUSTIFY_TEMPLATE,$(uncrustify_targ),$(ROOT_DIR)/$(uncrustify_targ))))
822 .PHONY: uncrustify_all
823 uncrustify_all: $(addprefix uncrustify_,$(UNCRUSTIFY_TARGETS))
825 ##############################
827 # Doxygen documentation
829 # Each target should have own Doxyfile.$(target) with build directory build/docs/$(target),
830 # proper source directory (e.g. $(target)) and appropriate other doxygen options.
832 ##############################
834 DOCS_TARGETS := flight ground uavobjects
836 # $(1) = Doxygen target (e.g flight or ground)
837 define DOXYGEN_TEMPLATE
839 .PHONY: docs_$(1)
840 docs_$(1): docs_$(1)_clean
841 @$(ECHO) "Generating $(1) documentation"
842 $(V1) $(MKDIR) -p $(BUILD_DIR)/docs/$(1)
843 $(V1) $(DOXYGEN) $(ROOT_DIR)/make/doxygen/Doxyfile.$(1)
845 .PHONY: docs_$(1)_clean
846 docs_$(1)_clean:
847 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs/$(1))"
848 $(V1) [ ! -d "$(BUILD_DIR)/docs/$(1)" ] || $(RM) -r "$(BUILD_DIR)/docs/$(1)"
850 endef
852 $(foreach docs_targ, $(DOCS_TARGETS), $(eval $(call DOXYGEN_TEMPLATE,$(docs_targ))))
854 .PHONY: docs_all
855 docs_all: $(addprefix docs_,$(DOCS_TARGETS))
857 .PHONY: docs_all_clean
858 docs_all_clean:
859 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs)"
860 $(V1) [ ! -d "$(BUILD_DIR)/docs" ] || $(RM) -rf "$(BUILD_DIR)/docs"
862 ##############################
864 # Build info
866 ##############################
868 .PHONY: build-info
869 build-info:
870 @$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
871 $(V1) $(MKDIR) -p $(BUILD_DIR)
872 $(V1) $(VERSION_INFO) \
873 --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
874 --template="make/templates/$@.txt" \
875 --outfile="$(BUILD_DIR)/$@.txt"
877 ##############################
879 # Source for distribution
881 ##############################
883 DIST_VER_INFO := $(DIST_DIR)/version-info.json
885 .PHONY: $(DIST_VER_INFO) # Because to many deps to list
886 $(DIST_VER_INFO): $(DIST_DIR)
887 $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
889 .PHONY: dist
890 dist: $(DIST_DIR) $(DIST_VER_INFO)
891 @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_DIR))"
892 $(eval DIST_NAME := $(call toprel, "$(DIST_DIR)/OpenPilot-$(shell git describe).tar"))
893 $(V1) git archive --prefix="OpenPilot/" -o "$(DIST_NAME)" HEAD
894 $(V1) tar --append --file="$(DIST_NAME)" \
895 --transform='s,.*version-info.json,OpenPilot/version-info.json,' \
896 $(call toprel, "$(DIST_VER_INFO)")
897 $(V1) gzip -f "$(DIST_NAME)"
900 ##############################
902 # Help message, the default Makefile goal
904 ##############################
906 .DEFAULT_GOAL := help
908 .PHONY: help
909 help:
910 @$(ECHO)
911 @$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment."
912 @$(ECHO) " It also works on Windows by following the instructions given on this wiki page:"
913 @$(ECHO) " http://wiki.openpilot.org/display/Doc/Windows%3A+Building+and+Packaging"
914 @$(ECHO)
915 @$(ECHO) " Here is a summary of the available targets:"
916 @$(ECHO)
917 @$(ECHO) " [Source tree preparation]"
918 @$(ECHO) " prepare - Install GIT commit message template"
919 @$(ECHO) " [Tool Installers]"
920 @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain"
921 @$(ECHO) " qt_sdk_install - Install the QT development tools"
922 @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
923 @$(ECHO) " sdl_install - Install the SDL library (Windows only)"
924 @$(ECHO) " mesawin_install - Install the OpenGL32 DLL (Windows only)"
925 @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)"
926 @$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
927 @$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
928 @$(ECHO) " gtest_install - Install the GoogleTest framework"
929 @$(ECHO) " These targets are not updated yet and are probably broken:"
930 @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
931 @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
932 @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
933 @$(ECHO) " android_sdk_install - Install the Android SDK tools"
934 @$(ECHO) " Install all available tools:"
935 @$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
936 @$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
937 @$(ECHO)
938 @$(ECHO) " Other tool options are:"
939 @$(ECHO) " <tool>_version - Display <tool> version"
940 @$(ECHO) " <tool>_clean - Remove installed <tool>"
941 @$(ECHO) " <tool>_distclean - Remove downloaded <tool> distribution file(s)"
942 @$(ECHO)
943 @$(ECHO) " [Big Hammer]"
944 @$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs"
945 @$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters"
946 @$(ECHO) " all_fw - Build only firmware for all boards"
947 @$(ECHO) " all_bl - Build only bootloaders for all boards"
948 @$(ECHO) " all_bu - Build only bootloader updaters for all boards"
949 @$(ECHO)
950 @$(ECHO) " all_clean - Remove your build directory ($(BUILD_DIR))"
951 @$(ECHO) " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
952 @$(ECHO) " all_fw_clean - Remove firmware for all boards"
953 @$(ECHO) " all_bl_clean - Remove bootloaders for all boards"
954 @$(ECHO) " all_bu_clean - Remove bootloader updaters for all boards"
955 @$(ECHO)
956 @$(ECHO) " all_<board> - Build all available images for <board>"
957 @$(ECHO) " all_<board>_clean - Remove all available images for <board>"
958 @$(ECHO)
959 @$(ECHO) " all_ut - Build all unit tests"
960 @$(ECHO) " all_ut_tap - Run all unit tests and capture all TAP output to files"
961 @$(ECHO) " all_ut_run - Run all unit tests and dump TAP output to console"
962 @$(ECHO)
963 @$(ECHO) " [Firmware]"
964 @$(ECHO) " <board> - Build firmware for <board>"
965 @$(ECHO) " Supported boards are ($(ALL_BOARDS))"
966 @$(ECHO) " fw_<board> - Build firmware for <board>"
967 @$(ECHO) " Supported boards are ($(FW_BOARDS))"
968 @$(ECHO) " fw_<board>_clean - Remove firmware for <board>"
969 @$(ECHO) " fw_<board>_program - Use OpenOCD + JTAG to write firmware to <board>"
970 @$(ECHO)
971 @$(ECHO) " [Bootloader]"
972 @$(ECHO) " bl_<board> - Build bootloader for <board>"
973 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
974 @$(ECHO) " bl_<board>_clean - Remove bootloader for <board>"
975 @$(ECHO) " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
976 @$(ECHO)
977 @$(ECHO) " [Entire Flash]"
978 @$(ECHO) " ef_<board> - Build entire flash image for <board>"
979 @$(ECHO) " Supported boards are ($(EF_BOARDS))"
980 @$(ECHO) " ef_<board>_clean - Remove entire flash image for <board>"
981 @$(ECHO) " ef_<board>_program - Use OpenOCD + JTAG to write entire flash image to <board>"
982 @$(ECHO)
983 @$(ECHO) " [Bootloader Updater]"
984 @$(ECHO) " bu_<board> - Build bootloader updater for <board>"
985 @$(ECHO) " Supported boards are ($(BU_BOARDS))"
986 @$(ECHO) " bu_<board>_clean - Remove bootloader updater for <board>"
987 @$(ECHO)
988 @$(ECHO) " [Unbrick a board]"
989 @$(ECHO) " unbrick_<board> - Use the STM32's built in boot ROM to write a bootloader to <board>"
990 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
991 @$(ECHO) " [Unittests]"
992 @$(ECHO) " ut_<test> - Build unit test <test>"
993 @$(ECHO) " ut_<test>_xml - Run test and capture XML output into a file"
994 @$(ECHO) " ut_<test>_run - Run test and dump output to console"
995 @$(ECHO)
996 @$(ECHO) " [Simulation]"
997 @$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
998 @$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
999 @$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
1000 @$(ECHO) " using mingw and msys"
1001 @$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
1002 @$(ECHO)
1003 @$(ECHO) " [GCS]"
1004 @$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)"
1005 @$(ECHO) " Skip qmake: QMAKE_SKIP=1"
1006 @$(ECHO) " Compile specific directory: MAKE_DIR=<dir>"
1007 @$(ECHO) " Example: make gcs QMAKE_SKIP=1 MAKE_DIR=src/plugins/coreplugin"
1008 @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)"
1009 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
1010 @$(ECHO)
1011 @$(ECHO) " [Uploader Tool]"
1012 @$(ECHO) " uploader - Build the serial uploader tool (debug|release)"
1013 @$(ECHO) " Skip qmake: QMAKE_SKIP=1"
1014 @$(ECHO) " Example: make uploader QMAKE_SKIP=1"
1015 @$(ECHO) " uploader_clean - Remove the serial uploader tool (debug|release)"
1016 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
1017 @$(ECHO)
1018 @$(ECHO)
1019 @$(ECHO) " [AndroidGCS]"
1020 @$(ECHO) " androidgcs - Build the Android Ground Control System (GCS) application"
1021 @$(ECHO) " androidgcs_install - Use ADB to install the Android GCS application"
1022 @$(ECHO) " androidgcs_run - Run the Android GCS application"
1023 @$(ECHO) " androidgcs_clean - Remove the Android GCS application"
1024 @$(ECHO)
1025 @$(ECHO) " [UAVObjects]"
1026 @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files"
1027 @$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..."
1028 @$(ECHO) " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
1029 @$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
1030 @$(ECHO)
1031 @$(ECHO) " [Packaging]"
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) " dist - Generate source archive for distribution"
1035 @$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)"
1036 @$(ECHO)
1037 @$(ECHO) " [Code Formatting]"
1038 @$(ECHO) " uncrustify_<source> - Reformat <source> code according to the project's standards"
1039 @$(ECHO) " Supported sources are ($(UNCRUSTIFY_TARGETS))"
1040 @$(ECHO) " uncrustify_all - Reformat all source code"
1041 @$(ECHO)
1042 @$(ECHO) " [Code Documentation]"
1043 @$(ECHO) " docs_<source> - Generate HTML documentation for <source>"
1044 @$(ECHO) " Supported sources are ($(DOCS_TARGETS))"
1045 @$(ECHO) " docs_all - Generate HTML documentation for all"
1046 @$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
1047 @$(ECHO) " docs_all_clean - Delete all generated documentation"
1048 @$(ECHO)
1049 @$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
1050 @$(ECHO)
1051 @$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
1052 @$(ECHO) " All tools will be installed into $(TOOLS_DIR)"
1053 @$(ECHO) " All build output will be placed in $(BUILD_DIR)"
1054 @$(ECHO)
1055 @$(ECHO) " Tool download and install directories can be changed using environment variables:"
1056 @$(ECHO) " OPENPILOT_DL_DIR full path to downloads directory [downloads if not set]"
1057 @$(ECHO) " OPENPILOT_TOOLS_DIR full path to installed tools directory [tools if not set]"
1058 @$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
1059 @$(ECHO)