| # | |
| # 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,README.md) | |
| CleanPaths += $(PackageLicenseFile) | |
| SOURCEDIRS = $(PackageSourceDir) | |
| $(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure | |
| all: $(PackageDefaultGoal) | |
| # Generate the package license contents. | |
| $(PackageLicenseFile): $(PackageSourceDir)/LICENSE | |
| $(copy-result) | |
| # 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. | |
| $(BuildDirectory)/source: | $(PackageSourceDir) | |
| $(Verbose)touch $@ | |
| # Patch the sources, if necessary. | |
| $(BuildDirectory)/patch: $(BuildDirectory)/source | |
| $(Verbose)touch $@ | |
| # Clone the source tree. | |
| $(PackageBuildReadmeFile): | $(PackageSourceDir) $(BuildDirectory) | |
| $(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory)) | |
| # Configure the source for building. | |
| $(BuildDirectory)/configure: $(BuildDirectory)/source $(PackageBuildReadmeFile) | |
| $(Verbose)touch $@ | |
| # 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. | |
| $(BuildDirectory)/build $(BuildDirectory)/stage: PATH := $(PATH):$(ToolBinDir) | |
| $(BuildDirectory)/build: $(BuildDirectory)/configure $(LinuxBuildDir)/build | $(BuildDirectory) | |
| $(Verbose)unset MAKEFLAGS && \ | |
| $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \ | |
| ARCH=$(LinuxProductArch) \ | |
| KERNELDIR=$(LinuxBuildDir) | |
| $(Verbose)touch $@ | |
| # Stage the build to a temporary installation area. | |
| $(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory) | |
| $(Verbose)unset MAKEFLAGS && \ | |
| $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \ | |
| ARCH=$(LinuxProductArch) \ | |
| KERNELDIR=$(LinuxBuildDir) \ | |
| "INSTALL_MOD_DIR=extras/" \ | |
| "INSTALL_MOD_PATH=$(LinuxResultsPath)" \ | |
| DEPMOD=$(DEPMOD) \ | |
| modules_install | |
| $(Verbose)touch $@ | |
| .PHONY: stage | |
| stage: $(BuildDirectory)/stage | |
| clean: | |
| $(Verbose)$(RM) $(RMFLAGS) -r $(PackageWrapperDir) | |
| $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory) | |
| $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory) | |
| include post.mak |