diff --git a/configure.ac b/configure.ac index 5747606b8..b49914343 100644 --- a/configure.ac +++ b/configure.ac @@ -268,9 +268,9 @@ AM_CONDITIONAL([OPENTHREAD_BUILD_OPTIMIZED], [test "${nl_cv_build_optimized}" = # Code style # -AC_SUBST(ASTYLE, ["\${abs_top_srcdir}/.astyle/astyle-wrap.sh"]) -AC_SUBST(ASTYLE_PRETTY_ARGS, ["astyle --options=\${abs_top_builddir}/.astyle/astyle-opts"]) -AC_SUBST(ASTYLE_PRETTY_CHECK_ARGS, ["astyle --options=\${abs_top_builddir}/.astyle/astyle-opts --dry-run"]) +AC_SUBST(PRETTY, ["\${abs_top_srcdir}/.astyle/astyle-wrap.sh"]) +AC_SUBST(PRETTY_ARGS, ["astyle --options=\${abs_top_builddir}/.astyle/astyle-opts"]) +AC_SUBST(PRETTY_CHECK_ARGS, ["astyle --options=\${abs_top_builddir}/.astyle/astyle-opts --dry-run"]) # # Tests @@ -592,9 +592,9 @@ AC_MSG_NOTICE([ C++ Compile flags : ${CXXFLAGS:--} Link flags : ${LDFLAGS:--} Link libraries : ${LIBS} - Astyle : ${ASTYLE} - Astyle pretty args : ${ASTYLE_PRETTY_ARGS} - Astyle pretty check args : ${ASTYLE_PRETTY_CHECK_ARGS} + Astyle : ${PRETTY} + Astyle pretty args : ${PRETTY_ARGS} + Astyle pretty check args : ${PRETTY_CHECK_ARGS} OpenThread CLI support : ${enable_cli} OpenThread NCP support : ${enable_ncp} OpenThread examples : ${OPENTHREAD_EXAMPLES} diff --git a/third_party/nlbuild-autotools/repo/autoconf/m4/nl_enable_coverage.m4 b/third_party/nlbuild-autotools/repo/autoconf/m4/nl_enable_coverage.m4 index 1d064e441..ec7859c48 100644 --- a/third_party/nlbuild-autotools/repo/autoconf/m4/nl_enable_coverage.m4 +++ b/third_party/nlbuild-autotools/repo/autoconf/m4/nl_enable_coverage.m4 @@ -86,6 +86,7 @@ AC_DEFUN([NL_ENABLE_COVERAGE], ]) if test "${nl_cv_build_coverage}" = "yes"; then + AM_EXTRA_RECURSIVE_TARGETS([coverage]) if test "${GCC}" != "yes"; then AC_MSG_ERROR([GCC or a GCC-compatible toolchain is required for --enable-coverage]) diff --git a/third_party/nlbuild-autotools/repo/automake/post/rules/coverage.am b/third_party/nlbuild-autotools/repo/automake/post/rules/coverage.am index 787473ab0..dbe185ba3 100644 --- a/third_party/nlbuild-autotools/repo/automake/post/rules/coverage.am +++ b/third_party/nlbuild-autotools/repo/automake/post/rules/coverage.am @@ -20,20 +20,13 @@ # targets and rules. # # This represents the minimum integration with GNU autotools -# (automake inparticular) such that 'make coverage' may be invoked +# (automake in particular) such that 'make coverage' may be invoked # at the top of the tree and all the prerequisites occur such # that it executes successfully with no intervening make target # invocations. The 'check-am' and '$(BUILT_SOURCES)' are the key # automake-specific dependencies to ensure that happens. # -.PHONY: coverage coverage-recursive +coverage-local: check-am -coverage: coverage-recursive - -coverage: check-am - -coverage: $(BUILT_SOURCES) - -coverage-recursive: - $(nl-make-subdirs) +coverage-local: $(BUILT_SOURCES) diff --git a/third_party/nlbuild-autotools/repo/automake/post/rules/pretty.am b/third_party/nlbuild-autotools/repo/automake/post/rules/pretty.am index 2743bf286..ad0ce7f0e 100644 --- a/third_party/nlbuild-autotools/repo/automake/post/rules/pretty.am +++ b/third_party/nlbuild-autotools/repo/automake/post/rules/pretty.am @@ -16,40 +16,62 @@ # # Description: -# This file is the automake footer for code style checking and -# reformatting related targets and rules. +# This file is the automake footer for all coding style-related +# targets and rules. # +# The recursive target 'pretty', invoked against '$(PRETTY_SUBDIRS)', +# is intended to reformat a collection of source files, defined by +# '$(PRETTY_FILES)' using the program '$(PRETTY)' with the arguments +# '$(PRETTY_ARGS)'. +# +# The recursive target 'pretty-check' (and its alias 'lint'), +# invoked against '$(PRETTY_SUBDIRS)', is intended to only check +# but NOT reformat a collection of source files, defined by +# '$(PRETTY_FILES)' using the program '$(PRETTY_CHECK)' with the +# arguments '$(PRETTY_CHECK_ARGS)'. +# +# This represents the minimum integration with GNU autotools +# (automake inparticular) such that 'make pretty' and 'make +# pretty-check' may be invoked at the top of the tree and all +# the prerequisites occur such that it executes successfully +# with no intervening make target invocations. '$(BUILT_SOURCES)' +# are the key automake-specific dependencies to ensure that happens. +# + +# nl-make-pretty +# +# This function iterates over PRETTY_FILES, invoking COMMAND with +# COMMAND ARGUEMENTS on each file. If a non-verbose make has been +# requested TERSE OUTPUT COMMAND is emitted to standard output. + +define nl-make-pretty +$(AM_V_at)for file in $(PRETTY_FILES); do \ + $(1) \ + if test -f $${file}; then d=.; else d=$(srcdir); fi; \ + $(2) $(3) $${d}/$${file} \ + || exit 1; \ +done +endef + +.PHONY: pretty pretty-recursive pretty-check pretty-check-recursive lint pretty: pretty-recursive -# -# 'pretty' target calls astyle on each file in SOURCES and HEADERS. -# This iteratively calls astyle on each file. astyle seems to retain -# state from processing a previous file, which sometimes causes -# formatting of a subsequent file to fail. -# -pretty: -ifneq ($(SOURCES) $(HEADERS),) - $(AM_V_at) for file in $(SOURCES) $(HEADERS); do $(ASTYLE) $(ASTYLE_PRETTY_ARGS) $$file; done -endif +pretty pretty-check: $(BUILT_SOURCES) -pretty-check: pretty-recursive +lint: pretty-check -# -# 'pretty-check' target calls astyle on each file in SOURCES and HEADERS. -# This iteratively calls astyle on each file. astyle seems to retain -# state from processing a previous file, which sometimes causes -# formatting of a subsequent file to fail. -# -pretty-check: -ifneq ($(SOURCES) $(HEADERS),) - $(AM_V_at)for file in $(SOURCES) $(HEADERS); do \ - if [[ -n `$(ASTYLE) $(ASTYLE_PRETTY_CHECK_ARGS) $$file` ]]; then \ - echo "Code style error. Run 'make pretty' to reformat."; \ - exit 1; \ - fi \ - done -endif +pretty-check: pretty-check-recursive -pretty-recursive: +pretty-recursive pretty-check-recursive: $(call nl-make-subdirs-with-dirs,$(PRETTY_SUBDIRS)) + +pretty: +ifneq ($(PRETTY),) + $(call nl-make-pretty,$(AM_V_PRETTY),$(PRETTY),$(PRETTY_ARGS)) +endif + +pretty-check: +ifneq ($(PRETTY_CHECK),) + $(call nl-make-pretty,$(AM_V_PRETTY_CHECK),$(PRETTY_CHECK),$(PRETTY_CHECK_ARGS)) +endif diff --git a/third_party/nlbuild-autotools/repo/automake/pre/macros.am b/third_party/nlbuild-autotools/repo/automake/pre/macros.am index 377964fde..8122beab8 100644 --- a/third_party/nlbuild-autotools/repo/automake/pre/macros.am +++ b/third_party/nlbuild-autotools/repo/automake/pre/macros.am @@ -22,6 +22,7 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre/macros/constants.am include $(abs_top_nlbuild_autotools_dir)/automake/pre/macros/paths.am +include $(abs_top_nlbuild_autotools_dir)/automake/pre/macros/pretty.am include $(abs_top_nlbuild_autotools_dir)/automake/pre/macros/verbosity.am include $(abs_top_nlbuild_autotools_dir)/automake/pre/macros/coverage.am include $(abs_top_nlbuild_autotools_dir)/automake/pre/macros/subdirs.am diff --git a/third_party/nlbuild-autotools/repo/automake/pre/macros/pretty.am b/third_party/nlbuild-autotools/repo/automake/pre/macros/pretty.am new file mode 100644 index 000000000..a983c2973 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/automake/pre/macros/pretty.am @@ -0,0 +1,52 @@ +# +# Copyright 2016 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file defines automake variables for performing coding +# style formatting and checking. +# + +AM_V_PRETTY = $(am__v_PRETTY_$(V)) +am__v_PRETTY_ = $(am__v_PRETTY_$(AM_DEFAULT_VERBOSITY)) +am__v_PRETTY_0 = echo " PRETTY $${file}"; +am__v_PRETTY_1 = + +AM_V_PRETTY_CHECK = $(am__v_PRETTY_CHECK_$(V)) +am__v_PRETTY_CHECK_ = $(am__v_PRETTY_CHECK_$(AM_DEFAULT_VERBOSITY)) +am__v_PRETTY_CHECK_0 = echo " PRETTY $${file}"; +am__v_PRETTY_CHECK_1 = + +# PRETTY_FILES +# +# This defines the collection of files against which the PRETTY and +# PRETTY_CHECK profiles will be invoked for the 'pretty' and +# 'pretty-check' targets, respectively. +# +# This defaults to SOURCES and HEADERS and may be overriden or +# appended to. + +PRETTY_FILES ?= $(SOURCES) $(HEADERS) + +# PRETTY_SUBDIRS +# +# This defines the subdirectories for which the recursive 'pretty' and +# 'pretty-check' targets will run against. +# +# This defaults to SUBDIRS and may be overridden or appended to. + +PRETTY_SUBDIRS ?= $(SUBDIRS) + diff --git a/third_party/nlbuild-autotools/repo/automake/pre/macros/subdirs.am b/third_party/nlbuild-autotools/repo/automake/pre/macros/subdirs.am index 7a0b5b54a..174cefefd 100644 --- a/third_party/nlbuild-autotools/repo/automake/pre/macros/subdirs.am +++ b/third_party/nlbuild-autotools/repo/automake/pre/macros/subdirs.am @@ -34,7 +34,7 @@ # attempt to make in each specified subdirectory. # define nl-make-subdirs-with-dirs-and-goals -$(AM_V_at)for subdir in $(1); do \ ++$(AM_V_at)for subdir in $(1); do \ echo "Making $(2) in $${subdir}"; \ $(MAKE) -C "$${subdir}" $(AM_MAKEFLAGS) $(2) \ || exit 1; \ diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so deleted file mode 100755 index 3ef80f635..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so new file mode 120000 index 000000000..2fac5cb73 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so @@ -0,0 +1 @@ +libltdl.so.7.3.0 \ No newline at end of file diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7 b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7 deleted file mode 100755 index 3ef80f635..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7 and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7 b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7 new file mode 120000 index 000000000..2fac5cb73 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7 @@ -0,0 +1 @@ +libltdl.so.7.3.0 \ No newline at end of file diff --git a/third_party/nlbuild-autotools/repo/tools/host/x86_64-apple-darwin/lib/libltdl.dylib b/third_party/nlbuild-autotools/repo/tools/host/x86_64-apple-darwin/lib/libltdl.dylib deleted file mode 100755 index 1f5d1340e..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/x86_64-apple-darwin/lib/libltdl.dylib and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/x86_64-apple-darwin/lib/libltdl.dylib b/third_party/nlbuild-autotools/repo/tools/host/x86_64-apple-darwin/lib/libltdl.dylib new file mode 120000 index 000000000..7836ab48c --- /dev/null +++ b/third_party/nlbuild-autotools/repo/tools/host/x86_64-apple-darwin/lib/libltdl.dylib @@ -0,0 +1 @@ +libltdl.7.dylib \ No newline at end of file diff --git a/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so b/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so deleted file mode 100755 index ef8375a68..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so b/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so new file mode 120000 index 000000000..2fac5cb73 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so @@ -0,0 +1 @@ +libltdl.so.7.3.0 \ No newline at end of file diff --git a/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so.7 b/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so.7 deleted file mode 100755 index ef8375a68..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so.7 and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so.7 b/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so.7 new file mode 120000 index 000000000..2fac5cb73 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/tools/host/x86_64-unknown-linux-gnu/lib/libltdl.so.7 @@ -0,0 +1 @@ +libltdl.so.7.3.0 \ No newline at end of file