Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / third_party / nlfaultinjection / repo / third_party / nlbuild-autotools / repo / Common.mak
1 #
2 #    Copyright 2017 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 make file header defines common variables, rules, and
20 #      targets for maintaining nlbuild-autotools distributions.
21 #
22
23 .DEFAULT_GOAL         = all
24
25 #
26 # This package
27 #
28 PACKAGE              := nlbuild-autotools
29
30 #
31 # Tools
32 #
33 CAT                  ?= cat
34 CHMOD                ?= chmod
35 CMP                  ?= cmp
36 FIND                 ?= find
37 GZIP                 ?= gzip
38 MKDIR                ?= mkdir
39 MV                   ?= mv
40 RM                   ?= rm
41 SED                  ?= sed
42 TAR                  ?= tar
43 XZ                   ?= xz
44
45 dist_tar_ARCHIVE      = $(TAR) -chof -
46
47 dist_tgz_ARCHIVE      = $(dist_tar_ARCHIVE)
48 dist_tgz_COMPRESS     = $(GZIP) --best -c
49
50 dist_txz_ARCHIVE      = $(dist_tar_ARCHIVE)
51 dist_txz_COMPRESS     = $(XZ) --extreme -c
52
53 TGZ_EXTENSION        := .tar.gz
54 TXZ_EXTENSION        := .tar.xz
55
56 DIST_TARGETS         ?= dist-tgz dist-txz
57 DIST_ARCHIVES         = $(dist_tgz_TARGETS) $(dist_txz_TARGETS)
58
59 #
60 # Verbosity
61 #
62
63 NL_DEFAULT_VERBOSITY  = 0
64
65 NL_V_AT               = $(NL_V_AT_$(V))
66 NL_V_AT_              = $(NL_V_AT_$(NL_DEFAULT_VERBOSITY))
67 NL_V_AT_0             = @
68 NL_V_AT_1             = 
69
70 NL_V_MAKE             = $(NL_V_MAKE_$(V))
71 NL_V_MAKE_            = $(NL_V_MAKE_$(NL_DEFAULT_VERBOSITY))
72 NL_V_MAKE_0           = @echo "  MAKE     $(@)";
73 NL_V_MAKE_1           = 
74
75 NL_V_MKDIR_P          = $(NL_V_MKDIR_P_$(V))
76 NL_V_MKDIR_P_         = $(NL_V_MKDIR_P_$(NL_DEFAULT_VERBOSITY))
77 NL_V_MKDIR_P_0        = @echo "  MKDIR    $(1)";
78 NL_V_MKDIR_P_1        = 
79
80 NL_V_RMDIR            = $(NL_V_RMDIR_$(V))
81 NL_V_RMDIR_           = $(NL_V_RMDIR_$(NL_DEFAULT_VERBOSITY))
82 NL_V_RMDIR_0          = @echo "  RMDIR    $(1)";
83 NL_V_RMDIR_1          = 
84
85 NL_V_TGZ              = $(NL_V_TGZ_$(V))
86 NL_V_TGZ_             = $(NL_V_TGZ_$(NL_DEFAULT_VERBOSITY))
87 NL_V_TGZ_0            = @echo "  TGZ      $(@)";
88 NL_V_TGZ_1            = 
89
90 NL_V_TXZ              = $(NL_V_TXZ_$(V))
91 NL_V_TXZ_             = $(NL_V_TXZ_$(NL_DEFAULT_VERBOSITY))
92 NL_V_TXZ_0            = @echo "  TXZ      $(@)";
93 NL_V_TXZ_1            = 
94
95 #
96 # nl-create-dir <directory>
97 #
98 # Create the specified directory, including any parent directories
99 # that may not exist.
100 #
101 define nl-create-dir
102 $(NL_V_AT)echo "  MKDIR    $(1)"; \
103 $(MKDIR) -p "$(1)"
104 endef # nl-create-dir
105
106 #
107 # nl-remove-dir <directory>
108 #
109 # If the specified directory exists, then ensure all of the
110 # directories are writable by the current user, and then forcibly
111 # remove the directory and all of its contents, sleeping for five (5)
112 # seconds and failure before trying the removal again.
113 #
114 define nl-remove-dir
115 $(NL_V_RMDIR) \
116 if [ -d "$(1)" ]; then \
117     $(FIND) "$(1)" -type d ! -perm -200 -exec $(CHMOD) u+w {} ';' \
118     && $(RM) -rf "$(1)" \
119     || { sleep 5 && $(RM) -rf "$(1)"; }; \
120 fi
121 endef # nl-remove-dir
122
123 clean-local:
124         $(NL_V_AT)$(RM) -f *~ "#"*
125
126 help:
127         @echo "This make file shold not be needed for end users and system "
128         @echo "integrators of $(PACKAGE). It should only be needed by "
129         @echo "maintainers producing distributions of $(PACKAGE)."