Merge pull request #9 from parched/2dee2328d_fix
[librepilot.git] / Makefile
blob766ff8d575812c9ee24b1a1786d6ac5aed82c9b2
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 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 OP_BIG_NAME := LibrePilot
63 GCS_BIG_NAME := ${OP_BIG_NAME} GCS
64 # These should be lowercase with no spaces
65 OP_SMALL_NAME := $(call smallify,$(OP_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 ##############################
145 # All targets
147 ##############################
149 .PHONY: all
150 all: uavobjects all_ground all_flight
152 .PHONY: all_clean
153 all_clean:
154 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR))"
155 $(V1) [ ! -d "$(BUILD_DIR)" ] || $(RM) -rf "$(BUILD_DIR)"
157 .PONY: clean
158 clean: all_clean
161 ##############################
163 # UAVObjects
165 ##############################
167 UAVOBJGENERATOR_DIR = $(BUILD_DIR)/uavobjgenerator
168 DIRS += $(UAVOBJGENERATOR_DIR)
170 .PHONY: uavobjgenerator
171 uavobjgenerator $(UAVOBJGENERATOR): | $(UAVOBJGENERATOR_DIR)
172 $(V1) cd $(UAVOBJGENERATOR_DIR) && \
173 ( [ -f Makefile ] || $(QMAKE) $(ROOT_DIR)/ground/uavobjgenerator/uavobjgenerator.pro \
174 -spec $(QT_SPEC) CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) ) && \
175 $(MAKE) --no-print-directory -w
177 UAVOBJ_TARGETS := gcs flight python matlab java wireshark
179 .PHONY: uavobjects
180 uavobjects: $(addprefix uavobjects_, $(UAVOBJ_TARGETS))
182 UAVOBJ_XML_DIR := $(ROOT_DIR)/shared/uavobjectdefinition
183 UAVOBJ_OUT_DIR := $(BUILD_DIR)/uavobject-synthetics
185 uavobjects_%: uavobjgenerator
186 @$(MKDIR) -p $(UAVOBJ_OUT_DIR)/$*
187 $(V1) ( cd $(UAVOBJ_OUT_DIR)/$* && \
188 $(UAVOBJGENERATOR) -$* $(UAVOBJ_XML_DIR) $(ROOT_DIR) ; \
191 uavobjects_test: uavobjgenerator
192 $(V1) $(UAVOBJGENERATOR) -v $(UAVOBJ_XML_DIR) $(ROOT_DIR)
194 uavobjects_clean:
195 @$(ECHO) " CLEAN $(call toprel, $(UAVOBJ_OUT_DIR))"
196 $(V1) [ ! -d "$(UAVOBJ_OUT_DIR)" ] || $(RM) -r "$(UAVOBJ_OUT_DIR)"
198 ##############################
200 # Flight related components
202 ##############################
204 # Define some pointers to the various important pieces of the flight code
205 # to prevent these being repeated in every sub makefile
206 export PIOS := $(ROOT_DIR)/flight/pios
207 export FLIGHTLIB := $(ROOT_DIR)/flight/libraries
208 export OPMODULEDIR := $(ROOT_DIR)/flight/modules
209 export OPUAVOBJ := $(ROOT_DIR)/flight/uavobjects
210 export OPUAVTALK := $(ROOT_DIR)/flight/uavtalk
211 export OPUAVSYNTHDIR := $(BUILD_DIR)/uavobject-synthetics/flight
212 export OPGCSSYNTHDIR := $(BUILD_DIR)/openpilotgcs-synthetics
214 DIRS += $(OPGCSSYNTHDIR)
216 # Define supported board lists
217 ALL_BOARDS := oplinkmini revolution osd revoproto simposix discoveryf4bare gpsplatinum revonano
219 # Short names of each board (used to display board name in parallel builds)
220 oplinkmini_short := 'oplm'
221 revolution_short := 'revo'
222 osd_short := 'osd '
223 revoproto_short := 'revp'
224 revonano_short := 'revn'
225 simposix_short := 'posx'
226 discoveryf4bare_short := 'df4b'
227 gpsplatinum_short := 'gps9'
229 # SimPosix only builds on Linux so drop it from the list for
230 # all other platforms.
231 ifneq ($(UNAME), Linux)
232 ALL_BOARDS := $(filter-out simposix, $(ALL_BOARDS))
233 endif
235 # Start out assuming that we'll build fw, bl and bu for all boards
236 FW_BOARDS := $(ALL_BOARDS)
237 BL_BOARDS := $(ALL_BOARDS)
238 BU_BOARDS := $(ALL_BOARDS)
239 EF_BOARDS := $(ALL_BOARDS)
241 # SimPosix doesn't have a BL, BU or EF target so we need to
242 # filter them out to prevent errors on the all_flight target.
243 BL_BOARDS := $(filter-out simposix, $(BL_BOARDS))
244 BU_BOARDS := $(filter-out simposix gpsplatinum, $(BU_BOARDS))
245 EF_BOARDS := $(filter-out simposix, $(EF_BOARDS))
247 # Generate the targets for whatever boards are left in each list
248 FW_TARGETS := $(addprefix fw_, $(FW_BOARDS))
249 BL_TARGETS := $(addprefix bl_, $(BL_BOARDS))
250 BU_TARGETS := $(addprefix bu_, $(BU_BOARDS))
251 EF_TARGETS := $(addprefix ef_, $(EF_BOARDS))
253 # When building any of the "all_*" targets, tell all sub makefiles to display
254 # additional details on each line of output to describe which build and target
255 # that each line applies to. The same applies also to all, opfw_resource,
256 # package targets
257 ifneq ($(strip $(filter all_% all opfw_resource package,$(MAKECMDGOALS))),)
258 export ENABLE_MSG_EXTRA := yes
259 endif
261 # When building more than one goal in a single make invocation, also
262 # enable the extra context for each output line
263 ifneq ($(word 2,$(MAKECMDGOALS)),)
264 export ENABLE_MSG_EXTRA := yes
265 endif
267 # TEMPLATES (used to generate build rules)
269 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
270 # $(2) = Short name for board (e.g cc)
271 define FW_TEMPLATE
272 .PHONY: $(1) fw_$(1)
273 $(1): fw_$(1)_opfw
274 fw_$(1): fw_$(1)_opfw
276 fw_$(1)_%: uavobjects_flight
277 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
278 $(V1) $(MKDIR) -p $(BUILD_DIR)/fw_$(1)/dep
279 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/firmware && \
280 $$(MAKE) -r --no-print-directory \
281 BUILD_TYPE=fw \
282 BOARD_NAME=$(1) \
283 BOARD_SHORT_NAME=$(2) \
284 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/firmware \
285 OUTDIR=$(BUILD_DIR)/fw_$(1) \
286 TARGET=fw_$(1) \
289 .PHONY: $(1)_clean
290 $(1)_clean: fw_$(1)_clean
291 fw_$(1)_clean:
292 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/fw_$(1))"
293 $(V1) $(RM) -fr $(BUILD_DIR)/fw_$(1)
294 endef
296 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
297 # $(2) = Short name for board (e.g cc)
298 define BL_TEMPLATE
299 .PHONY: bl_$(1)
300 bl_$(1): bl_$(1)_bin
301 bl_$(1)_bino: bl_$(1)_bin
303 bl_$(1)_%:
304 $(V1) $$(ARM_GCC_VERSION_CHECK_TEMPLATE)
305 $(V1) $(MKDIR) -p $(BUILD_DIR)/bl_$(1)/dep
306 $(V1) cd $(ROOT_DIR)/flight/targets/boards/$(1)/bootloader && \
307 $$(MAKE) -r --no-print-directory \
308 BUILD_TYPE=bl \
309 BOARD_NAME=$(1) \
310 BOARD_SHORT_NAME=$(2) \
311 TOPDIR=$(ROOT_DIR)/flight/targets/boards/$(1)/bootloader \
312 OUTDIR=$(BUILD_DIR)/bl_$(1) \
313 TARGET=bl_$(1) \
316 .PHONY: unbrick_$(1)
317 unbrick_$(1): bl_$(1)_hex
318 $(if $(filter-out undefined,$(origin UNBRICK_TTY)),
319 $(V0) @$(ECHO) " UNBRICK $(1) via $$(UNBRICK_TTY)"
320 $(V1) $(STM32FLASH_DIR)/stm32flash \
321 -w $(BUILD_DIR)/bl_$(1)/bl_$(1).hex \
322 -g 0x0 \
323 $$(UNBRICK_TTY)
325 $(V0) @$(ECHO)
326 $(V0) @$(ECHO) "ERROR: You must specify UNBRICK_TTY=<serial-device> to use for unbricking."
327 $(V0) @$(ECHO) " eg. $$(MAKE) $$@ UNBRICK_TTY=/dev/ttyUSB0"
330 .PHONY: bl_$(1)_clean
331 bl_$(1)_clean:
332 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bl_$(1))"
333 $(V1) $(RM) -fr $(BUILD_DIR)/bl_$(1)
334 endef
336 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
337 # $(2) = Short name for board (e.g cc)
338 define BU_TEMPLATE
339 .PHONY: bu_$(1)
340 bu_$(1): bu_$(1)_opfw
342 bu_$(1)_%: bl_$(1)_bino
343 $(V1) $(MKDIR) -p $(BUILD_DIR)/bu_$(1)/dep
344 $(V1) cd $(ROOT_DIR)/flight/targets/common/bootloader_updater && \
345 $$(MAKE) -r --no-print-directory \
346 BUILD_TYPE=bu \
347 BOARD_NAME=$(1) \
348 BOARD_SHORT_NAME=$(2) \
349 TOPDIR=$(ROOT_DIR)/flight/targets/common/bootloader_updater \
350 OUTDIR=$(BUILD_DIR)/bu_$(1) \
351 TARGET=bu_$(1) \
354 .PHONY: bu_$(1)_clean
355 bu_$(1)_clean:
356 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/bu_$(1))"
357 $(V1) $(RM) -fr $(BUILD_DIR)/bu_$(1)
358 endef
360 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
361 # $(2) = Short name for board (e.g cc)
362 define EF_TEMPLATE
363 .PHONY: ef_$(1)
364 ef_$(1): ef_$(1)_bin
366 ef_$(1)_%: bl_$(1)_bin fw_$(1)_opfw
367 $(V1) $(MKDIR) -p $(BUILD_DIR)/ef_$(1)
368 $(V1) cd $(ROOT_DIR)/flight/targets/common/entire_flash && \
369 $$(MAKE) -r --no-print-directory \
370 BUILD_TYPE=ef \
371 BOARD_NAME=$(1) \
372 BOARD_SHORT_NAME=$(2) \
373 DFU_CMD="$(DFUUTIL_DIR)/bin/dfu-util" \
374 TOPDIR=$(ROOT_DIR)/flight/targets/common/entire_flash \
375 OUTDIR=$(BUILD_DIR)/ef_$(1) \
376 TARGET=ef_$(1) \
379 .PHONY: ef_$(1)_clean
380 ef_$(1)_clean:
381 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/ef_$(1))"
382 $(V1) $(RM) -fr $(BUILD_DIR)/ef_$(1)
383 endef
385 # $(1) = Canonical board name all in lower case (e.g. coptercontrol)
386 define BOARD_PHONY_TEMPLATE
387 .PHONY: all_$(1)
388 all_$(1): $$(filter fw_$(1), $$(FW_TARGETS))
389 all_$(1): $$(filter bl_$(1), $$(BL_TARGETS))
390 all_$(1): $$(filter bu_$(1), $$(BU_TARGETS))
391 all_$(1): $$(filter ef_$(1), $$(EF_TARGETS))
393 .PHONY: all_$(1)_clean
394 all_$(1)_clean: $$(addsuffix _clean, $$(filter fw_$(1), $$(FW_TARGETS)))
395 all_$(1)_clean: $$(addsuffix _clean, $$(filter bl_$(1), $$(BL_TARGETS)))
396 all_$(1)_clean: $$(addsuffix _clean, $$(filter bu_$(1), $$(BU_TARGETS)))
397 all_$(1)_clean: $$(addsuffix _clean, $$(filter ef_$(1), $$(EF_TARGETS)))
398 endef
400 # Generate flight build rules
401 .PHONY: all_fw all_fw_clean
402 all_fw: $(addsuffix _opfw, $(FW_TARGETS))
403 all_fw_clean: $(addsuffix _clean, $(FW_TARGETS))
405 .PHONY: all_bl all_bl_clean
406 all_bl: $(addsuffix _bin, $(BL_TARGETS))
407 all_bl_clean: $(addsuffix _clean, $(BL_TARGETS))
409 .PHONY: all_bu all_bu_clean
410 all_bu: $(addsuffix _opfw, $(BU_TARGETS))
411 all_bu_clean: $(addsuffix _clean, $(BU_TARGETS))
413 .PHONY: all_ef all_ef_clean
414 all_ef: $(EF_TARGETS)
415 all_ef_clean: $(addsuffix _clean, $(EF_TARGETS))
417 .PHONY: all_flight all_flight_clean
418 all_flight: all_fw all_bl all_bu all_ef
419 all_flight_clean: all_fw_clean all_bl_clean all_bu_clean all_ef_clean
421 # Expand the groups of targets for each board
422 $(foreach board, $(ALL_BOARDS), $(eval $(call BOARD_PHONY_TEMPLATE,$(board))))
424 # Expand the firmware rules
425 $(foreach board, $(ALL_BOARDS), $(eval $(call FW_TEMPLATE,$(board),$($(board)_short))))
427 # Expand the bootloader rules
428 $(foreach board, $(ALL_BOARDS), $(eval $(call BL_TEMPLATE,$(board),$($(board)_short))))
430 # Expand the bootloader updater rules
431 $(foreach board, $(ALL_BOARDS), $(eval $(call BU_TEMPLATE,$(board),$($(board)_short))))
433 # Expand the entire-flash rules
434 $(foreach board, $(ALL_BOARDS), $(eval $(call EF_TEMPLATE,$(board),$($(board)_short))))
436 .PHONY: sim_win32
437 sim_win32: sim_win32_exe
439 sim_win32_%: uavobjects_flight
440 $(V1) $(MKDIR) -p $(BUILD_DIR)/sitl_win32
441 $(V1) $(MAKE) --no-print-directory \
442 -C $(ROOT_DIR)/flight/targets/OpenPilot --file=$(ROOT_DIR)/flight/targets/OpenPilot/Makefile.win32 $*
444 .PHONY: sim_osx
445 sim_osx: sim_osx_elf
447 sim_osx_%: uavobjects_flight
448 $(V1) $(MKDIR) -p $(BUILD_DIR)/sim_osx
449 $(V1) $(MAKE) --no-print-directory \
450 -C $(ROOT_DIR)/flight/targets/SensorTest --file=$(ROOT_DIR)/flight/targets/SensorTest/Makefile.osx $*
452 ##############################
454 # GCS related components
456 ##############################
458 .PHONY: all_ground
459 all_ground: openpilotgcs uploader
461 # Convenience target for the GCS
462 .PHONY: gcs gcs_qmake gcs_clean
463 gcs: openpilotgcs
464 gcs_qmake: openpilotgcs_qmake
465 gcs_clean: openpilotgcs_clean
467 ifeq ($(V), 1)
468 GCS_SILENT :=
469 else
470 GCS_SILENT := silent
471 endif
473 OPENPILOTGCS_DIR := $(BUILD_DIR)/$(GCS_SMALL_NAME)_$(GCS_BUILD_CONF)
474 DIRS += $(OPENPILOTGCS_DIR)
476 OPENPILOTGCS_MAKEFILE := $(OPENPILOTGCS_DIR)/Makefile
478 .PHONY: openpilotgcs_qmake
479 openpilotgcs_qmake $(OPENPILOTGCS_MAKEFILE): | $(OPENPILOTGCS_DIR)
480 $(V1) cd $(OPENPILOTGCS_DIR) && \
481 $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/openpilotgcs.pro \
482 -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) \
483 'GCS_BIG_NAME="$(GCS_BIG_NAME)"' GCS_SMALL_NAME=$(GCS_SMALL_NAME) $(GCS_QMAKE_OPTS)
485 .PHONY: openpilotgcs
486 openpilotgcs: uavobjgenerator $(OPENPILOTGCS_MAKEFILE)
487 $(V1) $(MAKE) -w -C $(OPENPILOTGCS_DIR)/$(MAKE_DIR);
489 .PHONY: openpilotgcs_clean
490 openpilotgcs_clean:
491 @$(ECHO) " CLEAN $(call toprel, $(OPENPILOTGCS_DIR))"
492 $(V1) [ ! -d "$(OPENPILOTGCS_DIR)" ] || $(RM) -r "$(OPENPILOTGCS_DIR)"
496 ################################
498 # Serial Uploader tool
500 ################################
502 UPLOADER_DIR := $(BUILD_DIR)/uploader_$(GCS_BUILD_CONF)
503 DIRS += $(UPLOADER_DIR)
505 UPLOADER_MAKEFILE := $(UPLOADER_DIR)/Makefile
507 .PHONY: uploader_qmake
508 uploader_qmake $(UPLOADER_MAKEFILE): | $(UPLOADER_DIR)
509 $(V1) cd $(UPLOADER_DIR) && \
510 $(QMAKE) $(ROOT_DIR)/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/upload.pro \
511 -spec $(QT_SPEC) -r CONFIG+=$(GCS_BUILD_CONF) CONFIG+=$(GCS_SILENT) $(GCS_QMAKE_OPTS)
513 .PHONY: uploader
514 uploader: $(UPLOADER_MAKEFILE)
515 $(V1) $(MAKE) -w -C $(UPLOADER_DIR)
517 .PHONY: uploader_clean
518 uploader_clean:
519 @$(ECHO) " CLEAN $(call toprel, $(UPLOADER_DIR))"
520 $(V1) [ ! -d "$(UPLOADER_DIR)" ] || $(RM) -r "$(UPLOADER_DIR)"
523 # We want to take snapshots of the UAVOs at each point that they change
524 # to allow the GCS to be compatible with as many versions as possible.
525 # We always include a pseudo collection called "srctree" which represents
526 # the UAVOs in the source tree. So not necessary to add current tree UAVO
527 # hash here, it is always included.
529 # Find the git hashes of each commit that changes uavobjects with:
530 # git log --format=%h -- shared/uavobjectdefinition/ | head -n 2
531 # List only UAVO hashes of past releases, do not list current hash.
532 # Past compatible versions are so far: RELEASE-12.10.2
533 UAVO_GIT_VERSIONS := 5e14f53
535 # All versions includes also the current source tree UAVO hash
536 UAVO_ALL_VERSIONS := $(UAVO_GIT_VERSIONS) srctree
538 # This is where the UAVO collections are stored
539 UAVO_COLLECTION_DIR := $(BUILD_DIR)/uavo-collections
541 # $(1) git hash of a UAVO snapshot
542 define UAVO_COLLECTION_GIT_TEMPLATE
544 # Make the output directory that will contain all of the synthetics for the
545 # uavo collection referenced by the git hash $(1)
546 $$(UAVO_COLLECTION_DIR)/$(1):
547 $$(V1) $(MKDIR) -p $$(UAVO_COLLECTION_DIR)/$(1)
549 # Extract the snapshot of shared/uavobjectdefinition from git hash $(1)
550 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar: | $$(UAVO_COLLECTION_DIR)/$(1)
551 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar:
552 $$(V0) @$(ECHO) " UAVOTAR $(1)"
553 $$(V1) $(GIT) archive $(1) -o $$@ -- shared/uavobjectdefinition/
555 # Extract the uavo xml files from our snapshot
556 $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml.tar
557 $$(V0) @$(ECHO) " UAVOUNTAR $(1)"
558 $$(V1) $(RM) -rf $$@
559 $$(V1) $(MKDIR) -p $$@
560 $$(V1) $(TAR) -C $$(call toprel, $$@) -xf $$(call toprel, $$<) || $(RM) -rf $$@
561 endef
563 # Map the current working directory into the set of UAVO collections
564 $(UAVO_COLLECTION_DIR)/srctree:
565 $(V1) $(MKDIR) -p $@
567 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: | $(UAVO_COLLECTION_DIR)/srctree
568 $(UAVO_COLLECTION_DIR)/srctree/uavo-xml: $(UAVOBJ_XML_DIR)
569 $(V1) $(LN) -sf $(ROOT_DIR) $(UAVO_COLLECTION_DIR)/srctree/uavo-xml
571 # $(1) git hash (or symbolic name) of a UAVO snapshot
572 define UAVO_COLLECTION_BUILD_TEMPLATE
574 # This leaves us with a (broken) symlink that points to the full sha1sum of the collection
575 $$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
576 # Compute the sha1 hash for this UAVO collection
577 # The sed bit truncates the UAVO hash to 16 hex digits
578 $$(V1) $$(VERSION_INFO) \
579 --uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
580 --format='$$$${UAVO_HASH}' | \
581 $(SED) -e 's|\(................\).*|\1|' > $$@
583 $$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
585 # Generate the java uavobjects for this UAVO collection
586 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java: $$(UAVO_COLLECTION_DIR)/$(1)/uavohash
587 $$(V0) @$(ECHO) " UAVOJAVA $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
588 $$(V1) $(MKDIR) -p $$@
589 $$(V1) ( \
590 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
591 $$(UAVOBJGENERATOR) -java $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition $$(ROOT_DIR) ; \
594 # Build a jar file for this UAVO collection
595 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: | $$(ANDROIDGCS_ASSETS_DIR)/uavos
596 $$(UAVO_COLLECTION_DIR)/$(1)/java-build/uavobjects.jar: $$(UAVO_COLLECTION_DIR)/$(1)/java-build/java
597 $$(V0) @$(ECHO) " UAVOJAR $(1) " $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)
598 $$(V1) ( \
599 HASH=$$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash) && \
600 cd $$(UAVO_COLLECTION_DIR)/$(1)/java-build && \
601 $(JAVAC) java/*.java \
602 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVDataObject.java \
603 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVObject*.java \
604 $$(ROOT_DIR)/androidgcs/src/org/openpilot/uavtalk/UAVMetaObject.java \
605 -d . && \
606 find ./org/openpilot/uavtalk/uavobjects -type f -name '*.class' > classlist.txt && \
607 $(JAR) cf tmp_uavobjects.jar @classlist.txt && \
608 $$(ANDROID_DX) \
609 --dex \
610 --output $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar \
611 tmp_uavobjects.jar && \
612 $(LN) -sf $$(ANDROIDGCS_ASSETS_DIR)/uavos/$$$${HASH}.jar uavobjects.jar \
615 endef
617 # One of these for each element of UAVO_GIT_VERSIONS so we can extract the UAVOs from git
618 $(foreach githash, $(UAVO_GIT_VERSIONS), $(eval $(call UAVO_COLLECTION_GIT_TEMPLATE,$(githash))))
620 # One of these for each UAVO_ALL_VERSIONS which includes the ones in the srctree
621 $(foreach githash, $(UAVO_ALL_VERSIONS), $(eval $(call UAVO_COLLECTION_BUILD_TEMPLATE,$(githash))))
623 .PHONY: uavo-collections_java
624 uavo-collections_java: $(foreach githash, $(UAVO_ALL_VERSIONS), $(UAVO_COLLECTION_DIR)/$(githash)/java-build/uavobjects.jar)
626 .PHONY: uavo-collections
627 uavo-collections: uavo-collections_java
629 .PHONY: uavo-collections_clean
630 uavo-collections_clean:
631 @$(ECHO) " CLEAN $(call toprel, $(UAVO_COLLECTION_DIR))"
632 $(V1) [ ! -d "$(UAVO_COLLECTION_DIR)" ] || $(RM) -r $(UAVO_COLLECTION_DIR)
634 ##############################
636 # Unit Tests
638 ##############################
640 ALL_UNITTESTS := logfs math lednotification
642 # Build the directory for the unit tests
643 UT_OUT_DIR := $(BUILD_DIR)/unit_tests
644 DIRS += $(UT_OUT_DIR)
646 .PHONY: all_ut
647 all_ut: $(addsuffix _elf, $(addprefix ut_, $(ALL_UNITTESTS)))
649 .PHONY: all_ut_xml
650 all_ut_xml: $(addsuffix _xml, $(addprefix ut_, $(ALL_UNITTESTS)))
652 .PHONY: all_ut_run
653 all_ut_run: $(addsuffix _run, $(addprefix ut_, $(ALL_UNITTESTS)))
655 .PHONY: all_ut_clean
656 all_ut_clean:
657 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR))"
658 $(V1) [ ! -d "$(UT_OUT_DIR)" ] || $(RM) -r "$(UT_OUT_DIR)"
660 # $(1) = Unit test name
661 define UT_TEMPLATE
662 .PHONY: ut_$(1)
663 ut_$(1): ut_$(1)_run
665 ut_$(1)_%: $$(UT_OUT_DIR)
666 $(V1) $(MKDIR) -p $(UT_OUT_DIR)/$(1)
667 $(V1) cd $(ROOT_DIR)/flight/tests/$(1) && \
668 $$(MAKE) -r --no-print-directory \
669 BUILD_TYPE=ut \
670 BOARD_SHORT_NAME=$(1) \
671 TOPDIR=$(ROOT_DIR)/flight/tests/$(1) \
672 OUTDIR="$(UT_OUT_DIR)/$(1)" \
673 TARGET=$(1) \
676 .PHONY: ut_$(1)_clean
677 ut_$(1)_clean:
678 @$(ECHO) " CLEAN $(call toprel, $(UT_OUT_DIR)/$(1))"
679 $(V1) [ ! -d "$(UT_OUT_DIR)/$(1)" ] || $(RM) -r "$(UT_OUT_DIR)/$(1)"
680 endef
682 # Expand the unittest rules
683 $(foreach ut, $(ALL_UNITTESTS), $(eval $(call UT_TEMPLATE,$(ut))))
685 # Disable parallel make when the all_ut_run target is requested otherwise the TAP
686 # output is interleaved with the rest of the make output.
687 ifneq ($(strip $(filter all_ut_run,$(MAKECMDGOALS))),)
688 .NOTPARALLEL:
689 $(info $(EMPTY) NOTE Parallel make disabled by all_ut_run target so we have sane console output)
690 endif
692 ##############################
694 # Packaging components
696 ##############################
698 # Firmware files to package
699 PACKAGE_FW_EXCLUDE := fw_simposix $(if $(PACKAGE_FW_INCLUDE_DISCOVERYF4BARE),,fw_discoveryf4bare)
700 PACKAGE_FW_TARGETS := $(filter-out $(PACKAGE_FW_EXCLUDE), $(FW_TARGETS))
701 PACKAGE_ELF_TARGETS := $(filter fw_simposix, $(FW_TARGETS))
703 # Rules to generate GCS resources used to embed firmware binaries into the GCS.
704 # They are used later by the vehicle setup wizard to update board firmware.
705 # To open a firmware image use ":/firmware/fw_coptercontrol.opfw"
706 OPFW_RESOURCE := $(OPGCSSYNTHDIR)/opfw_resource.qrc
707 OPFW_RESOURCE_PREFIX := ../../
708 OPFW_FILES := $(foreach fw_targ, $(PACKAGE_FW_TARGETS), $(call toprel, $(BUILD_DIR)/$(fw_targ)/$(fw_targ).opfw))
709 OPFW_CONTENTS := \
710 <!DOCTYPE RCC><RCC version="1.0"> \
711 <qresource prefix="/firmware"> \
712 $(foreach fw_file, $(OPFW_FILES), <file alias="$(notdir $(fw_file))">$(OPFW_RESOURCE_PREFIX)$(fw_file)</file>) \
713 </qresource> \
714 </RCC>
716 .PHONY: opfw_resource
717 opfw_resource: $(OPFW_RESOURCE)
719 $(OPFW_RESOURCE): $(FW_TARGETS) | $(OPGCSSYNTHDIR)
720 @$(ECHO) Generating OPFW resource file $(call toprel, $@)
721 $(V1) $(ECHO) $(QUOTE)$(OPFW_CONTENTS)$(QUOTE) > $@
723 # If opfw_resource or all firmware are requested, GCS should depend on the resource
724 ifneq ($(strip $(filter opfw_resource all all_fw all_flight package,$(MAKECMDGOALS))),)
725 $(OPENPILOTGCS_MAKEFILE): $(OPFW_RESOURCE)
726 endif
728 # Packaging targets: package
729 # - builds all firmware, opfw_resource, gcs
730 # - copies firmware into a package directory
731 # - calls paltform-specific packaging script
733 # Define some variables
734 PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL})
735 PACKAGE_NAME := $(subst $(SPACE),,$(OP_BIG_NAME))
736 PACKAGE_SEP := -
737 PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL)
739 # Source distribution is never dirty because it uses git archive
740 DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar
742 include $(ROOT_DIR)/package/$(UNAME).mk
744 ##############################
746 # Source code formatting
748 ##############################
750 UNCRUSTIFY_TARGETS := flight ground
752 # $(1) = Uncrustify target (e.g flight or ground)
753 # $(2) = Target root directory
754 define UNCRUSTIFY_TEMPLATE
756 .PHONY: uncrustify_$(1)
757 uncrustify_$(1):
758 @$(ECHO) "Auto-formatting $(1) source code"
759 $(V1) UNCRUSTIFY_CONFIG="$(ROOT_DIR)/make/uncrustify/uncrustify.cfg" $(SHELL) make/scripts/uncrustify.sh $(call toprel, $(2))
760 endef
762 $(foreach uncrustify_targ, $(UNCRUSTIFY_TARGETS), $(eval $(call UNCRUSTIFY_TEMPLATE,$(uncrustify_targ),$(ROOT_DIR)/$(uncrustify_targ))))
764 .PHONY: uncrustify_all
765 uncrustify_all: $(addprefix uncrustify_,$(UNCRUSTIFY_TARGETS))
767 ##############################
769 # Doxygen documentation
771 # Each target should have own Doxyfile.$(target) with build directory build/docs/$(target),
772 # proper source directory (e.g. $(target)) and appropriate other doxygen options.
774 ##############################
776 DOCS_TARGETS := flight ground uavobjects
778 # $(1) = Doxygen target (e.g flight or ground)
779 define DOXYGEN_TEMPLATE
781 .PHONY: docs_$(1)
782 docs_$(1): docs_$(1)_clean
783 @$(ECHO) "Generating $(1) documentation"
784 $(V1) $(MKDIR) -p $(BUILD_DIR)/docs/$(1)
785 $(V1) $(DOXYGEN) $(ROOT_DIR)/make/doxygen/Doxyfile.$(1)
787 .PHONY: docs_$(1)_clean
788 docs_$(1)_clean:
789 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs/$(1))"
790 $(V1) [ ! -d "$(BUILD_DIR)/docs/$(1)" ] || $(RM) -r "$(BUILD_DIR)/docs/$(1)"
792 endef
794 $(foreach docs_targ, $(DOCS_TARGETS), $(eval $(call DOXYGEN_TEMPLATE,$(docs_targ))))
796 .PHONY: docs_all
797 docs_all: $(addprefix docs_,$(DOCS_TARGETS))
799 .PHONY: docs_all_clean
800 docs_all_clean:
801 @$(ECHO) " CLEAN $(call toprel, $(BUILD_DIR)/docs)"
802 $(V1) [ ! -d "$(BUILD_DIR)/docs" ] || $(RM) -rf "$(BUILD_DIR)/docs"
804 ##############################
806 # Build info
808 ##############################
810 .PHONY: build-info
811 build-info: | $(BUILD_DIR)
812 @$(ECHO) " BUILD-INFO $(call toprel, $(BUILD_DIR)/$@.txt)"
813 $(V1) $(VERSION_INFO) \
814 --uavodir=$(ROOT_DIR)/shared/uavobjectdefinition \
815 --template="make/templates/$@.txt" \
816 --outfile="$(BUILD_DIR)/$@.txt"
818 ##############################
820 # Source for distribution
822 ##############################
824 DIST_VER_INFO := $(DIST_DIR)/version-info.json
826 $(DIST_VER_INFO): .git/index | $(DIST_DIR)
827 $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)"
830 $(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR)
831 @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)"
832 $(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD
833 $(V1) tar --append --file="$(DIST_NAME)" \
834 --transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \
835 $(call toprel, "$(DIST_VER_INFO)")
836 $(V1) gzip -f "$(DIST_NAME)"
838 .PHONY: dist
839 dist: $(DIST_NAME).gz
842 ##############################
844 # Directories
846 ##############################
848 $(DIRS):
849 $(V1) $(MKDIR) -p $@
852 ##############################
854 # Help message, the default Makefile goal
856 ##############################
858 .DEFAULT_GOAL := help
860 .PHONY: help
861 help:
862 @$(ECHO)
863 @$(ECHO) " This Makefile is known to work on Linux and Mac in a standard shell environment."
864 @$(ECHO) " It also works on Windows by following the instructions given on this wiki page:"
865 @$(ECHO) " http://wiki.openpilot.org/display/Doc/Windows%3A+Building+and+Packaging"
866 @$(ECHO)
867 @$(ECHO) " Here is a summary of the available targets:"
868 @$(ECHO)
869 @$(ECHO) " [Source tree preparation]"
870 @$(ECHO) " prepare - Install GIT commit message template"
871 @$(ECHO) " [Tool Installers]"
872 @$(ECHO) " arm_sdk_install - Install the GNU ARM gcc toolchain"
873 @$(ECHO) " qt_sdk_install - Install the QT development tools"
874 @$(ECHO) " nsis_install - Install the NSIS Unicode (Windows only)"
875 @$(ECHO) " sdl_install - Install the SDL library (Windows only)"
876 @$(ECHO) " mesawin_install - Install the OpenGL32 DLL (Windows only)"
877 @$(ECHO) " openssl_install - Install the OpenSSL libraries (Windows only)"
878 @$(ECHO) " uncrustify_install - Install the Uncrustify source code beautifier"
879 @$(ECHO) " doxygen_install - Install the Doxygen documentation generator"
880 @$(ECHO) " gtest_install - Install the GoogleTest framework"
881 @$(ECHO) " These targets are not updated yet and are probably broken:"
882 @$(ECHO) " openocd_install - Install the OpenOCD JTAG daemon"
883 @$(ECHO) " stm32flash_install - Install the stm32flash tool for unbricking F1-based boards"
884 @$(ECHO) " dfuutil_install - Install the dfu-util tool for unbricking F4-based boards"
885 @$(ECHO) " Install all available tools:"
886 @$(ECHO) " all_sdk_install - Install all of above (platform-dependent)"
887 @$(ECHO) " build_sdk_install - Install only essential for build tools (platform-dependent)"
888 @$(ECHO)
889 @$(ECHO) " Other tool options are:"
890 @$(ECHO) " <tool>_version - Display <tool> version"
891 @$(ECHO) " <tool>_clean - Remove installed <tool>"
892 @$(ECHO) " <tool>_distclean - Remove downloaded <tool> distribution file(s)"
893 @$(ECHO)
894 @$(ECHO) " [Big Hammer]"
895 @$(ECHO) " all - Generate UAVObjects, build openpilot firmware and gcs"
896 @$(ECHO) " all_flight - Build all firmware, bootloaders and bootloader updaters"
897 @$(ECHO) " all_fw - Build only firmware for all boards"
898 @$(ECHO) " all_bl - Build only bootloaders for all boards"
899 @$(ECHO) " all_bu - Build only bootloader updaters for all boards"
900 @$(ECHO)
901 @$(ECHO) " all_clean - Remove your build directory ($(BUILD_DIR))"
902 @$(ECHO) " all_flight_clean - Remove all firmware, bootloaders and bootloader updaters"
903 @$(ECHO) " all_fw_clean - Remove firmware for all boards"
904 @$(ECHO) " all_bl_clean - Remove bootloaders for all boards"
905 @$(ECHO) " all_bu_clean - Remove bootloader updaters for all boards"
906 @$(ECHO)
907 @$(ECHO) " all_<board> - Build all available images for <board>"
908 @$(ECHO) " all_<board>_clean - Remove all available images for <board>"
909 @$(ECHO)
910 @$(ECHO) " all_ut - Build all unit tests"
911 @$(ECHO) " all_ut_tap - Run all unit tests and capture all TAP output to files"
912 @$(ECHO) " all_ut_run - Run all unit tests and dump TAP output to console"
913 @$(ECHO)
914 @$(ECHO) " [Firmware]"
915 @$(ECHO) " <board> - Build firmware for <board>"
916 @$(ECHO) " Supported boards are ($(ALL_BOARDS))"
917 @$(ECHO) " fw_<board> - Build firmware for <board>"
918 @$(ECHO) " Supported boards are ($(FW_BOARDS))"
919 @$(ECHO) " fw_<board>_clean - Remove firmware for <board>"
920 @$(ECHO) " fw_<board>_program - Use OpenOCD + JTAG to write firmware to <board>"
921 @$(ECHO)
922 @$(ECHO) " [Bootloader]"
923 @$(ECHO) " bl_<board> - Build bootloader for <board>"
924 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
925 @$(ECHO) " bl_<board>_clean - Remove bootloader for <board>"
926 @$(ECHO) " bl_<board>_program - Use OpenOCD + JTAG to write bootloader to <board>"
927 @$(ECHO)
928 @$(ECHO) " [Entire Flash]"
929 @$(ECHO) " ef_<board> - Build entire flash image for <board>"
930 @$(ECHO) " Supported boards are ($(EF_BOARDS))"
931 @$(ECHO) " ef_<board>_clean - Remove entire flash image for <board>"
932 @$(ECHO) " ef_<board>_program - Use OpenOCD + JTAG to write entire flash image to <board>"
933 @$(ECHO)
934 @$(ECHO) " [Bootloader Updater]"
935 @$(ECHO) " bu_<board> - Build bootloader updater for <board>"
936 @$(ECHO) " Supported boards are ($(BU_BOARDS))"
937 @$(ECHO) " bu_<board>_clean - Remove bootloader updater for <board>"
938 @$(ECHO)
939 @$(ECHO) " [Unbrick a board]"
940 @$(ECHO) " unbrick_<board> - Use the STM32's built in boot ROM to write a bootloader to <board>"
941 @$(ECHO) " Supported boards are ($(BL_BOARDS))"
942 @$(ECHO) " [Unittests]"
943 @$(ECHO) " ut_<test> - Build unit test <test>"
944 @$(ECHO) " ut_<test>_xml - Run test and capture XML output into a file"
945 @$(ECHO) " ut_<test>_run - Run test and dump output to console"
946 @$(ECHO)
947 @$(ECHO) " [Simulation]"
948 @$(ECHO) " sim_osx - Build OpenPilot simulation firmware for OSX"
949 @$(ECHO) " sim_osx_clean - Delete all build output for the osx simulation"
950 @$(ECHO) " sim_win32 - Build OpenPilot simulation firmware for Windows"
951 @$(ECHO) " using mingw and msys"
952 @$(ECHO) " sim_win32_clean - Delete all build output for the win32 simulation"
953 @$(ECHO)
954 @$(ECHO) " [GCS]"
955 @$(ECHO) " gcs - Build the Ground Control System (GCS) application (debug|release)"
956 @$(ECHO) " Compile specific directory: MAKE_DIR=<dir>"
957 @$(ECHO) " Example: make gcs MAKE_DIR=src/plugins/coreplugin"
958 @$(ECHO) " gcs_qmake - Run qmake for the Ground Control System (GCS) application (debug|release)"
959 @$(ECHO) " gcs_clean - Remove the Ground Control System (GCS) application (debug|release)"
960 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
961 @$(ECHO)
962 @$(ECHO) " [Uploader Tool]"
963 @$(ECHO) " uploader - Build the serial uploader tool (debug|release)"
964 @$(ECHO) " uploader_qmake - Run qmake for the serial uploader tool (debug|release)"
965 @$(ECHO) " uploader_clean - Remove the serial uploader tool (debug|release)"
966 @$(ECHO) " Supported build configurations: GCS_BUILD_CONF=debug|release (default is $(GCS_BUILD_CONF))"
967 @$(ECHO)
968 @$(ECHO)
969 @$(ECHO) " [UAVObjects]"
970 @$(ECHO) " uavobjects - Generate source files from the UAVObject definition XML files"
971 @$(ECHO) " uavobjects_test - Parse xml-files - check for valid, duplicate ObjId's, ..."
972 @$(ECHO) " uavobjects_<group> - Generate source files from a subset of the UAVObject definition XML files"
973 @$(ECHO) " Supported groups are ($(UAVOBJ_TARGETS))"
974 @$(ECHO)
975 @$(ECHO) " [Packaging]"
976 @$(ECHO) " package - Build and package the OpenPilot platform-dependent package (no clean)"
977 @$(ECHO) " opfw_resource - Generate resources to embed firmware binaries into the GCS"
978 @$(ECHO) " dist - Generate source archive for distribution"
979 @$(ECHO) " install - Install GCS to \"DESTDIR\" with prefix \"prefix\" (Linux only)"
980 @$(ECHO)
981 @$(ECHO) " [Code Formatting]"
982 @$(ECHO) " uncrustify_<source> - Reformat <source> code according to the project's standards"
983 @$(ECHO) " Supported sources are ($(UNCRUSTIFY_TARGETS))"
984 @$(ECHO) " uncrustify_all - Reformat all source code"
985 @$(ECHO)
986 @$(ECHO) " [Code Documentation]"
987 @$(ECHO) " docs_<source> - Generate HTML documentation for <source>"
988 @$(ECHO) " Supported sources are ($(DOCS_TARGETS))"
989 @$(ECHO) " docs_all - Generate HTML documentation for all"
990 @$(ECHO) " docs_<source>_clean - Delete generated documentation for <source>"
991 @$(ECHO) " docs_all_clean - Delete all generated documentation"
992 @$(ECHO)
993 @$(ECHO) " Hint: Add V=1 to your command line to see verbose build output."
994 @$(ECHO)
995 @$(ECHO) " Notes: All tool distribution files will be downloaded into $(DL_DIR)"
996 @$(ECHO) " All tools will be installed into $(TOOLS_DIR)"
997 @$(ECHO) " All build output will be placed in $(BUILD_DIR)"
998 @$(ECHO)
999 @$(ECHO) " Tool download and install directories can be changed using environment variables:"
1000 @$(ECHO) " OPENPILOT_DL_DIR full path to downloads directory [downloads if not set]"
1001 @$(ECHO) " OPENPILOT_TOOLS_DIR full path to installed tools directory [tools if not set]"
1002 @$(ECHO) " More info: http://wiki.openpilot.org/display/Doc/OpenPilot+Build+System+Overview"
1003 @$(ECHO)