1# 2# Copyright 2017 Nest Labs Inc. All Rights Reserved. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17# 18# Description: 19# This make file supports generating prebuilt architecture 20# -independent and -dependent distributions of nlbuild-autotools 21# binaries for the architeture of the current build host. 22# 23 24include ../Common.mak 25 26# 27# Build directories 28# 29 30builddir := . 31top_builddir := .. 32abs_builddir := $(CURDIR) 33abs_top_builddir := $(abspath $(top_builddir)) 34 35# 36# Source directories 37# 38 39srcdir := . 40top_srcdir := .. 41abs_srcdir := $(CURDIR) 42abs_top_srcdir := $(abspath $(top_srcdir)) 43 44# Figure out what sort of build host we are running on, stripping off 45# any trailing version number information typically included on Darwin 46# / Mac OS X. 47 48host := $(shell $(top_srcdir)/third_party/autoconf/config.guess | $(SED) -e 's/[[:digit:].]*$$//g') 49 50distdir = $(PACKAGE)-$(VERSION) 51 52dist_tgz_TARGETS = ${top_builddir}/${PACKAGE}-common-$(VERSION)$(TGZ_EXTENSION) \ 53 ${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TGZ_EXTENSION) 54 55dist_txz_TARGETS = ${top_builddir}/${PACKAGE}-common-$(VERSION)$(TXZ_EXTENSION) \ 56 ${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TXZ_EXTENSION) 57 58dist_common_DIRS = share include 59dist_arch_DIRS = $(host) 60 61PACKAGE_VERSION = $(shell $(CAT) $(top_builddir)/.local-version) 62 63VERSION = $(PACKAGE_VERSION) 64 65DIST_TMPDIR := $(shell mktemp -u -d /tmp/tmp.$(PACKAGE)-$(VERSION)XXXXXX) 66TOOLS_TMPDIR := $(shell mktemp -u -d /tmp/tmp.$(PACKAGE)-$(VERSION)XXXXXX) 67 68# 69# Verbosity 70# 71_NL_V_BUILD = $(_NL_V_BUILD_$(V)) 72_NL_V_BUILD_ = $(_NL_V_BUILD_$(NL_DEFAULT_VERBOSITY)) 73_NL_V_BUILD_0 = @echo " BUILD"; 74_NL_V_BUILD_1 = 75 76dist-tgz: $(dist_tgz_TARGETS) 77 78dist-txz: $(dist_txz_TARGETS) 79 80# 81# Produce prebuilt GNU autotools binaries for the architecture of the 82# current build machine and install them in this nlbuild-autotools 83# package. 84# 85tools: 86 $(call nl-remove-dir,$(TOOLS_TMPDIR)) 87 $(call nl-create-dir,$(TOOLS_TMPDIR)) 88 $(_NL_V_BUILD)${srcdir}/packages/build --arch ${host} --srcdir ${abs_srcdir}/packages --builddir "${TOOLS_TMPDIR}" --destdir "${abs_top_srcdir}/tools/host" 89 $(call nl-remove-dir,$(TOOLS_TMPDIR)) 90 91# 92# Produce prebuilt GNU autotools architecture-dependent and -independent 93# binaries for the architecture of the current build machine and package 94# them up for distribution. 95# 96dist toolsdist: $(DIST_TARGETS) 97 $(call nl-remove-dir,$(DIST_TMPDIR)) 98 99# 100# Stage the distribution files to a distribution directory 101# 102stage: 103 $(call nl-remove-dir,$(DIST_TMPDIR)) 104 $(call nl-create-dir,$(DIST_TMPDIR)) 105 $(_NL_V_BUILD)${srcdir}/packages/build --arch ${host} --srcdir ${abs_srcdir}/packages --builddir "${DIST_TMPDIR}" --destdir "${DIST_TMPDIR}" 106 107# 108# Produce prebuilt GNU autotools architecture-independent binaries for 109# the architecture of the current build machine and package them up 110# for distribution in tar-gzip format. 111# 112${top_builddir}/${PACKAGE}-common-$(VERSION)$(TGZ_EXTENSION): stage 113 $(NL_V_TGZ)$(dist_tgz_ARCHIVE) --directory ${DIST_TMPDIR} $(dist_common_DIRS) | $(dist_tgz_COMPRESS) > "$(@)" 114 115# 116# Produce prebuilt GNU autotools architecture-dependent binaries for 117# the architecture of the current build machine and package them up 118# for distribution in tar-gzip format. 119# 120${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TGZ_EXTENSION): stage 121 $(NL_V_TGZ)$(dist_tgz_ARCHIVE) --directory ${DIST_TMPDIR} $(dist_arch_DIRS) | $(dist_tgz_COMPRESS) > "$(@)" 122 123# 124# Produce prebuilt GNU autotools architecture-independent binaries for 125# the architecture of the current build machine and package them up 126# for distribution in tar-xz format. 127# 128${top_builddir}/${PACKAGE}-common-$(VERSION)$(TXZ_EXTENSION): stage 129 $(NL_V_TXZ)$(dist_txz_ARCHIVE) --directory ${DIST_TMPDIR} $(dist_common_DIRS) | $(dist_txz_COMPRESS) > "$(@)" 130 131# 132# Produce prebuilt GNU autotools architecture-dependent binaries for 133# the architecture of the current build machine and package them up 134# for distribution in tar-xz format. 135# 136${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TXZ_EXTENSION): stage 137 $(NL_V_TXZ)$(dist_txz_ARCHIVE) --directory ${DIST_TMPDIR} $(dist_arch_DIRS) | $(dist_txz_COMPRESS) > "$(@)" 138 139clean: clean-local 140