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