2 # Copyright 2015-2016 Nest Labs Inc. All Rights Reserved.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 # This file is the automake footer for all coding style-related
22 # The recursive target 'pretty', invoked against '$(PRETTY_SUBDIRS)',
23 # is intended to reformat a collection of source files, defined by
24 # '$(PRETTY_FILES)' using the program '$(PRETTY)' with the arguments
27 # The recursive target 'pretty-check' (and its alias 'lint'),
28 # invoked against '$(PRETTY_SUBDIRS)', is intended to only check
29 # but NOT reformat a collection of source files, defined by
30 # '$(PRETTY_FILES)' using the program '$(PRETTY_CHECK)' with the
31 # arguments '$(PRETTY_CHECK_ARGS)'.
33 # This represents the minimum integration with GNU autotools
34 # (automake inparticular) such that 'make pretty' and 'make
35 # pretty-check' may be invoked at the top of the tree and all
36 # the prerequisites occur such that it executes successfully
37 # with no intervening make target invocations. '$(BUILT_SOURCES)'
38 # are the key automake-specific dependencies to ensure that happens.
41 # nl-make-pretty <TERSE OUTPUT COMMAND> <COMMAND> <COMMAND ARGUMENTS> <PATHS>
43 # This function iterates over PATHS, invoking COMMAND with
44 # COMMAND ARGUEMENTS on each file. If a non-verbose make has been
45 # requested TERSE OUTPUT COMMAND is emitted to standard output.
48 $(AM_V_at)for file in $(4); do \
50 if test -f $${file}; then d=; else d=$(srcdir)/; fi; \
51 $(2) $(3) $${d}$${file} \
56 .PHONY: pretty pretty-recursive pretty-check pretty-check-recursive lint
58 pretty: pretty-recursive
60 pretty pretty-check: $(BUILT_SOURCES)
62 # Map the build action 'lint' to the more vernacular 'pretty-check'.
66 pretty-check: pretty-check-recursive
68 pretty-recursive pretty-check-recursive:
69 $(call nl-make-subdirs-with-dirs,$(PRETTY_SUBDIRS))
71 pretty: $(PRETTY_FILES)
73 $(call nl-make-pretty,$(AM_V_PRETTY),$(PRETTY),$(PRETTY_ARGS),$(filter-out $(@)-recursive,$(PRETTY_FILES)))
76 pretty-check: $(PRETTY_FILES)
77 ifneq ($(PRETTY_CHECK),)
78 $(call nl-make-pretty,$(AM_V_PRETTY_CHECK),$(PRETTY_CHECK),$(PRETTY_CHECK_ARGS),$(filter-out $(@)-recursive,$(PRETTY_FILES)))