LP-65 Heli tab : Custom values refreshed - Check unused/duplicate output channels
[librepilot.git] / Makefile
blob3d8b4542a6f72d656980498875aebe27776fb7ac
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 TOP_LEVEL_MAKEFILE := TRUE
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 DIRS = $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR)
54 # Function to convert to all lowercase
55 lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
56 # Function to make all lowercase and replace spaces with -
57 EMPTY :=
58 SPACE := $(EMPTY) $(EMPTY)
59 smallify = $(subst $(SPACE),-,$(call lc,$1))
61 # Naming for binaries and packaging etc,.
62 ORG_BIG_NAME := LibrePilot
63 GCS_BIG_NAME = ${ORG_BIG_NAME} GCS
64 # These should be lowercase with no spaces
65 ORG_SMALL_NAME = $(call smallify,$(ORG_BIG_NAME))
66 GCS_SMALL_NAME = $(call smallify,$(GCS_BIG_NAME))
68 # Set up default build configurations (debug | release)
69 GCS_BUILD_CONF := release
70 GOOGLE_API_VERSION := 14
72 # Clean out undesirable variables from the environment and command-line
73 # to remove the chance that they will cause problems with our build
74 define SANITIZE_VAR
75 $(if $(filter-out undefined,$(origin $(1))),
76 $(info $(EMPTY) NOTE Sanitized $(2) variable '$(1)' from $(origin $(1)))
77 MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES))
78 override $(1) :=
79 unexport $(1)
81 endef
83 # These specific variables can influence compilation in unexpected (and undesirable) ways
84 # gcc flags
85 SANITIZE_GCC_VARS := TMPDIR GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH
86 # preprocessor flags
87 SANITIZE_GCC_VARS += CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH DEPENDENCIES_OUTPUT
88 # make flags
89 SANITIZE_GCC_VARS += CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LDLIBS
90 $(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowed)))
92 # These specific variables used to be valid but now they make no sense
93 SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER CLEAN_BUILD
94 $(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated)))
96 # Make sure this isn't being run as root unless installing (no whoami on Windows, but that is ok here)
97 ifeq ($(shell whoami 2>/dev/null),root)
98 ifeq ($(filter install,$(MAKECMDGOALS)),)
99 ifndef FAKEROOTKEY
100 $(error You should not be running this as root)
101 endif
102 endif
103 endif
105 # Decide on a verbosity level based on the V= parameter
106 export AT := @
107 ifndef V
108 export V0 :=
109 export V1 := $(AT)
110 else ifeq ($(V), 0)
111 export V0 := $(AT)
112 export V1 := $(AT)
113 else ifeq ($(V), 1)
114 endif
116 # Make sure we know few things about the architecture before including
117 # the tools.mk to ensure that we download/install the right tools.
118 UNAME := $(shell uname)
119 ARCH := $(shell uname -m)
120 # Here and everywhere if not Linux or Mac then assume Windows
121 ifeq ($(filter Linux Darwin, $(UNAME)), )
122 UNAME := Windows
123 endif
125 # Include tools installers
126 include $(ROOT_DIR)/make/tools.mk
128 # Include third party builders if available
129 -include $(ROOT_DIR)/make/3rdparty/3rdparty.mk
131 # We almost need to consider autoconf/automake instead of this
132 ifeq ($(UNAME), Linux)
133 QT_SPEC = linux-g++
134 UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
135 else ifeq ($(UNAME), Darwin)
136 QT_SPEC = macx-g++
137 UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
138 else ifeq ($(UNAME), Windows)
139 QT_SPEC = win32-g++
140 UAVOBJGENERATOR = $(BUILD_DIR)/uavobjgenerator/uavobjgenerator.exe
141 endif
143 CONFIG_FILE := config
144 -include $(CONFIG_FILE)
146 ##############################
148 # All targets
150 ##############################
152 .PHONY: all
153 all: uavobjects all_ground all_flight
155 .PHONY: all_clean
156 all_clean:
157 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR))"
158 $(V1) [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)"
160 .PHONY: clean
161 clean: all_clean
164 ##############################
166 # UAVObjects
168 ##############################
170 UAVOBJGENERATOR_DIR = $(BUILD_DIR)/uavobjgenerator
171 DIRS += $(UAVOBJGENERATOR_DIR)
173 .PHONY: uavobjgenerator
174 uavobjgenerator $(UAVOBJGENERATOR): | $(UAVOBJGENERATOR_DIR)
175 $(V1) cd $(UAVOBJGENERATOR_DIR) && \
176 ( [ -f Makefile ] || $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro \
177 -spec $(QT_SPEC) CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) ) && \
178 $(MAKE) --no-print-directory -w
180 UAVOBJ_TARGETS := gcs flight python matlab java wireshark
182 .PHONY: uavobjects
183 uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
185 UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
186 UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
188 uavobjects_%: uavobjgenerator
189 @$(MKDIR) -p $(UAVOBJ_OUT_DIR)/$*
190 $(V1) ( cd $(UAVOBJ_OUT_DIR)/$* && \
191 $(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
194 uavobjects_test: uavobjgenerator
195 $(V1) $(UAVOBJGENERATOR) -v $(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 DIRS += $(OPGCSSYNTHDIR)
219 # Define supported board lists
220 ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum revonano
222 # Short names of each board (used to display board name in parallel builds)
223 coptercontrol_short := 'cc '
224 oplinkmini_short := 'oplm'
225 revolution_short := 'revo'
226 osd_short := 'osd '
227 revoproto_short := 'revp'
228 revonano_short := 'revn'
229 simposix_short := 'posx'
230 discoveryf4bare_short := 'df4b'
231 gpsplatinum_short := 'gps9'
233 # SimPosix only builds on Linux so drop it from the list for
234 # all other platforms.
235 ifneq ($(UNAME), Linux)
236 ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
237 endif
239 # Start out assuming that we'll build fw, bl and bu for all boards
240 FW_BOARDS := $(ALL_BOARDS)
241 BL_BOARDS := $(ALL_BOARDS)
242 BU_BOARDS := $(ALL_BOARDS)
243 EF_BOARDS := $(ALL_BOARDS)
245 # SimPosix doesn't have a BL, BU or EF target so we need to
246 # filter them out to prevent errors on the all_flight target.
247 BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
248 BU_BOARDS := $(filter-out simposix gpsplatinum, $(BU_BOARDS))
249 EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
251 # Generate the targets for whatever boards are left in each list
252 FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
253 BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
254 BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
255 EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
257 # When building any of the "all_*" targets, tell all sub makefiles to display
258 # additional details on each line of output to describe which build and target
259 # that each line applies to. The same applies also to all, opfw_resource,
260 # package targets
261 ifneq ($(strip $(filter all_% all opfw_resource package,$(MAKECMDGOALS))),)
262 export ENABLE_MSG_EXTRA := yes
263 endif
265 # When building more than one goal in a single make invocation, also
266 # enable the extra context for each output line
267 ifneq ($(word 2,$(MAKECMDGOALS)),)
268 export ENABLE_MSG_EXTRA := yes
269 endif
271 # TEMPLATES (used to generate build rules)
273 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
274 # $(2) = Short name for board (e.g cc)
275 define FW_TEMPLATE
276 .PHONY: $(1) fw_$(1)
277 $(1): fw_$(1)_opfw
278 fw_$(1): fw_$(1)_opfw
280 fw_$(1)_%: uavobjects_flight
281 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
282 $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
283 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
284 $$(MAKE) -r --no-print-directory \
285 BUILD_TYPE=fw \
286 BOARD_NAME=$(1) \
287 BOARD_SHORT_NAME=$(2) \
288 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
289 OUTDIR=$(BUILD_DIR)/fw_$(1) \
290 TARGET=fw_$(1) \
293 .PHONY: $(1)_clean
294 $(1)_clean: fw_$(1)_clean
295 fw_$(1)_clean:
296 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/fw_$(1))"
297 $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
298 endef
300 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
301 # $(2) = Short name for board (e.g cc)
302 define BL_TEMPLATE
303 .PHONY: bl_$(1)
304 bl_$(1): bl_$(1)_bin
305 bl_$(1)_bino: bl_$(1)_bin
307 bl_$(1)_%:
308 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
309 $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
310 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
311 $$(MAKE) -r --no-print-directory \
312 BUILD_TYPE=bl \
313 BOARD_NAME=$(1) \
314 BOARD_SHORT_NAME=$(2) \
315 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
316 OUTDIR=$(BUILD_DIR)/bl_$(1) \
317 TARGET=bl_$(1) \
320 .PHONY: unbrick_$(1)
321 unbrick_$(1): bl_$(1)_hex
322 $(if $(filter-out undefined,$(origin UNBRICK_TTY)),
323 $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)"
324 $(V1) $(STM32FLASH_DIR)/stm32flash \
325 -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \
326 -g 0x0 \
327 $$(UNBRICK_TTY)
329 $(V0) @$(ECHO)
330 $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
331 $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
334 .PHONY: bl_$(1)_clean
335 bl_$(1)_clean:
336 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bl_$(1))"
337 $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
338 endef
340 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
341 # $(2) = Short name for board (e.g cc)
342 define BU_TEMPLATE
343 .PHONY: bu_$(1)
344 bu_$(1): bu_$(1)_opfw
346 bu_$(1)_%: bl_$(1)_bino
347 $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
348 $(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
349 $$(MAKE) -r --no-print-directory \
350 BUILD_TYPE=bu \
351 BOARD_NAME=$(1) \
352 BOARD_SHORT_NAME=$(2) \
353 TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
354 OUTDIR=$(BUILD_DIR)/bu_$(1) \
355 TARGET=bu_$(1) \
358 .PHONY: bu_$(1)_clean
359 bu_$(1)_clean:
360 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bu_$(1))"
361 $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
362 endef
364 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
365 # $(2) = Short name for board (e.g cc)
366 define EF_TEMPLATE
367 .PHONY: ef_$(1)
368 ef_$(1): ef_$(1)_bin
370 ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
371 $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
372 $(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
373 $$(MAKE) -r --no-print-directory \
374 BUILD_TYPE=ef \
375 BOARD_NAME=$(1) \
376 BOARD_SHORT_NAME=$(2) \
377 DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
378 TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
379 OUTDIR=$(BUILD_DIR)/ef_$(1) \
380 TARGET=ef_$(1) \
383 .PHONY: ef_$(1)_clean
384 ef_$(1)_clean:
385 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/ef_$(1))"
386 $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
387 endef
389 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
390 define BOARD_PHONY_TEMPLATE
391 .PHONY: all_$(1)
392 all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
393 all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
394 all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
395 all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
397 .PHONY: all_$(1)_clean
398 all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
399 all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
400 all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
401 all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
402 endef
404 # Generate flight build rules
405 .PHONY: all_fw all_fw_clean
406 all_fw: $(addsuffix _opfw, $(FW_TARGETS))
407 all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
409 .PHONY: all_bl all_bl_clean
410 all_bl: $(addsuffix _bin, $(BL_TARGETS))
411 all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
413 .PHONY: all_bu all_bu_clean
414 all_bu: $(addsuffix _opfw, $(BU_TARGETS))
415 all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
417 .PHONY: all_ef all_ef_clean
418 all_ef: $(EF_TARGETS)
419 all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
421 .PHONY: all_flight all_flight_clean
422 all_flight: all_fw all_bl all_bu all_ef
423 all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
425 # Expand the groups of targets for each board
426 $(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
428 # Expand the firmware rules
429 $(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_short))))
431 # Expand the bootloader rules
432 $(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_short))))
434 # Expand the bootloader updater rules
435 $(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_short))))
437 # Expand the entire-flash rules
438 $(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_short))))
440 .PHONY: sim_win32
441 sim_win32: sim_win32_exe
443 sim_win32_%: uavobjects_flight
444 $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32
445 $(V1) $(MAKE) --no-print-directory \
446 -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $*
448 .PHONY: sim_osx
449 sim_osx: sim_osx_elf
451 sim_osx_%: uavobjects_flight
452 $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx
453 $(V1) $(MAKE) --no-print-directory \
454 -C $(ROOT_DIR)/flight/targets/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
456 ##############################
458 # GCS related components
460 ##############################
462 .PHONY: all_ground
463 all_ground: openpilotgcs uploader
465 # Convenience target for the GCS
466 .PHONY: gcs gcs_qmake gcs_clean
467 gcs: openpilotgcs
468 gcs_qmake: openpilotgcs_qmake
469 gcs_clean: openpilotgcs_clean
471 ifeq ($(V), 1)
472 GCS_SILENT :=
473 else
474 GCS_SILENT := silent
475 endif
477 OPENPILOTGCS_DIR := $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)
478 DIRS += $(OPENPILOTGCS_DIR)
480 OPENPILOTGCS_MAKEFILE := $(OPENPILOTGCS_DIR)/Makefile
482 .PHONY: openpilotgcs_qmake
483 openpilotgcs_qmake $(OPENPILOTGCS_MAKEFILE): | $(OPENPILOTGCS_DIR)
484 $(V1) cd $(OPENPILOTGCS_DIR) && \
485 $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro \
486 -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) \
487 'GCS_BIG_NAME="$(GCS_BIG_NAME)"' GCS_SMALL_NAME=$(GCS_SMALL_NAME) \
488 'ORG_BIG_NAME="$(ORG_BIG_NAME)"' ORG_SMALL_NAME=$(ORG_SMALL_NAME) \
489 $(GCS_QMAKE_OPTS)
491 .PHONY: openpilotgcs
492 openpilotgcs: uavobjgenerator $(OPENPILOTGCS_MAKEFILE)
493 $(V1) $(MAKE) -w -C $(OPENPILOTGCS_DIR)/$(MAKE_DIR);
495 .PHONY: openpilotgcs_clean
496 openpilotgcs_clean:
497 @$(ECHO) " CLEAN $(call toprel, $(OPENPILOTGCS_DIR))"
498 $(V1) [ ! -d "$(OPENPILOTGCS_DIR)" ] || $(RM) -r "$(OPENPILOTGCS_DIR)"
502 ################################
504 # Serial Uploader tool
506 ################################
508 UPLOADER_DIR := $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
509 DIRS += $(UPLOADER_DIR)
511 UPLOADER_MAKEFILE := $(UPLOADER_DIR)/Makefile
513 .PHONY: uploader_qmake
514 uploader_qmake $(UPLOADER_MAKEFILE): | $(UPLOADER_DIR)
515 $(V1) cd $(UPLOADER_DIR) && \
516 $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/upload.pro \
517 -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) $(GCS_QMAKE_OPTS)
519 .PHONY: uploader
520 uploader: $(UPLOADER_MAKEFILE)
521 $(V1) $(MAKE) -w -C $(UPLOADER_DIR)
523 .PHONY: uploader_clean
524 uploader_clean:
525 @$(ECHO) " CLEAN $(call toprel, $(UPLOADER_DIR))"
526 $(V1) [ ! -d "$(UPLOADER_DIR)" ] || $(RM) -r "$(UPLOADER_DIR)"
529 # We want to take snapshots of the UAVOs at each point that they change
530 # to allow the GCS to be compatible with as many versions as possible.
531 # We always include a pseudo collection called "srctree" which represents
532 # the UAVOs in the source tree. So not necessary to add current tree UAVO
533 # hash here, it is always included.
535 # Find the git hashes of each commit that changes uavobjects with:
536 # git log --format=%h -- shared/uavobjectdefinition/ | head -n 2
537 # List only UAVO hashes of past releases, do not list current hash.
538 # Past compatible versions are so far: RELEASE-12.10.2
539 UAVO_GIT_VERSIONS := 5e14f53
541 # All versions includes also the current source tree UAVO hash
542 UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree
544 # This is where the UAVO collections are stored
545 UAVO_COLLECTION_DIR := $(BUILD_DIR)/uavo-collections
547 # $(1) git hash of a UAVO snapshot
548 define UAVO_COLLECTION_GIT_TEMPLATE
550 # Make the output directory that will contain all of the synthetics for the
551 # uavo collection referenced by the git hash $(1)
552 $$(UAVO_COLLECTION_DIR)/$(1):
553 $$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1)
555 # Extract the snapshot of shared/uavobjectdefinition from git hash $(1)
556 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1)
557 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar:
558 $$(V0) @$(ECHO) " UAVOTAR $(1)"
559 $$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/
561 # Extract the uavo xml files from our snapshot
562 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar
563 $$(V0) @$(ECHO) " UAVOUNTAR $(1)"
564 $$(V1) $(RM) -rf $$@
565 $$(V1) $(MKDIR) -p $$@
566 $$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@
567 endef
569 # Map the current working directory into the set of UAVO collections
570 $(UAVO_COLLECTION_DIR)/srctree:
571 $(V1) $(MKDIR) -p $@
573 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree
574 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR)
575 $(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml
577 # $(1) git hash (or symbolic name) of a UAVO snapshot
578 define UAVO_COLLECTION_BUILD_TEMPLATE
580 # This leaves us with a (broken) symlink that points to the full sha1sum of the collection
581 $$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
582 # Compute the sha1 hash for this UAVO collection
583 # The sed bit truncates the UAVO hash to 16 hex digits
584 $$(V1) $$(VERSION_INFO) \
585 --uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
586 --format='$$$${UAVO_HASH}' | \
587 $(SED) -e 's|\(................\).*|\1|' > $$@
589 $$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
591 # Generate the java uavobjects for this UAVO collection
592 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash
593 $$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
594 $$(V1) $(MKDIR) -p $$@
595 $$(V1) ( \
596 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
597 $$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \
600 # Build a jar file for this UAVO collection
601 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos
602 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java
603 $$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
604 $$(V1) ( \
605 HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \
606 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
607 $(JAVAC) java/*.java \
608 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \
609 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \
610 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \
611 -d . && \
612 find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \
613 $(JAR) cf tmp_uavobjects.jar @classlist.txt && \
614 $$(ANDROID_DX) \
615 --dex \
616 --output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \
617 tmp_uavobjects.jar && \
618 $(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \
621 endef
623 # One of these for each element of UAVO_GIT_VERSIONS so we can extract the UAVOs from git
624 $(foreach githash, $(UAVO_GIT_VERSIONS), $(eval $(call UAVO_COLLECTION_GIT_TEMPLATE,$(githash))))
626 # One of these for each UAVO_ALL_VERSIONS which includes the ones in the srctree
627 $(foreach githash, $(UAVO_ALL_VERSIONS), $(eval $(call UAVO_COLLECTION_BUILD_TEMPLATE,$(githash))))
629 .PHONY: uavo-collections_java
630 uavo-collections_java: $(foreach githash, $(UAVO_ALL_VERSIONS), $(UAVO_COLLECTION_DIR)/$(githash)/java-build/uavobjects.jar)
632 .PHONY: uavo-collections
633 uavo-collections: uavo-collections_java
635 .PHONY: uavo-collections_clean
636 uavo-collections_clean:
637 @$(ECHO) " CLEAN $(call toprel, $(UAVO_COLLECTION_DIR))"
638 $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR)
640 ##############################
642 # Unit Tests
644 ##############################
646 ALL_UNITTESTS := logfs math lednotification
648 # Build the directory for the unit tests
649 UT_OUT_DIR := $(BUILD_DIR)/unit_tests
650 DIRS += $(UT_OUT_DIR)
652 .PHONY: all_ut
653 all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
655 .PHONY: all_ut_xml
656 all_ut_xml: $(addsuffix _xml, $(addprefix ut_, $(ALL_UNITTESTS)))
658 .PHONY: all_ut_run
659 all_ut_run: $(addsuffix _run, $(addprefix ut_, $(ALL_UNITTESTS)))
661 .PHONY: all_ut_clean
662 all_ut_clean:
663 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR))"
664 $(V1) [ ! -d "$(UT_OUT_DIR)" ] || $(RM) -r "$(UT_OUT_DIR)"
666 # $(1) = Unit test name
667 define UT_TEMPLATE
668 .PHONY: ut_$(1)
669 ut_$(1): ut_$(1)_run
671 ut_$(1)_%: $$(UT_OUT_DIR)
672 $(V1) $(MKDIR) -p $(UT_OUT_DIR)/$(1)
673 $(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
674 $$(MAKE) -r --no-print-directory \
675 BUILD_TYPE=ut \
676 BOARD_SHORT_NAME=$(1) \
677 TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
678 OUTDIR="$(UT_OUT_DIR)/$(1)" \
679 TARGET=$(1) \
682 .PHONY: ut_$(1)_clean
683 ut_$(1)_clean:
684 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR)/$(1))"
685 $(V1) [ ! -d "$(UT_OUT_DIR)/$(1)" ] || $(RM) -r "$(UT_OUT_DIR)/$(1)"
686 endef
688 # Expand the unittest rules
689 $(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut))))
691 # Disable parallel make when the all_ut_run target is requested otherwise the TAP
692 # output is interleaved with the rest of the make output.
693 ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),)
694 .NOTPARALLEL:
695 $(info $(EMPTY) NOTE Parallel make disabled by all_ut_run target so we have sane console output)
696 endif
698 ##############################
700 # Packaging components
702 ##############################
704 # Firmware files to package
705 PACKAGE_FW_EXCLUDE := fw_simposix $(if $(PACKAGE_FW_INCLUDE_DISCOVERYF4BARE),,fw_discoveryf4bare)
706 PACKAGE_FW_TARGETS := $(filter-out $(PACKAGE_FW_EXCLUDE), $(FW_TARGETS))
707 PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS))
709 # Rules to generate GCS resources used to embed firmware binaries into the GCS.
710 # They are used later by the vehicle setup wizard to update board firmware.
711 # To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
712 OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc
713 OPFW_RESOURCE_PREFIX := ../../
714 OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
715 OPFW_CONTENTS := \
716 <!DOCTYPE RCC><RCC version="1.0"> \
717 <qresource prefix="/firmware"> \
718 $(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
719 </qresource> \
720 </RCC>
722 .PHONY: opfw_resource
723 opfw_resource: $(OPFW_RESOURCE)
725 $(OPFW_RESOURCE): $(FW_TARGETS) | $(OPGCSSYNTHDIR)
726 @$(ECHO) Generating OPFW resource file $(call toprel, $@)
727 $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
729 # If opfw_resource or all firmware are requested, GCS should depend on the resource
730 ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),)
731 $(OPENPILOTGCS_MAKEFILE): $(OPFW_RESOURCE)
732 endif
734 # Packaging targets: package
735 # - builds all firmware, opfw_resource, gcs
736 # - copies firmware into a package directory
737 # - calls paltform-specific packaging script
739 # Define some variables
740 PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL})
741 PACKAGE_NAME := $(subst $(SPACE),,$(ORG_BIG_NAME))
742 PACKAGE_SEP := -
743 PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)
745 # Source distribution is never dirty because it uses git archive
746 DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar
748 include $(ROOT_DIR)/package/$(UNAME).mk
750 ##############################
752 # Source code formatting
754 ##############################
756 UNCRUSTIFY_TARGETS := flight ground
758 # $(1) = Uncrustify target (e.g flight or ground)
759 # $(2) = Target root directory
760 define UNCRUSTIFY_TEMPLATE
762 .PHONY: uncrustify_$(1)
763 uncrustify_$(1):
764 @$(ECHO) "Auto-formatting $(1) source code"
765 $(V1) UNCRUSTIFY_CONFIG="$(ROOT_DIR)/make/uncrustify/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
766 endef
768 $(foreach uncrustify_targ, $(UNCRUSTIFY_TARGETS), $(eval $(call UNCRUSTIFY_TEMPLATE,$(uncrustify_targ),$(ROOT_DIR)/$(uncrustify_targ))))
770 .PHONY: uncrustify_all
771 uncrustify_all: $(addprefix uncrustify_,$(UNCRUSTIFY_TARGETS))
773 ##############################
775 # Doxygen documentation
777 # Each target should have own Doxyfile.$(target) with build directory build/docs/$(target),
778 # proper source directory (e.g. $(target)) and appropriate other doxygen options.
780 ##############################
782 DOCS_TARGETS := flight ground uavobjects
784 # $(1) = Doxygen target (e.g flight or ground)
785 define DOXYGEN_TEMPLATE
787 .PHONY: docs_$(1)
788 docs_$(1): docs_$(1)_clean
789 @$(ECHO) "Generating $(1) documentation"
790 $(V1) $(MKDIR) -p $(BUILD_DIR)/docs/$(1)
791 $(V1) $(DOXYGEN) $(ROOT_DIR)/make/doxygen/Doxyfile.$(1)
793 .PHONY: docs_$(1)_clean
794 docs_$(1)_clean:
795 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs/$(1))"
796 $(V1) [ ! -d "$(BUILD_DIR)/docs/$(1)" ] || $(RM) -r "$(BUILD_DIR)/docs/$(1)"
798 endef
800 $(foreach docs_targ, $(DOCS_TARGETS), $(eval $(call DOXYGEN_TEMPLATE,$(docs_targ))))
802 .PHONY: docs_all
803 docs_all: $(addprefix docs_,$(DOCS_TARGETS))
805 .PHONY: docs_all_clean
806 docs_all_clean:
807 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs)"
808 $(V1) [ ! -d "$(BUILD_DIR)/docs" ] || $(RM) -rf "$(BUILD_DIR)/docs"
810 ##############################
812 # Build info
814 ##############################
816 .PHONY: build-info
817 build-info: | $(BUILD_DIR)
818 @$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
819 $(V1) $(VERSION_INFO) \
820 --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
821 --template="make/templates/$@.txt" \
822 --outfile="$(BUILD_DIR)/$@.txt"
824 ##############################
826 # Source for distribution
828 ##############################
830 DIST_VER_INFO := $(DIST_DIR)/version-info.json
832 $(DIST_VER_INFO): .git/index | $(DIST_DIR)
833 $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
836 $(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR)
837 @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)"
838 $(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD
839 $(V1) tar --append --file="$(DIST_NAME)" \
840 --transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
841 $(call toprel, "$(DIST_VER_INFO)")
842 $(V1) gzip -f "$(DIST_NAME)"
844 .PHONY: dist
845 dist: $(DIST_NAME).gz
848 ##############################
850 # Config
852 ##############################
854 CONFIG_OPTS := $(subst $(SPACE),\n,$(MAKEOVERRIDES))
856 .PHONY: config_new
857 config_new:
858 @printf '$(CONFIG_OPTS)\n' > $(CONFIG_FILE)
860 .PHONY: config_append
861 config_append:
862 @printf '$(CONFIG_OPTS)\n' >> $(CONFIG_FILE)
864 .PHONY: config_show
865 config_show:
866 @cat $(CONFIG_FILE)
868 .PHONY: config_clean
869 config_clean:
870 rm -f $(CONFIG_FILE)
873 ##############################
875 # Directories
877 ##############################
879 $(DIRS):
880 $(V1) $(MKDIR) -p $@
883 ##############################
885 # Help message, the default Makefile goal
887 ##############################
889 .DEFAULT_GOAL := help
891 .PHONY: help
892 help:
893 @$(ECHO)
894 @$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment."
895 @$(ECHO) " It also works on Windows by following the instructions given on this wiki page:"
896 @$(ECHO) " http://wiki.openpilot.org/display/Doc/Windows%3A+Building+and+Packaging"
897 @$(ECHO)
898 @$(ECHO) " Here is a summary of the available targets:"
899 @$(ECHO)
900 @$(ECHO) " [Source tree preparation]"
901 @$(ECHO) " prepare - Install GIT commit message template"
902 @$(ECHO) " [Tool Installers]"
903 @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain"
904 @$(ECHO) " qt_sdk_install - Install the QT development tools"
905 @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
906 @$(ECHO) " sdl_install - Install the SDL library (Windows only)"
907 @$(ECHO) " mesawin_install - Install the OpenGL32 DLL (Windows only)"
908 @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)"
909 @$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
910 @$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
911 @$(ECHO) " gtest_install - Install the GoogleTest framework"
912 @$(ECHO) " These targets are not updated yet and are probably broken:"
913 @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
914 @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
915 @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
916 @$(ECHO) " Install all available tools:"
917 @$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
918 @$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
919 @$(ECHO)
920 @$(ECHO) " Other tool options are:"
921 @$(ECHO) " <tool>_version - Display <tool> version"
922 @$(ECHO) " <tool>_clean - Remove installed <tool>"
923 @$(ECHO) " <tool>_distclean - Remove downloaded <tool> distribution file(s)"
924 @$(ECHO)
925 @$(ECHO) " [Big Hammer]"
926 @$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs"
927 @$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters"
928 @$(ECHO) " all_fw - Build only firmware for all boards"
929 @$(ECHO) " all_bl - Build only bootloaders for all boards"
930 @$(ECHO) " all_bu - Build only bootloader updaters for all boards"
931 @$(ECHO)
932 @$(ECHO) " all_clean - Remove your build directory ($(BUILD_DIR))"
933 @$(ECHO) " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
934 @$(ECHO) " all_fw_clean - Remove firmware for all boards"
935 @$(ECHO) " all_bl_clean - Remove bootloaders for all boards"
936 @$(ECHO) " all_bu_clean - Remove bootloader updaters for all boards"
937 @$(ECHO)
938 @$(ECHO) " all_<board> - Build all available images for <board>"
939 @$(ECHO) " all_<board>_clean - Remove all available images for <board>"
940 @$(ECHO)
941 @$(ECHO) " all_ut - Build all unit tests"
942 @$(ECHO) " all_ut_tap - Run all unit tests and capture all TAP output to files"
943 @$(ECHO) " all_ut_run - Run all unit tests and dump TAP output to console"
944 @$(ECHO)
945 @$(ECHO) " [Firmware]"
946 @$(ECHO) " <board> - Build firmware for <board>"
947 @$(ECHO) " Supported boards are ($(ALL_BOARDS))"
948 @$(ECHO) " fw_<board> - Build firmware for <board>"
949 @$(ECHO) " Supported boards are ($(FW_BOARDS))"
950 @$(ECHO) " fw_<board>_clean - Remove firmware for <board>"
951 @$(ECHO) " fw_<board>_program - Use OpenOCD + JTAG to write firmware to <board>"
952 @$(ECHO)
953 @$(ECHO) " [Bootloader]"
954 @$(ECHO) " bl_<board> - Build bootloader for <board>"
955 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
956 @$(ECHO) " bl_<board>_clean - Remove bootloader for <board>"
957 @$(ECHO) " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
958 @$(ECHO)
959 @$(ECHO) " [Entire Flash]"
960 @$(ECHO) " ef_<board> - Build entire flash image for <board>"
961 @$(ECHO) " Supported boards are ($(EF_BOARDS))"
962 @$(ECHO) " ef_<board>_clean - Remove entire flash image for <board>"
963 @$(ECHO) " ef_<board>_program - Use OpenOCD + JTAG to write entire flash image to <board>"
964 @$(ECHO)
965 @$(ECHO) " [Bootloader Updater]"
966 @$(ECHO) " bu_<board> - Build bootloader updater for <board>"
967 @$(ECHO) " Supported boards are ($(BU_BOARDS))"
968 @$(ECHO) " bu_<board>_clean - Remove bootloader updater for <board>"
969 @$(ECHO)
970 @$(ECHO) " [Unbrick a board]"
971 @$(ECHO) " unbrick_<board> - Use the STM32's built in boot ROM to write a bootloader to <board>"
972 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
973 @$(ECHO) " [Unittests]"
974 @$(ECHO) " ut_<test> - Build unit test <test>"
975 @$(ECHO) " ut_<test>_xml - Run test and capture XML output into a file"
976 @$(ECHO) " ut_<test>_run - Run test and dump output to console"
977 @$(ECHO)
978 @$(ECHO) " [Simulation]"
979 @$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
980 @$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
981 @$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
982 @$(ECHO) " using mingw and msys"
983 @$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
984 @$(ECHO)
985 @$(ECHO) " [GCS]"
986 @$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)"
987 @$(ECHO) " Compile specific directory: MAKE_DIR=<dir>"
988 @$(ECHO) " Example: make gcs MAKE_DIR=src/plugins/coreplugin"
989 @$(ECHO) " gcs_qmake - Run qmake for the Ground Control System (GCS) application (debug|release)"
990 @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)"
991 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
992 @$(ECHO)
993 @$(ECHO) " [Uploader Tool]"
994 @$(ECHO) " uploader - Build the serial uploader tool (debug|release)"
995 @$(ECHO) " uploader_qmake - Run qmake for the serial uploader tool (debug|release)"
996 @$(ECHO) " uploader_clean - Remove the serial uploader tool (debug|release)"
997 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
998 @$(ECHO)
999 @$(ECHO)
1000 @$(ECHO) " [UAVObjects]"
1001 @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files"
1002 @$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..."
1003 @$(ECHO) " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
1004 @$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
1005 @$(ECHO)
1006 @$(ECHO) " [Packaging]"
1007 @$(ECHO) " package - Build and package the OpenPilot platform-dependent package (no clean)"
1008 @$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
1009 @$(ECHO) " dist - Generate source archive for distribution"
1010 @$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)"
1011 @$(ECHO)
1012 @$(ECHO) " [Code Formatting]"
1013 @$(ECHO) " uncrustify_<source> - Reformat <source> code according to the project's standards"
1014 @$(ECHO) " Supported sources are ($(UNCRUSTIFY_TARGETS))"
1015 @$(ECHO) " uncrustify_all - Reformat all source code"
1016 @$(ECHO)
1017 @$(ECHO) " [Code Documentation]"
1018 @$(ECHO) " docs_<source> - Generate HTML documentation for <source>"
1019 @$(ECHO) " Supported sources are ($(DOCS_TARGETS))"
1020 @$(ECHO) " docs_all - Generate HTML documentation for all"
1021 @$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
1022 @$(ECHO) " docs_all_clean - Delete all generated documentation"
1023 @$(ECHO)
1024 @$(ECHO) " [Configuration]"
1025 @$(ECHO) " config_new - Place your make arguments in the config file"
1026 @$(ECHO) " config_append - Place your make arguments in the config file but append"
1027 @$(ECHO) " config_clean - Removes the config file"
1028 @$(ECHO)
1029 @$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
1030 @$(ECHO)
1031 @$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
1032 @$(ECHO) " All tools will be installed into $(TOOLS_DIR)"
1033 @$(ECHO) " All build output will be placed in $(BUILD_DIR)"
1034 @$(ECHO)
1035 @$(ECHO) " Tool download and install directories can be changed using environment variables:"
1036 @$(ECHO) " OPENPILOT_DL_DIR full path to downloads directory [downloads if not set]"
1037 @$(ECHO) " OPENPILOT_TOOLS_DIR full path to installed tools directory [tools if not set]"
1038 @$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
1039 @$(ECHO)