blob: 4a180d4dab0324a4307ed192a5f7de6bf40a434e [file] [log] [blame]
#
# Copyright (c) 2010-2012 Nest Labs, 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:
# This file is the makefile for Boost, a collection of open
# source libraries that extend the functionality of the C++ standard
# library.
#
BuildConfigSpecialized := No
BuildProductSpecialized := Yes
include pre.mak
# There's some dependency issues creating the tools and tools paths.
# Since boost uses it's only build system (bjam) anyway, not much
# to gain using parallel builds just for setting up bjam.
.NOTPARALLEL:
PackageName := boost
PackageExtension := tar.bz2
PackageSeparator := _
PackagePatchArgs := -p1
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(call GenerateBuildPaths,$(PackageName)$(PackageSeparator)$(PackageVersion))
CleanPaths += $(PackageLicenseFile)
ICUSearchPath := $(ICUPath)/usr
# For the short-term, we are always building with GCC even though the
# actual tool chain may be some repackaged version of GCC. So, just
# specify that.
#BoostToolset := clang
# We do not want versioned headers and libraries, so specify the
# 'system' layout. Also, we do not want all the various combinations
# of shared/static, release/debug, stripped/unstripped and
# non-threaded/threaded libraries, so just specify 'minimal'.
BoostToolProduct-darwin := clang
BoostToolProduct-linux := gcc
# TODO COMSIM check if adding line below creates any issues
BoostToolProduct-freertos := gcc
BoostToolProduct = $(BoostToolProduct-$(TargetOS))
BoostJamConfig += --layout=system \
--build-type=minimal \
-sICU_PATH=$(ICUSearchPath) \
toolset=$(BoostToolProduct) \
link=static \
ifneq ($(CONFIG_OSM_HOST),1)
BoostLibraries = \
date_time \
filesystem \
regex \
system \
test \
thread \
python \
else
BoostLibraries = filesystem system
endif
BoostLibrariesList = $(subst $(Space),$(Comma),$(strip $(BoostLibraries)))
BoostConfigure = $(call GenerateBuildPaths,bootstrap.sh)
BoostProjectConfig = $(call GenerateBuildPaths,project-config.jam)
BoostBjamFiles = \
bjam \
boost-build.jam
BoostBjamFilesSourcePath = $(BuildDirectory)
BoostBjamFilesResultPaths = $(call GenerateResultPaths,,$(BoostBjamFiles))
BoostBjamToolsSourcePath = $(call GenerateBuildPaths,tools)
BoostBjamToolsResultPath = $(call GenerateResultPaths,,tools)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/LICENSE_1_0.txt: source
$(PackageLicenseFile): $(PackageSourceDir)/LICENSE_1_0.txt
$(copy-result)
# Extract the source from the archive and apply patches, if any.
$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths) | $(BuildDirectory)
$(call expand-archive,$(PackageArchive),$(BuildDirectory))
$(call patch-directory,$(@),$(PackagePatchArgs),$(PackagePatchPaths))
$(Verbose)touch $(@)
# Prepare the sources.
.PHONY: source
source: | $(PackageSourceDir)
# Patch the sources, if necessary.
.PHONY: patch
patch: source
# Generate the package build makefile.
$(BoostConfigure): | $(PackageSourceDir) $(BuildDirectory)
$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
# Generate the build-specific makefile and user configuration. We have
# to post-process the generated user configuration since Boost's
# adominable build system has no other way to override the actual C++
# compiler executable used (see http://goodliffe.blogspot.com/2008/05/
# cross-compiling-boost.html and boost/docs/html/bbv2/
# tasks.html#bbv2.tasks.crosscompile).
$(BoostProjectConfig): $(BoostConfigure)
$(Verbose)cd $(BuildDirectory) && \
./bootstrap.sh \
--prefix=$(ResultDirectory) \
--with-toolset=$(BoostToolset) \
--with-icu=$(ICUSearchPath) \
--with-libraries=$(BoostLibrariesList) \
--with-python-root=$(PythonPath)
$(Verbose)$(SED) -e "s#^\([[:space:]]*using\)[[:space:]]\{1,\}\($(BoostToolset)\)[[:space:]]\{1,\};#\1 \2 : $(TargetProcArch) : $(CXX) $(CPPOPTFLAGS) ;#g" \
< $(@) > $(@).N || $(RM) -f $(@)
$(Verbose)mv -f $(@) $(@).O
$(Verbose)mv -f $(@).N $(@)
# Configure the source for building.
.PHONY: configure
configure: source $(BoostProjectConfig)
# Build the source.
.PHONY: build
build: configure
$(Verbose)cd $(BuildDirectory) && \
./bjam $(BoostJamConfig)
# Stage the build to a temporary installation area.
.PHONY: stage
stage: stage-boost stage-bjam
stage-boost: build | $(ResultDirectory)
$(Verbose)cd $(BuildDirectory) && \
./bjam $(BoostJamConfig) \
install --prefix=$(ResultDirectory)
.PHONY: stage-bjam
stage-bjam: $(BoostBjamFilesResultPaths) $(BoostBjamToolsResultPath)
$(BoostBjamToolsResultPath): $(BoostBjamToolsSourcePath)
cp -rf $(BoostBjamToolsSourcePath) $(BoostBjamToolsResultPath)
$(BoostBjamFilesResultPaths): $(call GenerateResultPaths,,%): $(call Slashify,$(BoostBjamFilesSourcePath))%
$(install-result)
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)/*
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)/*
include post.mak