blob: 01718abea338d52ef34efea9c7038cf52ebba029 [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 Memory Technology Devices
# (MTD) utilities.
#
BuildConfigSpecialized := No
BuildProductSpecialized := No
include pre.mak
PackageName := mtd-utils
PackageExtension := tar.bz2
PackageSeparator := -
PackagePatchArgs := -p1
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
CleanPaths += $(PackageLicenseFile)
LzoDir := sw/tps/lzo
LzoIncDir = $(call GenerateResultPaths,$(LzoDir),usr/include)
LzoLibDir = $(call GenerateResultPaths,$(LzoDir),usr/lib)
UUIDDir := sw/tps/e2fsprogs
UUIDIncDir = $(call GenerateResultPaths,$(UUIDDir),usr/include)
UUIDLibDir = $(call GenerateResultPaths,$(UUIDDir),usr/lib)
ZlibDir := sw/tps/zlib
ZlibIncDir = $(call GenerateResultPaths,$(ZlibDir),usr/include)
ZlibLibDir = $(call GenerateResultPaths,$(ZlibDir),usr/lib)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageSourceDir)/COPYING: source
$(PackageLicenseFile): $(PackageSourceDir)/COPYING
$(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
# Configure the source for building.
.PHONY: configure
configure: source
# Build the source.
.PHONY: build
build: configure
$(Verbose)cd $(PackageSourceDir) && \
$(MAKE) \
WITHOUT_XATTR=1 CC=$(CC) \
LZOCPPFLAGS=-I$(LzoIncDir) \
LZOLDFLAGS=-L$(LzoLibDir) \
UUIDCPPFLAGS=-I$(UUIDIncDir) \
UUIDLDFLAGS=-L$(UUIDLibDir) \
ZLIBCPPFLAGS=-I$(ZlibIncDir) \
ZLIBLDFLAGS=-L$(ZlibLibDir) \
BUILDDIR=$(CURDIR)/$(BuildDirectory) \
all
# Stage the build to a temporary installation area.
.PHONY: stage
stage: build | $(ResultDirectory)
$(Verbose)cd $(PackageSourceDir) && \
$(MAKE) \
WITHOUT_XATTR=1 CC=$(CC) \
LZOCFLAGS=-I$(LzoIncDir) \
LZOLDFLAGS=-L$(LzoLibDir) \
UUIDCPPFLAGS=-I$(UUIDIncDir) \
UUIDLDFLAGS=-L$(UUIDLibDir) \
ZLIBCFLAGS=-I$(ZlibIncDir) \
ZLIBLDFLAGS=-L$(ZlibLibDir) \
BUILDDIR=$(CURDIR)/$(BuildDirectory) \
DESTDIR=$(ResultDirectory) \
install
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak