# Hey Emacs, this is a -*- makefile -*-
#
#   Copyright (C) 2009-2015 The Paparazzi Team
#
# This file is part of paparazzi.
#
# paparazzi 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 2, or (at your option)
# any later version.
#
# paparazzi 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 paparazzi; see the file COPYING.  If not, see
# <http://www.gnu.org/licenses/>.
#

#
# Makefile for ARM linux targets (e.g. OMAP, BBB, ARDrone)
#

#
# find compiler toolchain
# if HARD_FLOAT is defined at this point it will try to find the hf toolchain
#
include $(PAPARAZZI_SRC)/conf/Makefile.arm-linux-toolchain


# Define some ARM specifc flags

ifdef HARD_FLOAT
# e.g. for BBB or gumstix with armhf distribution
FLOAT_ABI ?= -mfloat-abi=hard -mfpu=neon -ffast-math
else
FLOAT_ABI ?= -mfloat-abi=softfp -mfpu=vfp
endif

ARCH_CFLAGS ?= -mtune=cortex-a8 -march=armv7-a

# with armv7, unaligned data can still be read
CFLAGS += -DPPRZLINK_UNALIGNED_ACCESS=1

# add ARM specifc flags to CFLAGS, LDFLAGS
CFLAGS += $(FLOAT_ABI) $(ARCH_CFLAGS)
LDFLAGS += $(FLOAT_ABI)
CXXFLAGS += $(FLOAT_ABI) $(ARCH_CFLAGS)

# include the common linux Makefile (common CFLAGS, actual targets)
include $(PAPARAZZI_SRC)/conf/Makefile.linux
