Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / nlfaultinjection / repo / third_party / nlbuild-autotools / repo / examples / Makefile-toplevel.am
1 #
2 #    Copyright (c) 2016-2018 Nest Labs Inc. All Rights Reserved.
3 #    Copyright (c) 2018 Google LLC. All Rights Reserved.
4 #
5 #    Licensed under the Apache License, Version 2.0 (the "License");
6 #    you may not use this file except in compliance with the License.
7 #    You may obtain a copy of the License at
8 #
9 #    http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #    Unless required by applicable law or agreed to in writing, software
12 #    distributed under the License is distributed on an "AS IS" BASIS,
13 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #    See the License for the specific language governing permissions and
15 #    limitations under the License.
16 #
17
18 #
19 #    Description:
20 #      This file is the GNU automake template for the @PACKAGE_DESCRIPTION@.
21 #
22
23 include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
24
25 AM_MAKEFLAGS                              = --no-print-directory
26
27 SUBDIRS                                   = \
28     include                                 \
29     src                                     \
30     tests                                   \
31     doc                                     \
32     $(NULL)
33
34 EXTRA_DIST                                = \
35     Makefile-bootstrap                      \
36     .default-version                        \
37     bootstrap                               \
38     bootstrap-configure                     \
39     $(srcdir)/third_party/nlbuild-autotools \
40     $(NULL)
41
42 BUILT_SOURCES                             = \
43     .local-version                          \
44     $(NULL)
45
46 dist_doc_DATA                             = \
47     $(NULL)
48
49 DISTCLEANFILES                            = \
50     .local-version                          \
51     $(NULL)
52
53 #
54 # Package version files:
55 #
56 # .default-version - The default package version. This file is ALWAYS checked
57 #                    in and should always represent the current baseline
58 #                    version of the package.
59 #
60 # .dist-version    - The distributed package version. This file is NEVER
61 #                    checked in within the upstream repository, is auto-
62 #                    generated, and is only found in the package distribution.
63 #
64 # .local-version   - The current source code controlled package version. This
65 #                    file is NEVER checked in within the upstream repository,
66 #                    is auto-generated, and can always be found in both the
67 #                    build tree and distribution.
68 #
69 # When present, the .local-version file is preferred first, the
70 # .dist-version second, and the .default-version last.
71 #
72
73 # VERSION_FILE should be and is intentionally an immediate (:=) rather
74 # than a deferred (=) variable to ensure the value binds once and only once
75 # for a given MAKELEVEL even as .local-version and .dist-version are created
76 # during makefile execution.
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 the
83 # version is always the current version, not the package bootstrap
84 # version.
85 #
86 # The two-level variables and the check against MAKELEVEL ensures that
87 # not only can the package version be overridden from the command line
88 # but also when the version is NOT overridden that we bind the version
89 # once and only once across potential sub-makes to prevent the version
90 # from flapping as VERSION_FILE changes.
91 #
92
93 export MAYBE_@PACKAGE_SHORT_UPPER@_VERSION        := $(if $(filter 0,$(MAKELEVEL)),$(shell cat $(VERSION_FILE) 2> /dev/null),$(MAYBE_@PACKAGE_SHORT_UPPER@_VERSION))
94
95 @PACKAGE_SHORT_UPPER@_VERSION                     ?= $(MAYBE_@PACKAGE_SHORT_UPPER@_VERSION)
96
97 PACKAGE_VERSION                    = $(@PACKAGE_SHORT_UPPER@_VERSION)
98 VERSION                            = $(PACKAGE_VERSION)
99
100 #
101 # check-file-.local-version
102 #
103 # Speculatively regenerate .local-version and check to see if it needs
104 # to be updated.
105 #
106 # If @PACKAGE_SHORT_UPPER@_VERSION has been supplied anywhere other than in this file
107 # (which is implicitly the contents of .local-version), then use that;
108 # otherwise, attempt to generate it from the SCM system.
109 #
110 # This is called from $(call check-file,.local-version).
111 #
112 define check-file-.local-version
113 if [ "$(origin @PACKAGE_SHORT_UPPER@_VERSION)" != "file" ]; then \
114     echo "$(@PACKAGE_SHORT_UPPER@_VERSION)" > "$(2)";            \
115 else                                                             \
116     $(abs_top_nlbuild_autotools_dir)/scripts/mkversion           \
117         -b "$(@PACKAGE_SHORT_UPPER@_VERSION)" "$(top_srcdir)"    \
118         > "$(2)";                                                \
119 fi
120 endef
121
122 #
123 # check-file-.dist-version
124 #
125 # Speculatively regenerate .dist-version and check to see if it needs
126 # to be updated.
127 #
128 # This is called from $(call check-file,.dist-version).
129 #
130 define check-file-.dist-version
131 cat "$(1)" > "$(2)"
132 endef
133
134 #
135 # A convenience target to allow package users to easily rerun the
136 # package configuration according to the current configuration.
137 #
138 .PHONY: reconfigure
139 reconfigure: $(builddir)/config.status
140         $(AM_V_at)$(<) --recheck
141
142 #
143 # Version file regeneration rules.
144 #
145 .PHONY: force
146
147 $(builddir)/.local-version: $(srcdir)/.default-version force
148
149 $(distdir)/.dist-version: $(builddir)/.local-version force
150
151 $(distdir)/.dist-version $(builddir)/.local-version:
152         $(call check-file,$(@F))
153
154 # If you are synchronizing a package on which yours depends using 'repos.conf',
155 # to 'third_party', uncomment and adapt or delete this, as needed. If you choose
156 # to use this, please also take a look at Makefile.am and third_party/Makefile.am
157 # and uncomment the appropriate sections there.
158
159 # #
160 # # When we run 'distcheck' and --with-nlunit_test defaults to 'internal',
161 # # the nlbuild-autotools infrastructure will attempt to create git paths
162 # # to manage the nlunit-test repo. Two directories need to be writable
163 # # to facilitate this.
164 # #
165 # DISTCHECK_CONFIGURE_FLAGS=`chmod u+w .. ../third_party`
166
167 dist distcheck distdir install-headers: $(BUILT_SOURCES)
168
169 dist-hook: $(distdir)/.dist-version
170
171 # If you are synchronizing a package on which yours depends using 'repos.conf',
172 # to 'third_party', uncomment and adapt or delete this, as needed. If you choose
173 # to use this, please also take a look at Makefile.am and third_party/Makefile.am
174 # and uncomment the appropriate sections there.
175
176 # #
177 # # Ensure any locally synchronized repositories defined by 'repos.conf'
178 # # are cleaned up.
179 # #
180 # distclean-local:
181 #       $(MAKE) -C $(srcdir) -f Makefile-bootstrap clean-repos
182
183 #
184 # Top-level convenience target for making a documentation-only
185 # distribution whose results appear at the top level of the build tree
186 # in the same fashion that the distribution would be for 'make dist'.
187 #
188
189 .PHONY: docdist
190 docdist: $(BUILT_SOURCES)
191         $(MAKE) -C doc docdistdir=$(abs_builddir) $(@)
192
193 include $(abs_top_nlbuild_autotools_dir)/automake/post.am