| # |
| # Copyright (c) 2017 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 protobuf makefile for the host. On a cross compile |
| # we need to build protoc for the host that we can auto-generate source |
| # code from the proto files. |
| # |
| |
| ifneq ($(BUILD_FEATURE_SIMULATOR),1) |
| override BuildProduct := diamondsim |
| SaveBuildMode := $(BuildMode) |
| override BuildMode := snapshot |
| endif |
| |
| include pre.mak |
| |
| PackageName := protobuf |
| |
| PackageExtension := tar.gz |
| PackageSeparator := - |
| |
| PackagePatchArgs := -p1 |
| |
| PackageArchive := $(PackageName).$(PackageExtension) |
| PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion) |
| |
| PackageBuildMakefile = $(call GenerateBuildPaths,Makefile) |
| |
| PackageResultPath = $(call GenerateResultPaths,,usr) |
| |
| PackageBuildSrcDir = $(ProtobufSourcesPath)/$(BuildBaseDirectory)/Makefile.host/$(ConditionalBuildTuple)/src |
| |
| CleanPaths += $(PackageLicenseFile) |
| |
| SOURCEDIRS = $(PackageSourceDir) |
| $(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure_empty |
| |
| ifeq ($(call IsYes,$(ForceLibStdCPP)),Y) |
| CLANGCXXFLAGS = -stdlib=libstdc++ |
| endif |
| |
| all: $(PackageDefaultGoal) |
| |
| $(ResultDirectory)/lib: |
| $(create-directory) |
| |
| $(ResultDirectory)/include: |
| $(create-directory) |
| |
| # Generate the package license contents. |
| |
| $(PackageSourceDir)/COPYING: source |
| |
| $(PackageLicenseFile): $(PackageSourceDir)/COPYING |
| $(copy-result) |
| |
| # Extract the source from the archive and apply patches, if any. |
| |
| $(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths) |
| $(expand-and-patch-package) |
| |
| # Prepare the sources. |
| |
| .PHONY: source |
| source: $(BuildDirectory)/source_empty |
| $(BuildDirectory)/source_empty: | $(PackageSourceDir) $(BuildDirectory) |
| $(Verbose)touch $@ |
| |
| .PHONY: patch |
| patch: $(BuildDirectory)/patch_empty |
| $(BuildDirectory)/patch_empty: $(BuildDirectory)/source_empty | $(BuildDirectory) |
| $(Verbose)touch $@ |
| |
| $(PackageBuildMakefile): | $(PackageSourceDir) $(BuildDirectory) |
| $(call create-links,$(CURDIR)/$(PackageSourceDir),$(BuildDirectory)) |
| |
| # I had to add CLANGCXXFLAGS directly to CXX because the atrocious protobuf configure script |
| # fails to pass LD and LDFLAGS to the makefile for linking. We need this flags since we're |
| # linking against C++ on darwin. Uggghhh. |
| .PHONY: configure |
| configure: $(BuildDirectory)/configure_empty |
| $(BuildDirectory)/configure_empty: $(BuildDirectory)/source_empty $(PackageBuildMakefile) | $(BuildDirectory) |
| $(Verbose)cd $(BuildDirectory) && \ |
| $(CURDIR)/$(PackageSourceDir)/configure \ |
| CC="$(CC) $(CPPOPTFLAGS)" CXX="$(CXX) $(CPPOPTFLAGS) $(CLANGCXXFLAGS)" AR="$(AR)" RANLIB="$(RANLIB)" STRIP="$(STRIP)" \ |
| INSTALL="$(INSTALL) $(INSTALLFLAGS)" \ |
| --build=$(HostTuple) \ |
| --host=$(TargetTuple) \ |
| --prefix=$(PackageResultPath) \ |
| --sysconfdir=/etc \ |
| --localstatedir=/var \ |
| --enable-static=no \ |
| --enable-shared=yes \ |
| --without-zlib |
| $(Verbose)touch $@ |
| |
| .PHONY: build |
| build: $(BuildDirectory)/build_empty |
| $(BuildDirectory)/build_empty: $(BuildDirectory)/configure_empty | $(BuildDirectory) |
| $(Verbose)unset MAKEFLAGS && \ |
| $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \ |
| all |
| $(Verbose)touch $@ |
| |
| .PHONY: stage |
| stage: $(BuildDirectory)/stage_empty |
| $(BuildDirectory)/stage_empty: $(BuildDirectory)/build_empty | $(ResultDirectory) $(BuildDirectory) |
| $(Verbose)unset MAKEFLAGS && \ |
| $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \ |
| install |
| $(Verbose)touch $@ |
| |
| clean: |
| $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir) |
| $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory) |
| $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory) |
| |
| include post.mak |
| |
| ifneq ($(BUILD_FEATURE_SIMULATOR),1) |
| override BuildMode := $(SaveBuildMode) |
| endif |