| # |
| # 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 := $(PackageRoot)/$(PackageName)$(PackageSeparator)$(PackageVersion) |
| |
| PackageBuildMakefile = $(call GenerateBuildPaths,include/config.mk) |
| |
| CleanPaths += $(PackageLicenseFile) |
| |
| all: $(PackageDefaultGoal) |
| |
| # Generate the package license contents. |
| |
| $(PackageSourceDir)/README: 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. |
| |
| .PHONY: source |
| source: | $(PackageSourceDir) |
| |
| # Patch the sources, if necessary. |
| |
| .PHONY: patch |
| patch: source |
| |
| # 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. |
| |
| configure build stage: PATH := $(PATH):$(ToolBinDir) |
| |
| # Generate the package build makefile. |
| |
| $(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory) |
| $(Verbose)unset MAKEFLAGS && \ |
| $(MAKE) -C $(PackageSourceDir) O=$(CURDIR)/$(BuildDirectory) \ |
| $(XLoaderProductionConfig) |
| |
| # Configure the source for building. |
| |
| .PHONY: configure |
| configure: source $(PackageBuildMakefile) |
| |
| # Build the source. |
| |
| .PHONY: build |
| build: configure |
| $(Verbose)unset MAKEFLAGS && \ |
| $(MAKE) -C $(PackageSourceDir) O=$(CURDIR)/$(BuildDirectory) \ |
| all |
| |
| # 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. |
| |
| .PHONY: stage |
| stage: copy |
| |
| .PHONY: copy |
| $(call GenerateResultPaths,fw/x-loader,x-load.bin) copy: build | $(ResultDirectory) |
| $(Verbose)cp -f $(wildcard $(call GenerateBuildPaths,x-load*)) $(ResultDirectory) |
| $(Verbose)cp -f $(call GenerateBuildPaths,System.map) $(ResultDirectory) |
| |
| clean: |
| $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory) |
| $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory) |
| |
| include post.mak |