blob: 9d6aa8a9ff5ba1aa712d6dd6b78f34791cd2cf8c [file] [log] [blame] [edit]
#
# 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 "list open files" (lsof) utility.
#
include pre.mak
PackageName := lsof
PackageExtension := tar.bz2
PackageSeparator := _
PackagePatchArgs := -g 0 -p2
PackageArchive := $(PackageName).$(PackageExtension)
PackageWrapperDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageSourceArchive := $(PackageWrapperDir)/$(PackageName)$(PackageSeparator)$(PackageVersion)$(PackageSeparator)src.tar
PackageSourceDir := $(PackageWrapperDir)/$(PackageName)$(PackageSeparator)$(PackageVersion)$(PackageSeparator)src
PackageBuildMakefile = $(call GenerateBuildPaths,Configure)
CleanPaths += $(PackageLicenseFile)
SOURCEDIRS = $(PackageSourceDir)
$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
all: $(PackageDefaultGoal)
# Expand the wrapper directory which contains another archive
# containing the source.
$(PackageSourceArchive): $(PackageArchive)
$(call expand-archive,$(<),.)
$(Verbose)touch $(@)
# Generate the package license contents.
$(PackageSourceDir)/00README: $(BuildDirectory)/source
$(PackageLicenseFile): $(PackageSourceDir)/00README
$(Verbose)$(SED) -n -e '/^License$$/,/\*\/$$/{;p;/\*\/$$/q;}' < $< > $@
# Extract the source from the archive and apply patches, if any.
$(PackageSourceDir): $(PackageSourceArchive) $(PackagePatchPaths)
$(call expand-archive,$(<),$(PackageWrapperDir))
$(Verbose)touch $(@)
$(call patch-directory,$(@),$(PackagePatchArgs),$(PackagePatchPaths))
# Prepare the sources.
$(BuildDirectory)/source: | $(PackageSourceDir)
$(Verbose)touch $@
# Patch the sources, if necessary.
$(BuildDirectory)/patch: $(BuildDirectory)/source
$(Verbose)touch $@
# Generate the package build makefile.
$(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory)
$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
# Configure the source for building.
$(BuildDirectory)/configure: $(BuildDirectory)/source $(PackageBuildMakefile)
$(Verbose)cd $(BuildDirectory) && \
LSOF_CC="$(CC) $(CPPOPTFLAGS)" \
LINUX_CLIB="-DGLIBCV=211" \
LSOF_INCLUDE="$(LinuxIncludePath)" \
LINUX_INCL="$(LinuxIncludePath)" \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
./Configure \
-n \
$(TargetOS)
$(Verbose)touch $@
# Build the source.
#
# We have to unset MAKEFLAGS since they confuse the package build otherwise.
$(BuildDirectory)/build: $(BuildDirectory)/configure
$(Verbose)unset MAKEFLAGS && \
$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
all
$(Verbose)touch $@
# Stage the build to a temporary installation area.
#
# We have to unset MAKEFLAGS since they confuse the package build otherwise.
$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
$(Verbose)unset MAKEFLAGS && \
$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
DESTDIR=$(ResultDirectory) \
install
$(Verbose)touch $@
.PHONY: stage
stage: $(BuildDirectory)/stage
clean:
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageWrapperDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak