blob: ff63a16e536ff6d7e39a027cbcb047cec2e62b63 [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:
# This file is the makefile for the International Components for
# Unicode (ICU) library.
#
# We only use this in the simulator, so host=target
#
include pre.mak
ICUDataConfSUFFIX := local.mk
ICUDataConfSTEMS := brkitr/brk \
brkitr/brs \
coll/col \
curr/res \
lang/res \
locales/res \
misc/misc \
rbnf/rbnf \
region/res \
sprep/sprep \
translit/trns \
mappings/ucm \
zone/res
ICUDataConfFiles = $(addsuffix $(ICUDataConfSUFFIX),$(ICUDataConfSTEMS))
ICUDataConfSourceDir := ./configs
ICUDataConfSourcePaths = $(addprefix $(call Slashify,$(ICUDataConfSourceDir)),$(ICUDataConfFiles))
ICUDataConfBuildDir = $(BuildDirectory)/data
ICUDataConfBuildPaths = $(addprefix $(call Slashify,$(ICUDataConfBuildDir)),$(ICUDataConfFiles))
ICUDataConfMaybeSourcePaths = $(wildcard $(ICUDataConfSourcePaths))
ICUDataConfMaybeFiles = $(subst $(call Slashify,$(ICUDataConfSourceDir)),,$(ICUDataConfMaybeSourcePaths))
ICUDataConfMaybeBuildPaths = $(addprefix $(call Slashify,$(ICUDataConfBuildDir)),$(ICUDataConfMaybeFiles))
$(ICUDataConfMaybeBuildPaths): $(ICUDataConfBuildDir)/%: $(ICUDataConfSourceDir)/%
$(Echo) "Creating ICUDataConfMaybeBuildPaths \"$(call GenerateBuildRootEllipsedPath,$(@D))\""
$(Verbose)$(MKDIR) $(MKDIRFLAGS) $(@D)
$(copy-result)
# Ensure that the static implicit pattern rule above doesn't become
# the default target goal. Instead, use the usual default, 'all'.
.DEFAULT_GOAL := all
PackageName := icu
PackageExtension := tar.gz
PackageSeparator := -
PackagePatchArgs := -p1
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(call GenerateBuildPaths,$(PackageName))
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
CleanPaths += $(PackageLicenseFile)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/license.html: source
$(PackageLicenseFile): $(PackageSourceDir)/license.html
$(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
PackageConfigFlags =
# The host config of OSM requires shared libraries.
ifneq ($(CONFIG_OSM_HOST),1)
PackageConfigFlags += --disable-shared --enable-static
endif
# Generate the package build makefile.
$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory) $(ResultDirectory)
$(Verbose)cd $(BuildDirectory) && \
$(CURDIR)/$(PackageSourceDir)/source/configure \
CC="$(CC)" CXX="$(CXX)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) STRIP=$(STRIP) \
$(PackageConfigFlags) \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var
# Configure the source for building.
$(ICUDataConfMaybeBuildPaths): | $(BuildDirectory)
.PHONY: configure
configure: source $(ICUDataConfMaybeBuildPaths) $(PackageBuildMakefile)
# Build the source.
#
# We have to unset MAKEFLAGS since icu's Makefile relies on being
# able to set a different path to find tools during the build.
.PHONY: build
build: configure
$(Verbose)unset MAKEFLAGS && \
$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) all
# Stage the build to a temporary installation area.
#
# We have to unset MAKEFLAGS since icu's Makefile relies on being
# able to set a different path to find tools during the build.
.PHONY: stage
stage: build | $(ResultDirectory)
$(Verbose)unset MAKEFLAGS && \
$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) DESTDIR=$(ResultDirectory) install
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildBaseDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak