Merged in paul_jewell/librepilot/LP-94-set-up-wiki-link-in-gcs (pull request #38)
[librepilot.git] / Makefile
blob2c0823bc9dabd08a7b989f0d812d44eca087e315
2 # Top level Makefile for the LibrePilot Project build system.
3 # Copyright (c) 2015, The LibrePilot Project, http://www.librepilot.org
4 # Copyright (c) 2010-2013, The OpenPilot Team, http://www.openpilot.org
5 # Use 'make help' for instructions.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 # for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # This top level Makefile passes down some variables to sub-makes through
23 # the environment. They are explicitly exported using the export keyword.
24 # Lower level makefiles assume that these variables are defined. To ensure
25 # that a special magic variable is exported here. It must be checked for
26 # existance by each sub-make.
27 export TOP_LEVEL_MAKEFILE := TRUE
29 # The root directory that this makefile resides in
30 export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
32 # Include some helper functions
33 include $(ROOT_DIR)/make/functions.mk
35 # This file can be used to override default options using the "override" keyword
36 CONFIG_FILE := config
37 -include $(CONFIG_FILE)
39 ##############################
40 # It is possible to set DL_DIR and/or TOOLS_DIR environment
41 # variables to override local tools download and installation directorys. So the
42 # same toolchains can be used for all working copies. Particularly useful for CI
43 # server build agents, but also for local installations.
44 override DL_DIR := $(if $(DL_DIR),$(call slashfix,$(DL_DIR)),$(ROOT_DIR)/downloads)
45 override TOOLS_DIR := $(if $(TOOLS_DIR),$(call slashfix,$(TOOLS_DIR)),$(ROOT_DIR)/tools)
46 export DL_DIR
47 export TOOLS_DIR
49 # Set up some macros for common directories within the tree
50 export BUILD_DIR := $(CURDIR)/build
51 export PACKAGE_DIR := $(BUILD_DIR)/package
52 export DIST_DIR := $(BUILD_DIR)/dist
54 DIRS := $(DL_DIR) $(TOOLS_DIR) $(BUILD_DIR) $(PACKAGE_DIR) $(DIST_DIR)
56 # Naming for binaries and packaging etc,.
57 export ORG_BIG_NAME := LibrePilot
58 GCS_BIG_NAME := ${ORG_BIG_NAME} GCS
59 # These should be lowercase with no spaces
60 export ORG_SMALL_NAME := $(call smallify,$(ORG_BIG_NAME))
61 GCS_SMALL_NAME := $(call smallify,$(GCS_BIG_NAME))
62 # Change this once the DNS is set to http://wiki.librepilot.org/
63 WIKI_URL_ROOT := https://librepilot.atlassian.net/wiki/display/LPDOC/
65 # Set up default build configurations (debug | release)
66 GCS_BUILD_CONF := release
67 GOOGLE_API_VERSION := 14
69 # Clean out undesirable variables from the environment and command-line
70 # to remove the chance that they will cause problems with our build
71 define SANITIZE_VAR
72 $(if $(filter-out undefined,$(origin $(1))),
73 $(info $(EMPTY) NOTE Sanitized $(2) variable '$(1)' from $(origin $(1)))
74 MAKEOVERRIDES = $(filter-out $(1)=%,$(MAKEOVERRIDES))
75 override $(1) :=
76 unexport $(1)
78 endef
80 # These specific variables can influence compilation in unexpected (and undesirable) ways
81 # gcc flags
82 SANITIZE_GCC_VARS := TMPDIR GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH
83 # preprocessor flags
84 SANITIZE_GCC_VARS += CPATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH OBJC_INCLUDE_PATH DEPENDENCIES_OUTPUT
85 # make flags
86 SANITIZE_GCC_VARS += CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LDLIBS
87 $(foreach var, $(SANITIZE_GCC_VARS), $(eval $(call SANITIZE_VAR,$(var),disallowed)))
89 # These specific variables used to be valid but now they make no sense
90 SANITIZE_DEPRECATED_VARS := USE_BOOTLOADER CLEAN_BUILD
91 $(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),deprecated)))
93 # Make sure this isn't being run as root unless installing (no whoami on Windows, but that is ok here)
94 ifeq ($(shell whoami 2>/dev/null),root)
95 ifeq ($(filter install,$(MAKECMDGOALS)),)
96 ifndef FAKEROOTKEY
97 $(error You should not be running this as root)
98 endif
99 endif
100 endif
102 # Decide on a verbosity level based on the V= parameter
103 export AT := @
104 ifndef V
105 export V0 :=
106 export V1 := $(AT)
107 else ifeq ($(V), 0)
108 export V0 := $(AT)
109 export V1 := $(AT)
110 else ifeq ($(V), 1)
111 endif
113 # Make sure we know few things about the architecture before including
114 # the tools.mk to ensure that we download/install the right tools.
115 UNAME := $(shell uname)
116 ARCH := $(shell uname -m)
117 # Here and everywhere if not Linux or Mac then assume Windows
118 ifeq ($(filter Linux Darwin, $(UNAME)), )
119 UNAME := Windows
120 endif
122 # Include tools installers
123 include $(ROOT_DIR)/make/tools.mk
125 # Include third party builders if available
126 -include $(ROOT_DIR)/make/3rdparty/3rdparty.mk
128 # We almost need to consider autoconf/automake instead of this
129 ifeq ($(UNAME), Linux)
130 QT_SPEC := linux-g++
131 UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
132 else ifeq ($(UNAME), Darwin)
133 QT_SPEC := macx-g++
134 UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator
135 else ifeq ($(UNAME), Windows)
136 QT_SPEC := win32-g++
137 UAVOBJGENERATOR := $(BUILD_DIR)/uavobjgenerator/uavobjgenerator.exe
138 endif
141 # All targets
143 ##############################
145 .PHONY: all
146 all: uavobjects all_ground all_flight
148 .PHONY: all_clean
149 all_clean:
150 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR))"
151 $(V1) [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)"
153 .PHONY: clean
154 clean: all_clean
157 ##############################
159 # UAVObjects
161 ##############################
163 UAVOBJGENERATOR_DIR := $(BUILD_DIR)/uavobjgenerator
164 DIRS += $(UAVOBJGENERATOR_DIR)
166 .PHONY: uavobjgenerator
167 uavobjgenerator $(UAVOBJGENERATOR): | $(UAVOBJGENERATOR_DIR)
168 $(V1) cd $(UAVOBJGENERATOR_DIR) && \
169 ( [ -f Makefile ] || $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro \
170 -spec $(QT_SPEC) CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) ) && \
171 $(MAKE) --no-print-directory -w
173 UAVOBJ_TARGETS := gcs flight python matlab java wireshark
175 .PHONY: uavobjects
176 uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
178 UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
179 UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
181 uavobjects_%: uavobjgenerator
182 @$(MKDIR) -p $(UAVOBJ_OUT_DIR)/$*
183 $(V1) ( cd $(UAVOBJ_OUT_DIR)/$* && \
184 $(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
187 uavobjects_test: uavobjgenerator
188 $(V1) $(UAVOBJGENERATOR) -v $(UAVOBJ_XML_DIR) $(ROOT_DIR)
190 uavobjects_clean:
191 @$(ECHO) " CLEAN $(call toprel, $(UAVOBJ_OUT_DIR))"
192 $(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)"
194 ##############################
196 # Flight related components
198 ##############################
200 # Define some pointers to the various important pieces of the flight code
201 # to prevent these being repeated in every sub makefile
202 export PIOS := $(ROOT_DIR)/flight/pios
203 export FLIGHTLIB := $(ROOT_DIR)/flight/libraries
204 export OPMODULEDIR := $(ROOT_DIR)/flight/modules
205 export OPUAVOBJ := $(ROOT_DIR)/flight/uavobjects
206 export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
207 export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
208 export OPGCSSYNTHDIR := $(BUILD_DIR)/gcs-synthetics
210 DIRS += $(OPGCSSYNTHDIR)
212 # Define supported board lists
213 ALL_BOARDS := coptercontrol oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum revonano
215 # Short names of each board (used to display board name in parallel builds)
216 coptercontrol_short := 'cc '
217 oplinkmini_short := 'oplm'
218 revolution_short := 'revo'
219 osd_short := 'osd '
220 revoproto_short := 'revp'
221 revonano_short := 'revn'
222 simposix_short := 'posx'
223 discoveryf4bare_short := 'df4b'
224 gpsplatinum_short := 'gps9'
226 # SimPosix only builds on Linux so drop it from the list for
227 # all other platforms.
228 ifneq ($(UNAME), Linux)
229 ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
230 endif
232 # Start out assuming that we'll build fw, bl and bu for all boards
233 FW_BOARDS := $(ALL_BOARDS)
234 BL_BOARDS := $(ALL_BOARDS)
235 BU_BOARDS := $(ALL_BOARDS)
236 EF_BOARDS := $(ALL_BOARDS)
238 # SimPosix doesn't have a BL, BU or EF target so we need to
239 # filter them out to prevent errors on the all_flight target.
240 BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
241 BU_BOARDS := $(filter-out simposix gpsplatinum, $(BU_BOARDS))
242 EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
244 # Generate the targets for whatever boards are left in each list
245 FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
246 BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
247 BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
248 EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
250 # When building any of the "all_*" targets, tell all sub makefiles to display
251 # additional details on each line of output to describe which build and target
252 # that each line applies to. The same applies also to all, opfw_resource,
253 # package targets
254 ifneq ($(strip $(filter all_% all opfw_resource package,$(MAKECMDGOALS))),)
255 export ENABLE_MSG_EXTRA := yes
256 endif
258 # When building more than one goal in a single make invocation, also
259 # enable the extra context for each output line
260 ifneq ($(word 2,$(MAKECMDGOALS)),)
261 export ENABLE_MSG_EXTRA := yes
262 endif
264 # TEMPLATES (used to generate build rules)
266 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
267 # $(2) = Short name for board (e.g cc)
268 define FW_TEMPLATE
269 .PHONY: $(1) fw_$(1)
270 $(1): fw_$(1)_opfw
271 fw_$(1): fw_$(1)_opfw
273 fw_$(1)_%: uavobjects_flight
274 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
275 $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
276 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
277 $$(MAKE) -r --no-print-directory \
278 BUILD_TYPE=fw \
279 BOARD_NAME=$(1) \
280 BOARD_SHORT_NAME=$(2) \
281 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
282 OUTDIR=$(BUILD_DIR)/fw_$(1) \
283 TARGET=fw_$(1) \
286 .PHONY: $(1)_clean
287 $(1)_clean: fw_$(1)_clean
288 fw_$(1)_clean:
289 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/fw_$(1))"
290 $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
291 endef
293 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
294 # $(2) = Short name for board (e.g cc)
295 define BL_TEMPLATE
296 .PHONY: bl_$(1)
297 bl_$(1): bl_$(1)_bin
298 bl_$(1)_bino: bl_$(1)_bin
300 bl_$(1)_%:
301 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
302 $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
303 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
304 $$(MAKE) -r --no-print-directory \
305 BUILD_TYPE=bl \
306 BOARD_NAME=$(1) \
307 BOARD_SHORT_NAME=$(2) \
308 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
309 OUTDIR=$(BUILD_DIR)/bl_$(1) \
310 TARGET=bl_$(1) \
313 .PHONY: unbrick_$(1)
314 unbrick_$(1): bl_$(1)_hex
315 $(if $(filter-out undefined,$(origin UNBRICK_TTY)),
316 $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)"
317 $(V1) $(STM32FLASH_DIR)/stm32flash \
318 -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \
319 -g 0x0 \
320 $$(UNBRICK_TTY)
322 $(V0) @$(ECHO)
323 $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
324 $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
327 .PHONY: bl_$(1)_clean
328 bl_$(1)_clean:
329 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bl_$(1))"
330 $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
331 endef
333 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
334 # $(2) = Short name for board (e.g cc)
335 define BU_TEMPLATE
336 .PHONY: bu_$(1)
337 bu_$(1): bu_$(1)_opfw
339 bu_$(1)_%: bl_$(1)_bino
340 $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
341 $(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
342 $$(MAKE) -r --no-print-directory \
343 BUILD_TYPE=bu \
344 BOARD_NAME=$(1) \
345 BOARD_SHORT_NAME=$(2) \
346 TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
347 OUTDIR=$(BUILD_DIR)/bu_$(1) \
348 TARGET=bu_$(1) \
351 .PHONY: bu_$(1)_clean
352 bu_$(1)_clean:
353 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bu_$(1))"
354 $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
355 endef
357 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
358 # $(2) = Short name for board (e.g cc)
359 define EF_TEMPLATE
360 .PHONY: ef_$(1)
361 ef_$(1): ef_$(1)_bin
363 ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
364 $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
365 $(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
366 $$(MAKE) -r --no-print-directory \
367 BUILD_TYPE=ef \
368 BOARD_NAME=$(1) \
369 BOARD_SHORT_NAME=$(2) \
370 DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
371 TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
372 OUTDIR=$(BUILD_DIR)/ef_$(1) \
373 TARGET=ef_$(1) \
376 .PHONY: ef_$(1)_clean
377 ef_$(1)_clean:
378 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/ef_$(1))"
379 $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
380 endef
382 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
383 define BOARD_PHONY_TEMPLATE
384 .PHONY: all_$(1)
385 all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
386 all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
387 all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
388 all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
390 .PHONY: all_$(1)_clean
391 all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
392 all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
393 all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
394 all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
395 endef
397 # Generate flight build rules
398 .PHONY: all_fw all_fw_clean
399 all_fw: $(addsuffix _opfw, $(FW_TARGETS))
400 all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
402 .PHONY: all_bl all_bl_clean
403 all_bl: $(addsuffix _bin, $(BL_TARGETS))
404 all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
406 .PHONY: all_bu all_bu_clean
407 all_bu: $(addsuffix _opfw, $(BU_TARGETS))
408 all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
410 .PHONY: all_ef all_ef_clean
411 all_ef: $(EF_TARGETS)
412 all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
414 .PHONY: all_flight all_flight_clean
415 all_flight: all_fw all_bl all_bu all_ef
416 all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
418 # Expand the groups of targets for each board
419 $(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
421 # Expand the firmware rules
422 $(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_short))))
424 # Expand the bootloader rules
425 $(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_short))))
427 # Expand the bootloader updater rules
428 $(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_short))))
430 # Expand the entire-flash rules
431 $(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_short))))
433 .PHONY: sim_win32
434 sim_win32: sim_win32_exe
436 sim_win32_%: uavobjects_flight
437 $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32
438 $(V1) $(MAKE) --no-print-directory \
439 -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $*
441 .PHONY: sim_osx
442 sim_osx: sim_osx_elf
444 sim_osx_%: uavobjects_flight
445 $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx
446 $(V1) $(MAKE) --no-print-directory \
447 -C $(ROOT_DIR)/flight/targets/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
449 ##############################
451 # GCS related components
453 ##############################
455 .PHONY: all_ground
456 all_ground: gcs uploader
458 ifeq ($(V), 1)
459 GCS_SILENT :=
460 else
461 GCS_SILENT := silent
462 endif
464 GCS_DIR := $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)
465 DIRS += $(GCS_DIR)
467 GCS_MAKEFILE := $(GCS_DIR)/Makefile
469 .PHONY: gcs_qmake
470 gcs_qmake $(GCS_MAKEFILE): | $(GCS_DIR)
471 $(V1) cd $(GCS_DIR) && \
472 $(QMAKE) $(ROOT_DIR)/ground/gcs/gcs.pro \
473 -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) \
474 'GCS_BIG_NAME="$(GCS_BIG_NAME)"' GCS_SMALL_NAME=$(GCS_SMALL_NAME) \
475 'ORG_BIG_NAME="$(ORG_BIG_NAME)"' ORG_SMALL_NAME=$(ORG_SMALL_NAME) \
476 'WIKI_URL_ROOT="$(WIKI_URL_ROOT)"' \
477 'GCS_LIBRARY_BASENAME=$(libbasename)' \
478 $(GCS_QMAKE_OPTS)
480 .PHONY: gcs
481 gcs: uavobjgenerator $(GCS_MAKEFILE)
482 $(V1) $(MAKE) -w -C $(GCS_DIR)/$(MAKE_DIR);
484 .PHONY: gcs_clean
485 gcs_clean:
486 @$(ECHO) " CLEAN $(call toprel, $(GCS_DIR))"
487 $(V1) [ ! -d "$(GCS_DIR)" ] || $(RM) -r "$(GCS_DIR)"
491 ################################
493 # Serial Uploader tool
495 ################################
497 UPLOADER_DIR := $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
498 DIRS += $(UPLOADER_DIR)
500 UPLOADER_MAKEFILE := $(UPLOADER_DIR)/Makefile
502 .PHONY: uploader_qmake
503 uploader_qmake $(UPLOADER_MAKEFILE): | $(UPLOADER_DIR)
504 $(V1) cd $(UPLOADER_DIR) && \
505 $(QMAKE) $(ROOT_DIR)/ground/gcs/src/experimental/USB_UPLOAD_TOOL/upload.pro \
506 -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) $(GCS_QMAKE_OPTS)
508 .PHONY: uploader
509 uploader: $(UPLOADER_MAKEFILE)
510 $(V1) $(MAKE) -w -C $(UPLOADER_DIR)
512 .PHONY: uploader_clean
513 uploader_clean:
514 @$(ECHO) " CLEAN $(call toprel, $(UPLOADER_DIR))"
515 $(V1) [ ! -d "$(UPLOADER_DIR)" ] || $(RM) -r "$(UPLOADER_DIR)"
518 # We want to take snapshots of the UAVOs at each point that they change
519 # to allow the GCS to be compatible with as many versions as possible.
520 # We always include a pseudo collection called "srctree" which represents
521 # the UAVOs in the source tree. So not necessary to add current tree UAVO
522 # hash here, it is always included.
524 # Find the git hashes of each commit that changes uavobjects with:
525 # git log --format=%h -- shared/uavobjectdefinition/ | head -n 2
526 # List only UAVO hashes of past releases, do not list current hash.
527 # Past compatible versions are so far: RELEASE-12.10.2
528 UAVO_GIT_VERSIONS := 5e14f53
530 # All versions includes also the current source tree UAVO hash
531 UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree
533 # This is where the UAVO collections are stored
534 UAVO_COLLECTION_DIR := $(BUILD_DIR)/uavo-collections
536 # $(1) git hash of a UAVO snapshot
537 define UAVO_COLLECTION_GIT_TEMPLATE
539 # Make the output directory that will contain all of the synthetics for the
540 # uavo collection referenced by the git hash $(1)
541 $$(UAVO_COLLECTION_DIR)/$(1):
542 $$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1)
544 # Extract the snapshot of shared/uavobjectdefinition from git hash $(1)
545 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1)
546 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar:
547 $$(V0) @$(ECHO) " UAVOTAR $(1)"
548 $$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/
550 # Extract the uavo xml files from our snapshot
551 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar
552 $$(V0) @$(ECHO) " UAVOUNTAR $(1)"
553 $$(V1) $(RM) -rf $$@
554 $$(V1) $(MKDIR) -p $$@
555 $$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@
556 endef
558 # Map the current working directory into the set of UAVO collections
559 $(UAVO_COLLECTION_DIR)/srctree:
560 $(V1) $(MKDIR) -p $@
562 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree
563 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR)
564 $(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml
566 # $(1) git hash (or symbolic name) of a UAVO snapshot
567 define UAVO_COLLECTION_BUILD_TEMPLATE
569 # This leaves us with a (broken) symlink that points to the full sha1sum of the collection
570 $$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
571 # Compute the sha1 hash for this UAVO collection
572 # The sed bit truncates the UAVO hash to 16 hex digits
573 $$(V1) $$(VERSION_INFO) \
574 --uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
575 --format='$$$${UAVO_HASH}' | \
576 $(SED) -e 's|\(................\).*|\1|' > $$@
578 $$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
580 # Generate the java uavobjects for this UAVO collection
581 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash
582 $$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
583 $$(V1) $(MKDIR) -p $$@
584 $$(V1) ( \
585 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
586 $$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \
589 # Build a jar file for this UAVO collection
590 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos
591 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java
592 $$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
593 $$(V1) ( \
594 HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \
595 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
596 $(JAVAC) java/*.java \
597 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \
598 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \
599 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \
600 -d . && \
601 find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \
602 $(JAR) cf tmp_uavobjects.jar @classlist.txt && \
603 $$(ANDROID_DX) \
604 --dex \
605 --output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \
606 tmp_uavobjects.jar && \
607 $(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \
610 endef
612 # One of these for each element of UAVO_GIT_VERSIONS so we can extract the UAVOs from git
613 $(foreach githash, $(UAVO_GIT_VERSIONS), $(eval $(call UAVO_COLLECTION_GIT_TEMPLATE,$(githash))))
615 # One of these for each UAVO_ALL_VERSIONS which includes the ones in the srctree
616 $(foreach githash, $(UAVO_ALL_VERSIONS), $(eval $(call UAVO_COLLECTION_BUILD_TEMPLATE,$(githash))))
618 .PHONY: uavo-collections_java
619 uavo-collections_java: $(foreach githash, $(UAVO_ALL_VERSIONS), $(UAVO_COLLECTION_DIR)/$(githash)/java-build/uavobjects.jar)
621 .PHONY: uavo-collections
622 uavo-collections: uavo-collections_java
624 .PHONY: uavo-collections_clean
625 uavo-collections_clean:
626 @$(ECHO) " CLEAN $(call toprel, $(UAVO_COLLECTION_DIR))"
627 $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR)
629 ##############################
631 # Unit Tests
633 ##############################
635 ALL_UNITTESTS := logfs math lednotification
637 # Build the directory for the unit tests
638 UT_OUT_DIR := $(BUILD_DIR)/unit_tests
639 DIRS += $(UT_OUT_DIR)
641 .PHONY: all_ut
642 all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
644 .PHONY: all_ut_xml
645 all_ut_xml: $(addsuffix _xml, $(addprefix ut_, $(ALL_UNITTESTS)))
647 .PHONY: all_ut_run
648 all_ut_run: $(addsuffix _run, $(addprefix ut_, $(ALL_UNITTESTS)))
650 .PHONY: all_ut_clean
651 all_ut_clean:
652 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR))"
653 $(V1) [ ! -d "$(UT_OUT_DIR)" ] || $(RM) -r "$(UT_OUT_DIR)"
655 # $(1) = Unit test name
656 define UT_TEMPLATE
657 .PHONY: ut_$(1)
658 ut_$(1): ut_$(1)_run
660 ut_$(1)_%: $$(UT_OUT_DIR)
661 $(V1) $(MKDIR) -p $(UT_OUT_DIR)/$(1)
662 $(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
663 $$(MAKE) -r --no-print-directory \
664 BUILD_TYPE=ut \
665 BOARD_SHORT_NAME=$(1) \
666 TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
667 OUTDIR="$(UT_OUT_DIR)/$(1)" \
668 TARGET=$(1) \
671 .PHONY: ut_$(1)_clean
672 ut_$(1)_clean:
673 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR)/$(1))"
674 $(V1) [ ! -d "$(UT_OUT_DIR)/$(1)" ] || $(RM) -r "$(UT_OUT_DIR)/$(1)"
675 endef
677 # Expand the unittest rules
678 $(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut))))
680 # Disable parallel make when the all_ut_run target is requested otherwise the TAP
681 # output is interleaved with the rest of the make output.
682 ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),)
683 .NOTPARALLEL:
684 $(info $(EMPTY) NOTE Parallel make disabled by all_ut_run target so we have sane console output)
685 endif
687 ##############################
689 # Packaging components
691 ##############################
693 # Firmware files to package
694 PACKAGE_FW_EXCLUDE := fw_simposix $(if $(PACKAGE_FW_INCLUDE_DISCOVERYF4BARE),,fw_discoveryf4bare)
695 PACKAGE_FW_TARGETS := $(filter-out $(PACKAGE_FW_EXCLUDE), $(FW_TARGETS))
696 PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS))
698 # Rules to generate GCS resources used to embed firmware binaries into the GCS.
699 # They are used later by the vehicle setup wizard to update board firmware.
700 # To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
701 OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc
702 OPFW_RESOURCE_PREFIX := ../../
703 OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
704 OPFW_CONTENTS := \
705 <!DOCTYPE RCC><RCC version="1.0"> \
706 <qresource prefix="/firmware"> \
707 $(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
708 </qresource> \
709 </RCC>
711 .PHONY: opfw_resource
712 opfw_resource: $(OPFW_RESOURCE)
714 $(OPFW_RESOURCE): $(FW_TARGETS) | $(OPGCSSYNTHDIR)
715 @$(ECHO) Generating OPFW resource file $(call toprel, $@)
716 $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
718 # If opfw_resource or all firmware are requested, GCS should depend on the resource
719 ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),)
720 $(GCS_MAKEFILE): $(OPFW_RESOURCE)
721 endif
723 # Packaging targets: package
724 # - builds all firmware, opfw_resource, gcs
725 # - copies firmware into a package directory
726 # - calls paltform-specific packaging script
728 # Define some variables
729 PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL})
730 PACKAGE_NAME := $(subst $(SPACE),,$(ORG_BIG_NAME))
731 PACKAGE_SEP := -
732 PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)
734 # Source distribution is never dirty because it uses git archive
735 DIST_LBL := $(subst -dirty,,$(PACKAGE_LBL))
736 DIST_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(DIST_LBL)
737 DIST_TAR := $(DIST_DIR)/$(DIST_NAME).tar
738 DIST_TAR_GZ := $(DIST_TAR).gz
739 DIST_VER_INFO := $(DIST_DIR)/version-info.json
741 include $(ROOT_DIR)/package/$(UNAME).mk
743 ##############################
745 # Source for distribution
747 ##############################
748 $(DIST_VER_INFO): .git/index | $(DIST_DIR)
749 $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
751 $(DIST_TAR): $(DIST_VER_INFO) .git/index | $(DIST_DIR)
752 @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR))"
753 $(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_TAR)" HEAD
754 $(V1) tar --append --file="$(DIST_TAR)" \
755 --transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
756 $(call toprel, "$(DIST_VER_INFO)")
758 $(DIST_TAR_GZ): $(DIST_TAR)
759 @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_TAR_GZ))"
760 $(V1) gzip -kf "$(DIST_TAR)"
762 .PHONY: dist_tar_gz
763 dist_tar_gz: $(DIST_TAR_GZ)
765 .PHONY: dist
766 dist: dist_tar_gz
769 ##############################
771 # Source code formatting
773 ##############################
775 UNCRUSTIFY_TARGETS := flight ground
777 # $(1) = Uncrustify target (e.g flight or ground)
778 # $(2) = Target root directory
779 define UNCRUSTIFY_TEMPLATE
781 .PHONY: uncrustify_$(1)
782 uncrustify_$(1):
783 @$(ECHO) "Auto-formatting $(1) source code"
784 $(V1) UNCRUSTIFY_CONFIG="$(ROOT_DIR)/make/uncrustify/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
785 endef
787 $(foreach uncrustify_targ, $(UNCRUSTIFY_TARGETS), $(eval $(call UNCRUSTIFY_TEMPLATE,$(uncrustify_targ),$(ROOT_DIR)/$(uncrustify_targ))))
789 .PHONY: uncrustify_all
790 uncrustify_all: $(addprefix uncrustify_,$(UNCRUSTIFY_TARGETS))
792 ##############################
794 # Doxygen documentation
796 # Each target should have own Doxyfile.$(target) with build directory build/docs/$(target),
797 # proper source directory (e.g. $(target)) and appropriate other doxygen options.
799 ##############################
801 DOCS_TARGETS := flight ground uavobjects
803 # $(1) = Doxygen target (e.g flight or ground)
804 define DOXYGEN_TEMPLATE
806 .PHONY: docs_$(1)
807 docs_$(1): docs_$(1)_clean
808 @$(ECHO) "Generating $(1) documentation"
809 $(V1) $(MKDIR) -p $(BUILD_DIR)/docs/$(1)
810 $(V1) $(DOXYGEN) $(ROOT_DIR)/make/doxygen/Doxyfile.$(1)
812 .PHONY: docs_$(1)_clean
813 docs_$(1)_clean:
814 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs/$(1))"
815 $(V1) [ ! -d "$(BUILD_DIR)/docs/$(1)" ] || $(RM) -r "$(BUILD_DIR)/docs/$(1)"
817 endef
819 $(foreach docs_targ, $(DOCS_TARGETS), $(eval $(call DOXYGEN_TEMPLATE,$(docs_targ))))
821 .PHONY: docs_all
822 docs_all: $(addprefix docs_,$(DOCS_TARGETS))
824 .PHONY: docs_all_clean
825 docs_all_clean:
826 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs)"
827 $(V1) [ ! -d "$(BUILD_DIR)/docs" ] || $(RM) -rf "$(BUILD_DIR)/docs"
829 ##############################
831 # Build info
833 ##############################
835 .PHONY: build-info
836 build-info: | $(BUILD_DIR)
837 @$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
838 $(V1) $(VERSION_INFO) \
839 --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
840 --template="make/templates/$@.txt" \
841 --outfile="$(BUILD_DIR)/$@.txt"
843 ##############################
845 # Config
847 ##############################
849 CONFIG_OPTS := $(addsuffix \n,$(MAKEOVERRIDES))
850 CONFIG_OPTS := $(addprefix override$(SPACE),$(CONFIG_OPTS))
852 .PHONY: config_new
853 config_new:
854 @printf '$(CONFIG_OPTS)' > $(CONFIG_FILE)
856 .PHONY: config_append
857 config_append:
858 @printf '$(CONFIG_OPTS)' >> $(CONFIG_FILE)
860 .PHONY: config_show
861 config_show:
862 @cat $(CONFIG_FILE)
864 .PHONY: config_clean
865 config_clean:
866 rm -f $(CONFIG_FILE)
869 ##############################
871 # Directories
873 ##############################
875 $(DIRS):
876 $(V1) $(MKDIR) -p $@
879 ##############################
881 # Help message, the default Makefile goal
883 ##############################
885 .DEFAULT_GOAL := help
887 .PHONY: help
888 help:
889 @$(ECHO)
890 @$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment."
891 @$(ECHO) " It also works on Windows by following the instructions given on this wiki page:"
892 @$(ECHO) " http://wiki.openpilot.org/display/Doc/Windows%3A+Building+and+Packaging"
893 @$(ECHO)
894 @$(ECHO) " Here is a summary of the available targets:"
895 @$(ECHO)
896 @$(ECHO) " [Source tree preparation]"
897 @$(ECHO) " prepare - Install GIT commit message template"
898 @$(ECHO) " [Tool Installers]"
899 @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain"
900 @$(ECHO) " qt_sdk_install - Install the QT development tools"
901 @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
902 @$(ECHO) " sdl_install - Install the SDL library (Windows only)"
903 @$(ECHO) " mesawin_install - Install the OpenGL32 DLL (Windows only)"
904 @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)"
905 @$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
906 @$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
907 @$(ECHO) " gtest_install - Install the GoogleTest framework"
908 @$(ECHO) " ccache_install - Install ccache"
909 @$(ECHO) " These targets are not updated yet and are probably broken:"
910 @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
911 @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
912 @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
913 @$(ECHO) " Install all available tools:"
914 @$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
915 @$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
916 @$(ECHO)
917 @$(ECHO) " Other tool options are:"
918 @$(ECHO) " <tool>_version - Display <tool> version"
919 @$(ECHO) " <tool>_clean - Remove installed <tool>"
920 @$(ECHO) " <tool>_distclean - Remove downloaded <tool> distribution file(s)"
921 @$(ECHO)
922 @$(ECHO) " [Big Hammer]"
923 @$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs"
924 @$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters"
925 @$(ECHO) " all_fw - Build only firmware for all boards"
926 @$(ECHO) " all_bl - Build only bootloaders for all boards"
927 @$(ECHO) " all_bu - Build only bootloader updaters for all boards"
928 @$(ECHO)
929 @$(ECHO) " all_clean - Remove your build directory ($(BUILD_DIR))"
930 @$(ECHO) " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
931 @$(ECHO) " all_fw_clean - Remove firmware for all boards"
932 @$(ECHO) " all_bl_clean - Remove bootloaders for all boards"
933 @$(ECHO) " all_bu_clean - Remove bootloader updaters for all boards"
934 @$(ECHO)
935 @$(ECHO) " all_<board> - Build all available images for <board>"
936 @$(ECHO) " all_<board>_clean - Remove all available images for <board>"
937 @$(ECHO)
938 @$(ECHO) " all_ut - Build all unit tests"
939 @$(ECHO) " all_ut_tap - Run all unit tests and capture all TAP output to files"
940 @$(ECHO) " all_ut_run - Run all unit tests and dump TAP output to console"
941 @$(ECHO)
942 @$(ECHO) " [Firmware]"
943 @$(ECHO) " <board> - Build firmware for <board>"
944 @$(ECHO) " Supported boards are ($(ALL_BOARDS))"
945 @$(ECHO) " fw_<board> - Build firmware for <board>"
946 @$(ECHO) " Supported boards are ($(FW_BOARDS))"
947 @$(ECHO) " fw_<board>_clean - Remove firmware for <board>"
948 @$(ECHO) " fw_<board>_program - Use OpenOCD + JTAG to write firmware to <board>"
949 @$(ECHO)
950 @$(ECHO) " [Bootloader]"
951 @$(ECHO) " bl_<board> - Build bootloader for <board>"
952 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
953 @$(ECHO) " bl_<board>_clean - Remove bootloader for <board>"
954 @$(ECHO) " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
955 @$(ECHO)
956 @$(ECHO) " [Entire Flash]"
957 @$(ECHO) " ef_<board> - Build entire flash image for <board>"
958 @$(ECHO) " Supported boards are ($(EF_BOARDS))"
959 @$(ECHO) " ef_<board>_clean - Remove entire flash image for <board>"
960 @$(ECHO) " ef_<board>_program - Use OpenOCD + JTAG to write entire flash image to <board>"
961 @$(ECHO)
962 @$(ECHO) " [Bootloader Updater]"
963 @$(ECHO) " bu_<board> - Build bootloader updater for <board>"
964 @$(ECHO) " Supported boards are ($(BU_BOARDS))"
965 @$(ECHO) " bu_<board>_clean - Remove bootloader updater for <board>"
966 @$(ECHO)
967 @$(ECHO) " [Unbrick a board]"
968 @$(ECHO) " unbrick_<board> - Use the STM32's built in boot ROM to write a bootloader to <board>"
969 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
970 @$(ECHO) " [Unittests]"
971 @$(ECHO) " ut_<test> - Build unit test <test>"
972 @$(ECHO) " ut_<test>_xml - Run test and capture XML output into a file"
973 @$(ECHO) " ut_<test>_run - Run test and dump output to console"
974 @$(ECHO)
975 @$(ECHO) " [Simulation]"
976 @$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
977 @$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
978 @$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
979 @$(ECHO) " using mingw and msys"
980 @$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
981 @$(ECHO)
982 @$(ECHO) " [GCS]"
983 @$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)"
984 @$(ECHO) " Compile specific directory: MAKE_DIR=<dir>"
985 @$(ECHO) " Example: make gcs MAKE_DIR=src/plugins/coreplugin"
986 @$(ECHO) " gcs_qmake - Run qmake for the Ground Control System (GCS) application (debug|release)"
987 @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)"
988 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
989 @$(ECHO)
990 @$(ECHO) " [Uploader Tool]"
991 @$(ECHO) " uploader - Build the serial uploader tool (debug|release)"
992 @$(ECHO) " uploader_qmake - Run qmake for the serial uploader tool (debug|release)"
993 @$(ECHO) " uploader_clean - Remove the serial uploader tool (debug|release)"
994 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
995 @$(ECHO)
996 @$(ECHO)
997 @$(ECHO) " [UAVObjects]"
998 @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files"
999 @$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..."
1000 @$(ECHO) " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
1001 @$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
1002 @$(ECHO)
1003 @$(ECHO) " [Packaging]"
1004 @$(ECHO) " package - Build and package the OpenPilot platform-dependent package (no clean)"
1005 @$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
1006 @$(ECHO) " dist - Generate source archive for distribution"
1007 @$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)"
1008 @$(ECHO)
1009 @$(ECHO) " [Code Formatting]"
1010 @$(ECHO) " uncrustify_<source> - Reformat <source> code according to the project's standards"
1011 @$(ECHO) " Supported sources are ($(UNCRUSTIFY_TARGETS))"
1012 @$(ECHO) " uncrustify_all - Reformat all source code"
1013 @$(ECHO)
1014 @$(ECHO) " [Code Documentation]"
1015 @$(ECHO) " docs_<source> - Generate HTML documentation for <source>"
1016 @$(ECHO) " Supported sources are ($(DOCS_TARGETS))"
1017 @$(ECHO) " docs_all - Generate HTML documentation for all"
1018 @$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
1019 @$(ECHO) " docs_all_clean - Delete all generated documentation"
1020 @$(ECHO)
1021 @$(ECHO) " [Configuration]"
1022 @$(ECHO) " config_new - Place your make arguments in the config file"
1023 @$(ECHO) " config_append - Place your make arguments in the config file but append"
1024 @$(ECHO) " config_clean - Removes the config file"
1025 @$(ECHO)
1026 @$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
1027 @$(ECHO)
1028 @$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
1029 @$(ECHO) " All tools will be installed into $(TOOLS_DIR)"
1030 @$(ECHO) " All build output will be placed in $(BUILD_DIR)"
1031 @$(ECHO)
1032 @$(ECHO) " Tool download and install directories can be changed using environment variables:"
1033 @$(ECHO) " DL_DIR full path to downloads directory [downloads if not set]"
1034 @$(ECHO) " TOOLS_DIR full path to installed tools directory [tools if not set]"
1035 @$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
1036 @$(ECHO)