Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 1 | # |
Jonathan Hui | 4435017 | 2016-09-13 15:57:11 -0700 | [diff] [blame] | 2 | # Copyright (c) 2016, The OpenThread Authors. |
Marcin K Szczodrak | 99870fa | 2016-05-12 22:39:11 -0700 | [diff] [blame] | 3 | # All rights reserved. |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 4 | # |
Marcin K Szczodrak | 99870fa | 2016-05-12 22:39:11 -0700 | [diff] [blame] | 5 | # Redistribution and use in source and binary forms, with or without |
| 6 | # modification, are permitted provided that the following conditions are met: |
| 7 | # 1. Redistributions of source code must retain the above copyright |
| 8 | # notice, this list of conditions and the following disclaimer. |
| 9 | # 2. Redistributions in binary form must reproduce the above copyright |
| 10 | # notice, this list of conditions and the following disclaimer in the |
| 11 | # documentation and/or other materials provided with the distribution. |
| 12 | # 3. Neither the name of the copyright holder nor the |
| 13 | # names of its contributors may be used to endorse or promote products |
| 14 | # derived from this software without specific prior written permission. |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 15 | # |
Marcin K Szczodrak | 99870fa | 2016-05-12 22:39:11 -0700 | [diff] [blame] | 16 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 17 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 20 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 24 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 25 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 26 | # POSSIBILITY OF SUCH DAMAGE. |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 27 | # |
| 28 | |
| 29 | include $(abs_top_nlbuild_autotools_dir)/automake/pre.am |
| 30 | |
| 31 | AM_MAKEFLAGS = --no-print-directory |
| 32 | |
Jonathan Hui | e033962 | 2016-06-11 10:32:05 -0700 | [diff] [blame] | 33 | AM_DISTCHECK_CONFIGURE_FLAGS = \ |
Jonathan Hui | 3e6546c | 2017-01-06 13:54:32 -0800 | [diff] [blame] | 34 | --enable-address-sanitizer \ |
Jonathan Hui | a638442 | 2018-09-05 00:35:52 -0700 | [diff] [blame] | 35 | --enable-cli \ |
Jonathan Hui | a638442 | 2018-09-05 00:35:52 -0700 | [diff] [blame] | 36 | --enable-ftd \ |
Jonathan Hui | a638442 | 2018-09-05 00:35:52 -0700 | [diff] [blame] | 37 | --enable-mtd \ |
| 38 | --enable-ncp \ |
Jonathan Hui | a638442 | 2018-09-05 00:35:52 -0700 | [diff] [blame] | 39 | --enable-radio-only \ |
Yakun Xu | a551133 | 2020-02-28 04:55:56 +0800 | [diff] [blame] | 40 | --with-examples=simulation \ |
Jonathan Hui | e033962 | 2016-06-11 10:32:05 -0700 | [diff] [blame] | 41 | $(NULL) |
Robert Quattlebaum | 059763b | 2016-05-19 13:34:40 -0700 | [diff] [blame] | 42 | |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 43 | SUBDIRS = \ |
Jonathan Hui | c8908cf | 2016-05-16 21:41:38 -0700 | [diff] [blame] | 44 | include \ |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 45 | third_party \ |
Yakun Xu | 1b14a36 | 2018-06-26 07:32:32 +0800 | [diff] [blame] | 46 | src \ |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 47 | examples \ |
| 48 | tests \ |
Robert Quattlebaum | 862edfb | 2016-07-06 18:53:33 -0700 | [diff] [blame] | 49 | tools \ |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 50 | doc \ |
| 51 | $(NULL) |
| 52 | |
| 53 | EXTRA_DIST = \ |
| 54 | .default-version \ |
| 55 | bootstrap \ |
Nick Banks | f600840 | 2016-10-25 13:38:29 -0700 | [diff] [blame] | 56 | etc \ |
Robert Quattlebaum | c5063e4 | 2016-06-09 17:54:14 -0700 | [diff] [blame] | 57 | README.md \ |
| 58 | NOTICE \ |
| 59 | CONTRIBUTING.md \ |
| 60 | LICENSE \ |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 61 | $(NULL) |
| 62 | |
| 63 | BUILT_SOURCES = \ |
| 64 | .local-version \ |
| 65 | $(NULL) |
| 66 | |
| 67 | dist_doc_DATA = \ |
| 68 | $(NULL) |
| 69 | |
| 70 | DISTCLEANFILES = \ |
| 71 | .local-version \ |
| 72 | $(NULL) |
| 73 | |
Shu Chen | 46f920c | 2016-10-25 13:13:23 +0800 | [diff] [blame] | 74 | # Ignore the pseudo flash files on Posix platform during diskcheck |
| 75 | distcleancheck_listfiles = \ |
| 76 | $(AM_V_at)find . -type f -name "*flash" |
| 77 | |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 78 | # |
| 79 | # Package version files: |
| 80 | # |
| 81 | # .default-version - The default package version. This file is ALWAYS checked |
| 82 | # in and should always represent the current baseline |
| 83 | # version of the package. |
| 84 | # |
| 85 | # .dist-version - The distributed package version. This file is NEVER |
| 86 | # checked in within the upstream repository, is auto- |
| 87 | # generated, and is only found in the package distribution. |
| 88 | # |
| 89 | # .local-version - The current source code controlled package version. This |
| 90 | # file is NEVER checked in within the upstream repository, |
| 91 | # is auto-generated, and can always be found in both the |
| 92 | # build tree and distribution. |
| 93 | # |
| 94 | # When present, the .local-version file is preferred first, the |
| 95 | # .dist-version second, and the .default-version last. |
| 96 | # |
| 97 | |
| 98 | VERSION_FILE := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version)) |
| 99 | |
| 100 | # |
| 101 | # Override autotool's default notion of the package version variables. |
| 102 | # This ensures that when we create a source distribution that the |
| 103 | # version is always the current version, not the version when the |
| 104 | # package was bootstrapped. |
| 105 | # |
| 106 | |
| 107 | OPENTHREAD_VERSION ?= $(shell cat $(VERSION_FILE) 2> /dev/null) |
| 108 | |
| 109 | PACKAGE_VERSION = $(OPENTHREAD_VERSION) |
| 110 | VERSION = $(PACKAGE_VERSION) |
| 111 | |
Robert Quattlebaum | 059763b | 2016-05-19 13:34:40 -0700 | [diff] [blame] | 112 | distdir = $(PACKAGE)-$(shell \ |
| 113 | if [ "$(origin OPENTHREAD_VERSION)" != "file" ]; then \ |
| 114 | echo "$(OPENTHREAD_VERSION)" ; \ |
| 115 | else \ |
| 116 | $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \ |
| 117 | -b "$(OPENTHREAD_VERSION)" "$(top_srcdir)"; \ |
| 118 | fi ) |
| 119 | |
Jonathan Hui | 4f9945c | 2016-05-10 20:48:47 -0700 | [diff] [blame] | 120 | # |
| 121 | # check-file-.local-version |
| 122 | # |
| 123 | # Speculatively regenerate .local-version and check to see if it needs |
| 124 | # to be updated. |
| 125 | # |
| 126 | # If OPENTHREAD_VERSION has been supplied anywhere other than in this file |
| 127 | # (which is implicitly the contents of .local-version), then use that; |
| 128 | # otherwise, attempt to generate it from the SCM system. |
| 129 | # |
| 130 | # This is called from $(call check-file,.local-version). |
| 131 | # |
| 132 | define check-file-.local-version |
| 133 | if [ "$(origin OPENTHREAD_VERSION)" != "file" ]; then \ |
| 134 | echo "$(OPENTHREAD_VERSION)" > "$(2)"; \ |
| 135 | else \ |
| 136 | $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \ |
| 137 | -b "$(OPENTHREAD_VERSION)" "$(top_srcdir)" \ |
| 138 | > "$(2)"; \ |
| 139 | fi |
| 140 | endef |
| 141 | |
| 142 | # |
| 143 | # check-file-.dist-version |
| 144 | # |
| 145 | # Speculatively regenerate .dist-version and check to see if it needs |
| 146 | # to be updated. |
| 147 | # |
| 148 | # This is called from $(call check-file,.dist-version). |
| 149 | # |
| 150 | define check-file-.dist-version |
| 151 | cat "$(1)" > "$(2)" |
| 152 | endef |
| 153 | |
| 154 | # |
| 155 | # A convenience target to allow package users to easily rerun the |
| 156 | # package configuration according to the current configuration. |
| 157 | # |
| 158 | .PHONY: reconfigure |
| 159 | reconfigure: $(builddir)/config.status |
| 160 | $(AM_V_at)$(<) --recheck |
| 161 | |
| 162 | # |
| 163 | # Version file regeneration rules. |
| 164 | # |
| 165 | .PHONY: force |
| 166 | |
| 167 | $(builddir)/.local-version: $(srcdir)/.default-version force |
| 168 | |
| 169 | $(distdir)/.dist-version: $(builddir)/.local-version force |
| 170 | |
| 171 | $(distdir)/.dist-version $(builddir)/.local-version: |
| 172 | $(call check-file,$(@F)) |
| 173 | |
| 174 | dist distcheck: $(BUILT_SOURCES) |
| 175 | |
| 176 | dist-hook: $(distdir)/.dist-version |
| 177 | |
| 178 | # |
| 179 | # Top-level convenience target for making a documentation-only |
| 180 | # distribution whose results appear at the top level of the build tree |
| 181 | # in the same fashion that the distribution would be for 'make dist'. |
| 182 | # |
| 183 | |
| 184 | .PHONY: docdist |
| 185 | docdist: $(BUILT_SOURCES) |
| 186 | $(MAKE) -C doc docdistdir=$(abs_builddir) $(@) |
| 187 | |
| 188 | include $(abs_top_nlbuild_autotools_dir)/automake/post.am |