2 # Copyright 2017 Nest Labs Inc. All Rights Reserved.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
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.
32 abs_builddir := $(CURDIR)
33 abs_top_builddir := $(abspath $(top_builddir))
41 abs_srcdir := $(CURDIR)
42 abs_top_srcdir := $(abspath $(top_srcdir))
44 # Figure out what sort of build host we are running on, stripping off
45 # any trailing version number information typically included on Darwin
48 host := $(shell $(top_srcdir)/third_party/autoconf/config.guess | $(SED) -e 's/[[:digit:].]*$$//g')
50 distdir = $(PACKAGE)-$(VERSION)
52 dist_tgz_TARGETS = ${top_builddir}/${PACKAGE}-common-$(VERSION)$(TGZ_EXTENSION) \
53 ${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TGZ_EXTENSION)
55 dist_txz_TARGETS = ${top_builddir}/${PACKAGE}-common-$(VERSION)$(TXZ_EXTENSION) \
56 ${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TXZ_EXTENSION)
58 dist_common_DIRS = share include
59 dist_arch_DIRS = $(host)
61 PACKAGE_VERSION = $(shell $(CAT) $(top_builddir)/.local-version)
63 VERSION = $(PACKAGE_VERSION)
65 DIST_TMPDIR := $(shell mktemp -u -d /tmp/tmp.$(PACKAGE)-$(VERSION)XXXXXX)
66 TOOLS_TMPDIR := $(shell mktemp -u -d /tmp/tmp.$(PACKAGE)-$(VERSION)XXXXXX)
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";
76 dist-tgz: $(dist_tgz_TARGETS)
78 dist-txz: $(dist_txz_TARGETS)
81 # Produce prebuilt GNU autotools binaries for the architecture of the
82 # current build machine and install them in this nlbuild-autotools
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))
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.
96 dist toolsdist: $(DIST_TARGETS)
97 $(call nl-remove-dir,$(DIST_TMPDIR))
100 # Stage the distribution files to a distribution directory
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}"
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.
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) > "$(@)"
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.
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) > "$(@)"
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.
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) > "$(@)"
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.
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) > "$(@)"