blob: 39db634ca22ed51ba846ef5f7f8a946b1a5eb1df [file] [log] [blame]
#
# Copyright (c) 2010 Nest Labs, Inc.
# All rights reserved.
#
# This document is the property of Nest Labs. 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 Labs.
#
# Description:
# This file is the make file for X-Loader, an initial program
# loader (IPL) for embedded boards based on Texas Instruments
# OMAP processors.
#
include pre.mak
PackageRoot := .
PackageName := x-loader
PackageSeparator :=
PackageVersion :=
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildMakefile = $(call GenerateBuildPaths,include/config.mk)
CleanPaths += $(PackageLicenseFile)
SOURCEDIRS = $(PackageSourceDir)
$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/README: $(BuildDirectory)/source
$(PackageLicenseFile): $(PackageSourceDir)/README
$(Echo) "Extracting \"$(call GenerateBuildRootEllipsedPath,$(@))\""
$(Verbose)$(SED) -n -e '10,25p' < $< > $@
# We are building this package from version-controller source, so
# there is nothing to do for this target goal.
$(PackageSourceDir):
# Prepare the sources.
$(BuildDirectory)/source: | $(PackageSourceDir)
$(Verbose)touch $@
# Patch the sources, if necessary.
$(BuildDirectory)/patch: $(BuildDirectory)/source
$(Verbose)touch $@
# X-Loader has no way of explicitly setting CC, LD, OBJCOPY, et al and
# instead relies on the value of CROSS_COMPILE. Consequently, we have
# to ensure that 'ToolBinDir' is in 'PATH' so that the kernel build
# infrastructure can find $(CROSS_COMPILE)gcc, $(CROSS_COMPILE)ld, et al.
$(BuildDirectory)/configure $(BuildDirectory)/build $(BuildDirectory)/stage: PATH := $(PATH):$(ToolBinDir)
$(BuildDirectory)/configure $(BuildDirectory)/build $(BuildDirectory)/stage: CROSS_COMPILE := $(CCACHE) $(CROSS_COMPILE)
# Generate the package build makefile.
# Configure the source for building.
$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory)
$(Verbose)unset MAKEFLAGS && \
$(MAKE) $(JOBSFLAG) -C $(PackageSourceDir) O=$(CURDIR)/$(BuildDirectory) \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
$(XLoaderProductionConfig)
$(Verbose)touch $@
# Build the source.
$(BuildDirectory)/build: $(BuildDirectory)/configure
$(Verbose)unset MAKEFLAGS && \
$(MAKE) $(JOBSFLAG) -C $(PackageSourceDir) O=$(CURDIR)/$(BuildDirectory) \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
all
$(Verbose)touch $@
# Stage the build to a temporary installation area.
#
# X-Loader does not support a notion of installing, so we have to
# cherry-pick the components we want from the build directory and
# copy/install them to the results directory.
$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
$(Verbose)cp -f $(wildcard $(call GenerateBuildPaths,x-load*)) $(ResultDirectory)
$(Verbose)cp -f $(call GenerateBuildPaths,System.map) $(ResultDirectory)
$(Verbose)touch $@
.PHONY: stage
stage: $(BuildDirectory)/stage
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak