blob: c0ff34c43e6f0410a09ce9afa73995d89113e310 [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 embedded Linux "Swiss Army Knife"
# application, BusyBox.
#
include pre.mak
PackageName := busybox
PackageExtension := tar.bz2
PackageSeparator := -
PackagePatchArgs := -p1
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
CleanPaths += $(PackageLicenseFile)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/LICENSE: source
$(PackageLicenseFile): $(PackageSourceDir)/LICENSE
$(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
# BusyBox 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 and default configuration based
# on the build configuration.
$(PackageBuildMakefile): $(CURDIR)/configs/$(BuildConfig)_defconfig | $(PackageSourceDir) $(BuildDirectory)
$(Verbose)$(MAKE) -C $(PackageSourceDir) O=$(CURDIR)/$(BuildDirectory) $<
# Configure the source for building.
.PHONY: configure
configure: source $(PackageBuildMakefile)
# Build the source.
.PHONY: build
build: configure
$(Verbose)$(MAKE) -C $(BuildDirectory) busybox
# Stage the build to a temporary installation area.
.PHONY: stage
stage: build | $(ResultDirectory)
$(Verbose)$(MAKE) -C $(BuildDirectory) CONFIG_PREFIX=$(ResultDirectory) install
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak