Igor Sarkisov | fc43e55 | 2020-10-01 13:59:27 -0700 | [diff] [blame^] | 1 | # |
| 2 | # Copyright (c) 2010-2011 Nest, Inc. |
| 3 | # All rights reserved. |
| 4 | # |
| 5 | # This document is the property of Nest. It is considered |
| 6 | # confidential and proprietary information. |
| 7 | # |
| 8 | # This document may not be reproduced or transmitted in any form, |
| 9 | # in whole or in part, without the express written permission of |
| 10 | # Nest. |
| 11 | # |
| 12 | # Description: |
| 13 | # This file is the makefile for the POSIX.1e superuser |
| 14 | # capabilities detection library. |
| 15 | # |
| 16 | |
| 17 | BuildConfigSpecialized := No |
| 18 | BuildProductSpecialized := No |
| 19 | |
| 20 | include pre.mak |
| 21 | |
| 22 | PackageName := libcap |
| 23 | |
| 24 | PackageExtension := tar.gz |
| 25 | PackageSeparator := - |
| 26 | |
| 27 | PackagePatchArgs := -p1 |
| 28 | |
| 29 | PackageArchive := $(PackageName).$(PackageExtension) |
| 30 | PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion) |
| 31 | |
| 32 | PackageBuildMakefile = $(call GenerateBuildPaths,Makefile) |
| 33 | |
| 34 | CleanPaths += $(PackageLicenseFile) |
| 35 | |
| 36 | LinuxHeaderDir := $(call GenerateResultPaths,sw/tps/linux,include) |
| 37 | |
| 38 | all: $(PackageDefaultGoal) |
| 39 | |
| 40 | # Generate the package license contents. |
| 41 | |
| 42 | $(PackageSourceDir)/License: source |
| 43 | |
| 44 | $(PackageLicenseFile): $(PackageSourceDir)/License |
| 45 | $(copy-result) |
| 46 | |
| 47 | # Extract the source from the archive and apply patches, if any. |
| 48 | |
| 49 | $(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths) |
| 50 | $(expand-and-patch-package) |
| 51 | |
| 52 | # Prepare the sources. |
| 53 | |
| 54 | .PHONY: source |
| 55 | source: | $(PackageSourceDir) |
| 56 | |
| 57 | # Patch the sources, if necessary. |
| 58 | |
| 59 | .PHONY: patch |
| 60 | patch: source |
| 61 | |
| 62 | # Generate the package build makefile. |
| 63 | |
| 64 | $(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory) |
| 65 | $(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory)) |
| 66 | |
| 67 | # Configure the source for building. |
| 68 | |
| 69 | .PHONY: configure |
| 70 | configure: source $(PackageBuildMakefile) |
| 71 | |
| 72 | # Build the source. |
| 73 | # |
| 74 | # We have to unset MAKEFLAGS since they confuse the package build otherwise. |
| 75 | |
| 76 | .PHONY: build |
| 77 | build: configure | $(BuildDirectory) |
| 78 | $(Verbose)unset MAKEFLAGS && \ |
| 79 | $(MAKE) -C $(BuildDirectory) \ |
| 80 | BUILD_CC=gcc \ |
| 81 | CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \ |
| 82 | LIBATTR=no \ |
| 83 | KERNEL_HEADERS=$(LinuxHeaderDir) \ |
| 84 | all |
| 85 | |
| 86 | # Stage the build to a temporary installation area. |
| 87 | # |
| 88 | # We have to unset MAKEFLAGS since they confuse the package build otherwise. |
| 89 | |
| 90 | .PHONY: stage |
| 91 | stage: build | $(ResultDirectory) |
| 92 | $(Verbose)unset MAKEFLAGS && \ |
| 93 | $(MAKE) -C $(BuildDirectory) \ |
| 94 | BUILD_CC=gcc \ |
| 95 | CC=$(CC) AR=$(AR) RANLIB=$(RANLIB) STRIP=$(STRIP) \ |
| 96 | LIBATTR=no \ |
| 97 | FAKEROOT=$(ResultDirectory) \ |
| 98 | KERNEL_HEADERS=$(LinuxHeaderDir) \ |
| 99 | install |
| 100 | |
| 101 | clean: |
| 102 | $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir) |
| 103 | $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory) |
| 104 | $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory) |
| 105 | |
| 106 | include post.mak |