blob: 24529e52987cd11e9dc94a8b6c25cfc4b620f37c [file] [log] [blame]
#
# Copyright (c) 2010-2011 Nest, Inc.
# All rights reserved.
#
# This document is the property of Nest. It is considered
# confidential and proprietary information.
#
# This document may not be reproduced or transmitted in any form,
# in whole or in part, without the express written permission of
# Nest.
#
# Description:
#
include pre.mak
ifeq ($(BUILD_FEATURE_NEWLIB),1)
PackageName := newlib
PackageExtension := tar.gz
PackageSeparator := -
PackagePatchArgs := -p1
PackageVersion := 1.20.0
PackageArchive := $(PackageName)$(PackageSeparator)$(PackageVersion).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
CleanPaths += $(PackageLicenseFile)
all: $(PackageDefaultGoal)
# Generate the package license contents.
#$(PackageLicenseFile): $(PackageSourceDir)/COPYRIGHT
# $(copy-result)
# Extract the source from the archive and apply patches, if any.
$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
$(expand-and-patch-package)
# Prepare the sources.
.PHONY: source
source: | $(PackageSourceDir)
# Patch the sources, if necessary.
.PHONY: patch
patch: source
# Configure the source for building.
$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory)
cd $(BuildDirectory) && \
$(CURDIR)/$(PackageSourceDir)/configure \
--target=arm-none-eabi \
--prefix=/usr \
--enable-interwork \
--disable-newlib-supplied-syscalls \
--disable-newlib-io-float \
--with-gnu-ld \
--with-gnu-as \
--disable-shared \
--disable-newlib-atexit-dynamic-alloc \
--disable-multilib
.PHONY: configure
configure: source $(PackageBuildMakefile)
# Build the source.
#
.PHONY: build
build: configure | $(BuildDirectory)
$(Verbose)unset MAKEFLAGS \
&& $(MAKE) -C $(BuildDirectory) \
CC_FOR_TARGET="$(CC)" \
CXX_FOR_TARGET="$(CXX)" \
AS_FOR_TARGET=$(AS) \
AR_FOR_TARGET=$(AR) \
LD_FOR_TARGET=$(LD) \
NM_FOR_TARGET=$(NM) \
OBJDUMP_FOR_TARGET=$(OBJDUMP) \
RANLIB_FOR_TARGET=$(RANLIB) \
READELF_FOR_TARGET=$(READELF) \
STRIP_FOR_TARGET=$(STRIP) \
CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fomit-frame-pointer -mcpu=cortex-m3 -mthumb -D__thumb2__ -D__BUFSIZ__=256 -DMALLOC_LOCK_FUNCTION=__nl_malloc_lock -DMALLOC_UNLOCK_FUNCTION=__nl_malloc_unlock" \
CCASFLAGS="-mcpu=cortex-m3 -mthumb -D__thumb2__"
.PHONY: prepare
prepare: stage
# Stage the build to a temporary installation area.
#
.PHONY: stage
stage: build | $(ResultDirectory)
$(Verbose)unset MAKEFLAGS && \
$(MAKE) -C $(BuildDirectory) \
CC_FOR_TARGET="$(CC)" \
CXX_FOR_TARGET="$(CXX)" \
AS_FOR_TARGET=$(AS) \
AR_FOR_TARGET=$(AR) \
LD_FOR_TARGET=$(LD) \
NM_FOR_TARGET=$(NM) \
OBJDUMP_FOR_TARGET=$(OBJDUMP) \
RANLIB_FOR_TARGET=$(RANLIB) \
READELF_FOR_TARGET=$(READELF) \
STRIP_FOR_TARGET=$(STRIP) \
DESTDIR=$(ResultDirectory) \
install
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
endif # ifeq ($(BUILD_FEATURE_NEWLIB),1)
include post.mak