mcu_base/Makefile.common

42 lines
1.1 KiB
Makefile
Raw Normal View History

# Current development directory path
TOP:=$(shell readlink -f "$(dir $(lastword $(MAKEFILE_LIST)))")
-include $(TOP)/Makefile.opts
# Toolchain - Don't change this unless you are sure what you're doing!
TOOLCHAIN_CONFIG=toolchain-$(MCU_CORE).config
TOOLCHAIN_SRC_DIR=crosstool-ng
CROSS_DIR=${HOME}/x-tools/arm-$(MCU_CORE)-eabi
CROSS_COMPILE=${CROSS_DIR}/bin/arm-$(MCU_CORE)-eabi-
CC=$(CROSS_COMPILE)gcc
CPP=$(CROSS_COMPILE)cpp
LD=$(CROSS_COMPILE)gcc
OBJCOPY=$(CROSS_COMPILE)objcopy
AR=$(CROSS_COMPILE)ar
AS=$(CROSS_COMPILE)as
GDB=$(CROSS_COMPILE)gdb
RM=rm
ECHO=echo
HOSTCC ?= gcc
# How many processor cores we can use for builds
JLEVEL:=${shell cat /proc/cpuinfo |grep processor |wc -l}
# Libraries
LIBDIR=$(TOP)/libs
# Compiler flags
CFLAGS += -pipe -Wall -Wextra -g -Os -flto -fuse-linker-plugin -fwhole-program -std=c99 $(MCU_CFLAGS) $(TARGET_CFLAGS)
CPPFLAGS += $(MCU_INCLUDE) $(INCLUDE) $(MCU_CPPFLAGS) $(TARGET_CPPFLAGS)
# Linker Flags
LDFLAGS += -fno-exceptions -ffunction-sections -fdata-sections -nostartfiles # -fuse-linker-plugin
# Try and pretty things up a bit.
Q=@
E=echo
ifeq ($(V), 1)
Q=
E=true
endif