blob: d89d0e1b878b0d55f05f33d4d1e32ac3a01b6f9c [file] [log] [blame]
# Copyright (c) 2015 Nest Labs, 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 building LTTng kernel module.
include pre.mak
include products/paths.mak
PackageName := lttng-modules
PackageExtension := tar.bz2
PackageSeparator := -
PackagePatchArgs := -p1
PackageArchive := $(PackageName).$(PackageExtension)
PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
PackageBuildReadmeFile := $(call GenerateBuildPaths,
CleanPaths += $(PackageLicenseFile)
all: $(PackageDefaultGoal)
# Generate the package license contents.
$(PackageLicenseFile): $(PackageSourceDir)/LICENSE
# Extract the source from the archive and apply patches, if any.
$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
$(call expand-archive,$(PackageArchive),.)
$(Verbose)touch $(@)
$(call patch-directory,$(@),$(PackagePatchArgs),$(PackagePatchPaths))
# Prepare the sources.
.PHONY: source
source: | $(PackageSourceDir)
# Patch the sources, if necessary.
.PHONY: patch
patch: source
# Clone the source tree.
$(PackageBuildReadmeFile): | $(PackageSourceDir) $(BuildDirectory)
$(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory))
# Configure the source for building.
.PHONY: configure
configure: source $(PackageBuildReadmeFile)
# Build the source.
# We have to unset MAKEFLAGS since they confuse the package build otherwise.
# This package 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 build infrastructure can
# find $(CROSS_COMPILE)gcc, $(CROSS_COMPILE)ld, et al.
build stage: PATH := $(PATH):$(ToolBinDir)
.PHONY: build
build: configure | $(BuildDirectory)
$(Verbose)unset MAKEFLAGS && \
$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
ARCH=$(LinuxProductArch) \
# Stage the build to a temporary installation area.
.PHONY: stage
stage: build | $(ResultDirectory)
$(Verbose)unset MAKEFLAGS && \
$(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
ARCH=$(LinuxProductArch) \
KERNELDIR=$(LinuxBuildDir) \
"INSTALL_MOD_DIR=extras/" \
"INSTALL_MOD_PATH=$(LinuxResultsPath)" \
$(Verbose)$(RM) $(RMFLAGS) -r $(PackageWrapperDir)
$(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
$(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
include post.mak