blob: c6fd9c80948d3a3fabc03f858d968eb9546689a0 [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 make file for, devmem2, a simple program to
# read/write from/to any location in memory.
#
BuildConfigSpecialized := No
BuildProductSpecialized := No
include pre.mak
PackageName := devmem2
PackageExtension :=
PackageSeparator := -
PackagePatchArgs := -p1
PackageSourceFile := devmem2.c
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildMakefile = $(call GenerateBuildPaths,Makefile)
CleanPaths += $(PackageLicenseFile)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageLicenseFile): $(PackageSourceFile)
$(Echo) "Extracting \"$(call GenerateBuildRootEllipsedPath,$(@))\""
$(Verbose)$(SED) -n -e '14,26p' < $< > $@
# Copy the package source and apply patches, if any.
$(PackageSourceDir): $(PackageSourceFile) $(PackagePatchPaths)
$(create-directory)
$(Verbose)cp -f $(PackageSourceFile) $@/$(PackageSourceFile)
$(Verbose)touch $@
$(call patch-directory,$(@),$(PackagePatchArgs),$(PackagePatchPaths))
# Prepare the sources.
.PHONY: source
source: | $(PackageSourceDir)
# Patch the sources, if necessary.
.PHONY: patch
patch: source
$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory)
$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
# Configure the source for building.
.PHONY: configure
configure: source $(PackageBuildMakefile)
# Build the source.
.PHONY: build
build: configure
$(Verbose)$(MAKE) -C $(BuildDirectory) \
CC=$(CC) CXX=$(CXX) AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \
DESTDIR=$(ResultDirectory) \
all
# Stage the build to a temporary installation area.
.PHONY: stage
stage: build | $(ResultDirectory)
$(Verbose)$(MAKE) -C $(BuildDirectory) \
DESTDIR=$(ResultDirectory) \
install
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak