mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
8f977a4411
This is the first cleanup pass through makefiles and pios. Probably it is difficult to track changes due to the nature of them. I would recommend to look at resulting files and compiled code instead. NOTE: original branch was rebased and lot of conflicts were fixed on the way. So do not expect that every commit in this series will be buildable (unlike original branch). Only final result was tested. The main goal was to remove as much duplication of code (and copy/paste errors) as possible, moving common parts out of Makefiles. It still is not perfect, and mostly no code changes made - Makefiles and #ifdefs only. But please while testing make sure that all code works as before, and no modules/options are missed by accident. Brief list of changes: - Moved common parts of Makefiles into the set of *.mk files. - Changed method of passing common vars from top Makefile to lower ones. - Some pios cleanup, mostly #ifdefs, and all pios_config.h files. - Many obsolete files removed (for instance, AHRS files, op_config.h). - Many obsolete or unused macros removed or fixed/renamed (ALL_DIGNOSTICS). - Unified pios_config.h template. Please don't remove lines for board configs, only comment/uncomment them. Adding new PIOS options, please propagate them to all board files keeping the same order. - Some formatting, spacing, indentation (no line endings change yet). - Some cosmetic fixes (no more C:\X\Y\filename.c printings on Windows). - Added some library.mk files to move libs into AR achives later. - EntireFlash target now uses cross-platform python script to generate bin files. So it works on all supported platforms: Linux, OSX, Windows. - Top level packaging is completely rewritten. Now it is a part of top Makefile. As such, all dependencies are checked and accounted, no more 'make -j' problems should occur. - Default GCS_BUILD_CONF is release now, may be changed if necessary using 'make GCS_BUILD_CONF=debug gcs'. - GCS build paths are separated into debug and release, so no more obj file clashes. Packaging system supports only release builds. - New target is introduced: 'clean_package'. Now 'make package' does not clean build directory. Use clean_package instead for distributable builds. - Targets like 'all', 'opfw_resource', etc now will print extra contex in parallel builds too. - If any of 'package', 'clean_package', 'opfw_resource' targets are given on command line, GCS build will depend on the resource, so all fw_*.opfw targets will be built and embedded into GCS. By default GCS does not depend on resource, and will be built w/o firmware (unless the resource files already exist and the Qt resource file is generated). - fw_simposix (ELF executable) is now packaged for linux. Run'n'play! - Make help is refined and is now up to date. Still broken: - UnitTests, should be fixed - SimPosix: buildable, but should be reworked. Next planned passes to do: - toolchain bootstrapping and packaging (including windows - WIP) - CMSIS/StdPeriph lib cleanup - more PIOS cleanup - move libs into AR archives to save build time - sim targets refactir and cleanup - move android-related directories under <top>/android - unit test targets fix - source code line ending changes (there are many different, were not changed) - coding style Merging this, please use --no-ff git option to make it the real commit point Conflicts: A lot of... :-)
175 lines
5.7 KiB
Makefile
175 lines
5.7 KiB
Makefile
#
|
|
# Copyright (c) 2009-2013, The OpenPilot Team, http://www.openpilot.org
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
# for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
|
|
ifndef OPENPILOT_IS_COOL
|
|
$(error Top level Makefile must be used to build this target)
|
|
endif
|
|
|
|
# Paths
|
|
TOPDIR = .
|
|
OPSYSTEM = $(TOPDIR)/System
|
|
OPSYSTEMINC = $(OPSYSTEM)/inc
|
|
PIOSINC = $(PIOS)/inc
|
|
PIOSCOMMON = $(PIOS)/Common
|
|
PIOSBOARDS = $(PIOS)/Boards
|
|
FLIGHTLIBINC = $(FLIGHTLIB)/inc
|
|
|
|
## UAVTalk and UAVObject manager
|
|
OPUAVOBJINC = $(OPUAVOBJ)/inc
|
|
OPUAVTALKINC = $(OPUAVTALK)/inc
|
|
|
|
## Math
|
|
MATHLIB = $(FLIGHTLIB)/math
|
|
MATHLIBINC = $(FLIGHTLIB)/math
|
|
|
|
## FreeRTOS support
|
|
FREERTOS_DIR = $(PIOSCOMMON)/Libraries/FreeRTOS
|
|
include $(FREERTOS_DIR)/library.mk
|
|
|
|
## Misc
|
|
DOXYGENDIR = $(ROOT_DIR)/flight/Doc/Doxygen
|
|
OPTESTS = $(TOPDIR)/Tests
|
|
|
|
## PIOS Hardware
|
|
ifeq ($(MCU),cortex-m3)
|
|
include $(PIOS)/STM32F10x/library.mk
|
|
else ifeq ($(MCU),cortex-m4)
|
|
include $(PIOS)/STM32F4xx/library.mk
|
|
else
|
|
$(error Unsupported MCU: $(MCU))
|
|
endif
|
|
|
|
# List C source files here (C dependencies are automatically generated).
|
|
# Use file-extension c for "c-only"-files
|
|
|
|
## PIOS Hardware (Common Peripherals)
|
|
SRC += $(PIOSCOMMON)/pios_adxl345.c
|
|
SRC += $(PIOSCOMMON)/pios_bma180.c
|
|
SRC += $(PIOSCOMMON)/pios_bmp085.c
|
|
SRC += $(PIOSCOMMON)/pios_etasv3.c
|
|
SRC += $(PIOSCOMMON)/pios_gcsrcvr.c
|
|
SRC += $(PIOSCOMMON)/pios_hcsr04.c
|
|
SRC += $(PIOSCOMMON)/pios_hmc5843.c
|
|
SRC += $(PIOSCOMMON)/pios_hmc5883.c
|
|
SRC += $(PIOSCOMMON)/pios_i2c_esc.c
|
|
SRC += $(PIOSCOMMON)/pios_l3gd20.c
|
|
SRC += $(PIOSCOMMON)/pios_mpu6000.c
|
|
SRC += $(PIOSCOMMON)/pios_mpxv.c
|
|
SRC += $(PIOSCOMMON)/pios_ms5611.c
|
|
SRC += $(PIOSCOMMON)/pios_video.c
|
|
SRC += $(PIOSCOMMON)/pios_wavplay.c
|
|
|
|
## PIOS Hardware (Common)
|
|
SRC += $(PIOSCOMMON)/pios_com.c
|
|
SRC += $(PIOSCOMMON)/pios_com_msg.c
|
|
SRC += $(PIOSCOMMON)/pios_crc.c
|
|
SRC += $(PIOSCOMMON)/pios_flashfs_logfs.c
|
|
SRC += $(PIOSCOMMON)/pios_flash_jedec.c
|
|
SRC += $(PIOSCOMMON)/pios_rcvr.c
|
|
SRC += $(PIOSCOMMON)/pios_rfm22b.c
|
|
SRC += $(PIOSCOMMON)/pios_rfm22b_com.c
|
|
SRC += $(PIOSCOMMON)/pios_rfm22b_rcvr.c
|
|
SRC += $(PIOSCOMMON)/pios_sbus.c
|
|
SRC += $(PIOSCOMMON)/pios_sdcard.c
|
|
|
|
## PIOS USB related files
|
|
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_cdc.c
|
|
SRC += $(PIOSCOMMON)/pios_usb_desc_hid_only.c
|
|
SRC += $(PIOSCOMMON)/pios_usb_util.c
|
|
|
|
## Misc library functions
|
|
SRC += $(FLIGHTLIB)/fifo_buffer.c
|
|
SRC += $(FLIGHTLIB)/taskmonitor.c
|
|
SRC += $(FLIGHTLIB)/sanitycheck.c
|
|
SRC += $(FLIGHTLIB)/CoordinateConversions.c
|
|
SRC += $(MATHLIB)/sin_lookup.c
|
|
SRC += $(MATHLIB)/pid.c
|
|
|
|
## Modules
|
|
SRC += $(foreach mod, $(MODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c))
|
|
SRC += $(foreach mod, $(OPTMODULES), $(wildcard $(OPMODULEDIR)/$(mod)/*.c))
|
|
|
|
# List C source files here which must be compiled in ARM-Mode (no -mthumb).
|
|
# Use file-extension c for "c-only"-files
|
|
SRCARM +=
|
|
|
|
# List C++ source files here.
|
|
# Use file-extension .cpp for C++-files (not .C)
|
|
CPPSRC +=
|
|
|
|
# List C++ source files here which must be compiled in ARM-Mode.
|
|
# Use file-extension .cpp for C++-files (not .C)
|
|
CPPSRCARM +=
|
|
|
|
# List Assembler source files here.
|
|
# Make them always end in a capital .S. Files ending in a lowercase .s
|
|
# will not be considered source files but generated files (assembler
|
|
# output from the compiler), and will be deleted upon "make clean"!
|
|
# Even though the DOS/Win* filesystem matches both .s and .S the same,
|
|
# it will preserve the spelling of the filenames, and gcc itself does
|
|
# care about how the name is spelled on its command-line.
|
|
ASRC +=
|
|
|
|
# List Assembler source files here which must be assembled in ARM-Mode.
|
|
ASRCARM +=
|
|
|
|
# List any extra directories to look for include files here.
|
|
# Each directory must be seperated by a space.
|
|
EXTRAINCDIRS += $(PIOS)
|
|
EXTRAINCDIRS += $(PIOSINC)
|
|
EXTRAINCDIRS += $(FLIGHTLIBINC)
|
|
EXTRAINCDIRS += $(PIOSCOMMON)
|
|
EXTRAINCDIRS += $(PIOSBOARDS)
|
|
EXTRAINCDIRS += $(HWDEFSINC)
|
|
EXTRAINCDIRS += $(OPSYSTEMINC)
|
|
EXTRAINCDIRS += $(MATHLIBINC)
|
|
EXTRAINCDIRS += $(OPUAVOBJINC)
|
|
EXTRAINCDIRS += $(OPUAVTALKINC)
|
|
EXTRAINCDIRS += $(OPUAVSYNTHDIR)
|
|
|
|
# Modules
|
|
EXTRAINCDIRS += $(foreach mod, $(OPTMODULES) $(MODULES), $(OPMODULEDIR)/$(mod)/inc) $(OPMODULEDIR)/System/inc
|
|
|
|
# List any extra directories to look for library files here.
|
|
# Also add directories where the linker should search for
|
|
# includes from linker-script to the list
|
|
# Each directory must be seperated by a space.
|
|
EXTRA_LIBDIRS +=
|
|
|
|
# Extra Libraries
|
|
# Each library-name must be seperated by a space.
|
|
# i.e. to link with libxyz.a, libabc.a and libefsl.a:
|
|
# EXTRA_LIBS = xyz abc efsl
|
|
# for newlib-lpc (file: libnewlibc-lpc.a):
|
|
# EXTRA_LIBS = newlib-lpc
|
|
EXTRA_LIBS += m
|
|
|
|
# Compiler flags
|
|
CFLAGS +=
|
|
|
|
# Declare all non-optional modules as built-in to force inclusion
|
|
CDEFS += $(foreach mod, $(notdir $(MODULES)), -DMODULE_$(mod)_BUILTIN)
|
|
|
|
# Set linker-script name depending on selected submodel name
|
|
ifeq ($(MCU),cortex-m3)
|
|
LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_memory.ld
|
|
LDFLAGS += -T$(LINKER_SCRIPTS_PATH)/link_$(BOARD)_sections.ld
|
|
else ifeq ($(MCU),cortex-m4)
|
|
LDFLAGS += $(addprefix -T,$(LINKER_SCRIPTS_APP))
|
|
endif
|