Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / nlassert / repo / Makefile.am
1 #
2 #    Copyright 2015-2018 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 file is the GNU automake template for the Nest Labs
20 #      runtime assertion library.
21 #
22
23 include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
24
25 AM_MAKEFLAGS                              = --no-print-directory
26
27 SUBDIRS                                   = \
28     third_party                             \
29     include                                 \
30     tests                                   \
31     doc                                     \
32     $(NULL)
33
34 EXTRA_DIST                                = \
35     CHANGES                                 \
36     CONTRIBUTING.md                         \
37     LICENSE                                 \
38     Makefile-bootstrap                      \
39     README.md                               \
40     .default-version                        \
41     bootstrap                               \
42     bootstrap-configure                     \
43     $(srcdir)/third_party/nlbuild-autotools \
44     repos.conf                              \
45     $(NULL)
46
47 BUILT_SOURCES                             = \
48     .local-version                          \
49     $(NULL)
50
51 dist_doc_DATA                             = \
52     $(NULL)
53
54 DISTCLEANFILES                            = \
55     .local-version                          \
56     $(NULL)
57
58 #
59 # Package version files:
60 #
61 # .default-version - The default package version. This file is ALWAYS checked
62 #                    in and should always represent the current baseline
63 #                    version of the package.
64 #
65 # .dist-version    - The distributed package version. This file is NEVER
66 #                    checked in within the upstream repository, is auto-
67 #                    generated, and is only found in the package distribution.
68 #
69 # .local-version   - The current source code controlled package version. This
70 #                    file is NEVER checked in within the upstream repository,
71 #                    is auto-generated, and can always be found in both the
72 #                    build tree and distribution.
73 #
74 # When present, the .local-version file is preferred first, the
75 # .dist-version second, and the .default-version last.
76 #
77
78 VERSION_FILE                      := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version))
79
80 #
81 # Override autotool's default notion of the package version variables.
82 # This ensures that when we create a source distribution that the
83 # version is always the current version, not the version when the
84 # package was bootstrapped.
85 #
86
87 NLASSERT_VERSION     ?= $(shell cat $(VERSION_FILE) 2> /dev/null)
88
89 PACKAGE_VERSION                    = $(NLASSERT_VERSION)
90 VERSION                            = $(PACKAGE_VERSION)
91
92 #
93 # check-file-.local-version
94 #
95 # Speculatively regenerate .local-version and check to see if it needs
96 # to be updated.
97 #
98 # If NLASSERT_VERSION has been supplied anywhere other than in this file
99 # (which is implicitly the contents of .local-version), then use that;
100 # otherwise, attempt to generate it from the SCM system.
101 #
102 # This is called from $(call check-file,.local-version).
103 #
104 define check-file-.local-version
105 if [ "$(origin NLASSERT_VERSION)" != "file" ]; then    \
106     echo "$(NLASSERT_VERSION)" > "$(2)";               \
107 else                                                   \
108     $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
109         -b "$(NLASSERT_VERSION)" "$(top_srcdir)"       \
110         > "$(2)";                                      \
111 fi
112 endef
113
114 #
115 # check-file-.dist-version
116 #
117 # Speculatively regenerate .dist-version and check to see if it needs
118 # to be updated.
119 #
120 # This is called from $(call check-file,.dist-version).
121 #
122 define check-file-.dist-version
123 cat "$(1)" > "$(2)"
124 endef
125
126 #
127 # A convenience target to allow package users to easily rerun the
128 # package configuration according to the current configuration.
129 #
130 .PHONY: reconfigure
131 reconfigure: $(builddir)/config.status
132         $(AM_V_at)$(<) --recheck
133
134 #
135 # Version file regeneration rules.
136 #
137 .PHONY: force
138
139 $(builddir)/.local-version: $(srcdir)/.default-version force
140
141 $(distdir)/.dist-version: $(builddir)/.local-version force
142
143 $(distdir)/.dist-version $(builddir)/.local-version:
144         $(call check-file,$(@F))
145
146 #
147 # When we run 'distcheck' and --with-nlunit_test defaults to 'internal',
148 # the nlbuild-autotools infrastructure will attempt to create git paths
149 # to manage the nlunit-test repo. Two directories need to be writable
150 # to facilitate this.
151 #
152 DISTCHECK_CONFIGURE_FLAGS=`chmod u+w .. ../third_party`
153
154 dist distcheck: $(BUILT_SOURCES)
155
156 dist-hook: $(distdir)/.dist-version
157
158 #
159 # Ensure any locally synchronized repositories defined by 'repos.conf'
160 # are cleaned up.
161 #
162 distclean-local:
163         $(MAKE) -C $(srcdir) -f Makefile-bootstrap clean-repos
164
165 #
166 # Top-level convenience target for making a documentation-only
167 # distribution whose results appear at the top level of the build tree
168 # in the same fashion that the distribution would be for 'make dist'.
169 #
170
171 .PHONY: docdist
172 docdist: $(BUILT_SOURCES)
173         $(MAKE) -C doc docdistdir=$(abs_builddir) $(@)
174
175 include $(abs_top_nlbuild_autotools_dir)/automake/post.am