Tue, 25 Jun 2013 09:37:46 +0200
8012564: The SOURCE value in release file of JDK 8 doesn't contain valid changesets for some OS since b74
Reviewed-by: alanb, tbell
ohair@425 | 1 | # |
ohair@425 | 2 | # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
ohair@425 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@425 | 4 | # |
ohair@425 | 5 | # This code is free software; you can redistribute it and/or modify it |
ohair@425 | 6 | # under the terms of the GNU General Public License version 2 only, as |
ohair@425 | 7 | # published by the Free Software Foundation. Oracle designates this |
ohair@425 | 8 | # particular file as subject to the "Classpath" exception as provided |
ohair@425 | 9 | # by Oracle in the LICENSE file that accompanied this code. |
ohair@425 | 10 | # |
ohair@425 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@425 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@425 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@425 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
ohair@425 | 15 | # accompanied this code). |
ohair@425 | 16 | # |
ohair@425 | 17 | # You should have received a copy of the GNU General Public License version |
ohair@425 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
ohair@425 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@425 | 20 | # |
ohair@425 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@425 | 22 | # or visit www.oracle.com if you need additional information or have any |
ohair@425 | 23 | # questions. |
ohair@425 | 24 | # |
ohair@425 | 25 | |
ohair@425 | 26 | ################################################################ |
ohair@425 | 27 | # |
ohair@425 | 28 | # Check that GNU make and cygwin are recent enough. |
ohair@425 | 29 | # Setup common utility functions. |
ohair@425 | 30 | # |
ohair@425 | 31 | ################################################################ |
ohair@425 | 32 | |
ohair@425 | 33 | ifndef _MAKEBASE_GMK |
ohair@425 | 34 | _MAKEBASE_GMK := 1 |
ohair@425 | 35 | |
ohair@425 | 36 | # If the variable that you want to send to stdout for piping into a file or otherwise, |
ohair@425 | 37 | # is potentially long, for example the a list of file paths, eg a list of all package directories. |
ohair@425 | 38 | # Then you need to use ListPathsSafely, which optimistically splits the output into several shell |
ohair@425 | 39 | # calls as well as use compression on recurrent file paths segments, to get around the potential |
ohair@425 | 40 | # command line length problem that exists in cygwin and other shells. |
ohair@494 | 41 | compress_pre:=$(strip $(shell $(CAT) $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-pre-compress.incl)) |
ohair@494 | 42 | compress_post:=$(strip $(shell $(CAT) $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-post-compress.incl)) |
ohair@425 | 43 | compress_paths=$(compress_pre)\ |
ohair@425 | 44 | $(subst $(SRC_ROOT),X97,\ |
ohair@425 | 45 | $(subst $(OUTPUT_ROOT),X98,\ |
ohair@425 | 46 | $(subst X,X00,\ |
ohair@425 | 47 | $(subst $(SPACE),\n,$(strip $1)))))\ |
ohair@425 | 48 | $(compress_post) |
ohair@425 | 49 | |
ohair@494 | 50 | decompress_paths=$(SED) -f $(SRC_ROOT)/common/makefiles/support/ListPathsSafely-uncompress.sed -e 's|X99|\\n|g' \ |
ohair@425 | 51 | -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \ |
ohair@425 | 52 | -e 's|X00|X|g' | tr '\n' '$2' |
ohair@425 | 53 | |
ohair@425 | 54 | define ListPathsSafely_If |
dholmes@660 | 55 | $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(wordlist $3,$4,$($1))))) |
ohair@425 | 56 | endef |
ohair@425 | 57 | |
ohair@425 | 58 | define ListPathsSafely_Printf |
ohair@425 | 59 | $(if $(strip $($1_LPS$4)),printf -- "$(strip $($1_LPS$4))\n" | $(decompress_paths) $3) |
ohair@425 | 60 | endef |
ohair@425 | 61 | |
ohair@425 | 62 | # Receipt example: |
ohair@425 | 63 | # rm -f thepaths |
ohair@425 | 64 | # $(call ListPathsSafely,THEPATHS,\n, >> thepaths) |
ohair@425 | 65 | # The \n argument means translate spaces into \n |
ohair@425 | 66 | # if instead , , (a space) is supplied, then spaces remain spaces. |
ohair@425 | 67 | define ListPathsSafely |
erikj@501 | 68 | $(if $(word 16001,$($1)),$(error Cannot list safely more than 16000 paths. $1 has $(words $($1)) paths!)) |
ohair@425 | 69 | $(call ListPathsSafely_If,$1,$2,1,250) |
ohair@425 | 70 | $(call ListPathsSafely_If,$1,$2,251,500) |
ohair@425 | 71 | $(call ListPathsSafely_If,$1,$2,501,750) |
ohair@425 | 72 | $(call ListPathsSafely_If,$1,$2,751,1000) |
ohair@425 | 73 | |
ohair@425 | 74 | $(call ListPathsSafely_If,$1,$2,1001,1250) |
ohair@425 | 75 | $(call ListPathsSafely_If,$1,$2,1251,1500) |
ohair@425 | 76 | $(call ListPathsSafely_If,$1,$2,1501,1750) |
ohair@425 | 77 | $(call ListPathsSafely_If,$1,$2,1751,2000) |
ohair@425 | 78 | |
ohair@425 | 79 | $(call ListPathsSafely_If,$1,$2,2001,2250) |
ohair@425 | 80 | $(call ListPathsSafely_If,$1,$2,2251,2500) |
ohair@425 | 81 | $(call ListPathsSafely_If,$1,$2,2501,2750) |
ohair@425 | 82 | $(call ListPathsSafely_If,$1,$2,2751,3000) |
ohair@425 | 83 | |
ohair@425 | 84 | $(call ListPathsSafely_If,$1,$2,3001,3250) |
ohair@425 | 85 | $(call ListPathsSafely_If,$1,$2,3251,3500) |
ohair@425 | 86 | $(call ListPathsSafely_If,$1,$2,3501,3750) |
ohair@425 | 87 | $(call ListPathsSafely_If,$1,$2,3751,4000) |
ohair@425 | 88 | |
ohair@425 | 89 | $(call ListPathsSafely_If,$1,$2,4001,4250) |
ohair@425 | 90 | $(call ListPathsSafely_If,$1,$2,4251,4500) |
ohair@425 | 91 | $(call ListPathsSafely_If,$1,$2,4501,4750) |
ohair@425 | 92 | $(call ListPathsSafely_If,$1,$2,4751,5000) |
ohair@425 | 93 | |
ohair@425 | 94 | $(call ListPathsSafely_If,$1,$2,5001,5250) |
ohair@425 | 95 | $(call ListPathsSafely_If,$1,$2,5251,5500) |
ohair@425 | 96 | $(call ListPathsSafely_If,$1,$2,5501,5750) |
ohair@425 | 97 | $(call ListPathsSafely_If,$1,$2,5751,6000) |
ohair@425 | 98 | |
ohair@425 | 99 | $(call ListPathsSafely_If,$1,$2,6001,6250) |
ohair@425 | 100 | $(call ListPathsSafely_If,$1,$2,6251,6500) |
ohair@425 | 101 | $(call ListPathsSafely_If,$1,$2,6501,6750) |
ohair@425 | 102 | $(call ListPathsSafely_If,$1,$2,6751,7000) |
ohair@425 | 103 | |
ohair@425 | 104 | $(call ListPathsSafely_If,$1,$2,7001,7250) |
ohair@425 | 105 | $(call ListPathsSafely_If,$1,$2,7251,7500) |
ohair@425 | 106 | $(call ListPathsSafely_If,$1,$2,7501,7750) |
ohair@425 | 107 | $(call ListPathsSafely_If,$1,$2,7751,8000) |
ohair@425 | 108 | |
ohair@425 | 109 | $(call ListPathsSafely_If,$1,$2,8001,8250) |
ohair@425 | 110 | $(call ListPathsSafely_If,$1,$2,8251,8500) |
ohair@425 | 111 | $(call ListPathsSafely_If,$1,$2,8501,8750) |
ohair@425 | 112 | $(call ListPathsSafely_If,$1,$2,8751,9000) |
ohair@425 | 113 | |
ohair@425 | 114 | $(call ListPathsSafely_If,$1,$2,9001,9250) |
ohair@425 | 115 | $(call ListPathsSafely_If,$1,$2,9251,9500) |
ohair@425 | 116 | $(call ListPathsSafely_If,$1,$2,9501,9750) |
ohair@425 | 117 | $(call ListPathsSafely_If,$1,$2,9751,10000) |
ohair@425 | 118 | |
erikj@501 | 119 | $(call ListPathsSafely_If,$1,$2,10001,10250) |
erikj@501 | 120 | $(call ListPathsSafely_If,$1,$2,10251,10500) |
erikj@501 | 121 | $(call ListPathsSafely_If,$1,$2,10501,10750) |
erikj@501 | 122 | $(call ListPathsSafely_If,$1,$2,10751,11000) |
erikj@501 | 123 | |
erikj@501 | 124 | $(call ListPathsSafely_If,$1,$2,11001,11250) |
erikj@501 | 125 | $(call ListPathsSafely_If,$1,$2,11251,11500) |
erikj@501 | 126 | $(call ListPathsSafely_If,$1,$2,11501,11750) |
erikj@501 | 127 | $(call ListPathsSafely_If,$1,$2,11751,12000) |
erikj@501 | 128 | |
erikj@501 | 129 | $(call ListPathsSafely_If,$1,$2,12001,12250) |
erikj@501 | 130 | $(call ListPathsSafely_If,$1,$2,12251,12500) |
erikj@501 | 131 | $(call ListPathsSafely_If,$1,$2,12501,12750) |
erikj@501 | 132 | $(call ListPathsSafely_If,$1,$2,12751,13000) |
erikj@501 | 133 | |
erikj@501 | 134 | $(call ListPathsSafely_If,$1,$2,13001,13250) |
erikj@501 | 135 | $(call ListPathsSafely_If,$1,$2,13251,13500) |
erikj@501 | 136 | $(call ListPathsSafely_If,$1,$2,13501,13750) |
erikj@501 | 137 | $(call ListPathsSafely_If,$1,$2,13751,14000) |
erikj@501 | 138 | |
erikj@501 | 139 | $(call ListPathsSafely_If,$1,$2,14001,14250) |
erikj@501 | 140 | $(call ListPathsSafely_If,$1,$2,14251,14500) |
erikj@501 | 141 | $(call ListPathsSafely_If,$1,$2,14501,14750) |
erikj@501 | 142 | $(call ListPathsSafely_If,$1,$2,14751,15000) |
erikj@501 | 143 | |
erikj@501 | 144 | $(call ListPathsSafely_If,$1,$2,15001,15250) |
erikj@501 | 145 | $(call ListPathsSafely_If,$1,$2,15251,15500) |
erikj@501 | 146 | $(call ListPathsSafely_If,$1,$2,15501,15750) |
erikj@501 | 147 | $(call ListPathsSafely_If,$1,$2,15751,16000) |
erikj@501 | 148 | |
ohair@425 | 149 | $(call ListPathsSafely_Printf,$1,$2,$3,1) |
ohair@425 | 150 | $(call ListPathsSafely_Printf,$1,$2,$3,251) |
ohair@425 | 151 | $(call ListPathsSafely_Printf,$1,$2,$3,501) |
ohair@425 | 152 | $(call ListPathsSafely_Printf,$1,$2,$3,751) |
ohair@425 | 153 | |
ohair@425 | 154 | $(call ListPathsSafely_Printf,$1,$2,$3,1001) |
ohair@425 | 155 | $(call ListPathsSafely_Printf,$1,$2,$3,1251) |
ohair@425 | 156 | $(call ListPathsSafely_Printf,$1,$2,$3,1501) |
ohair@425 | 157 | $(call ListPathsSafely_Printf,$1,$2,$3,1751) |
ohair@425 | 158 | |
ohair@425 | 159 | $(call ListPathsSafely_Printf,$1,$2,$3,2001) |
ohair@425 | 160 | $(call ListPathsSafely_Printf,$1,$2,$3,2251) |
ohair@425 | 161 | $(call ListPathsSafely_Printf,$1,$2,$3,2501) |
ohair@425 | 162 | $(call ListPathsSafely_Printf,$1,$2,$3,2751) |
ohair@425 | 163 | |
ohair@425 | 164 | $(call ListPathsSafely_Printf,$1,$2,$3,3001) |
ohair@425 | 165 | $(call ListPathsSafely_Printf,$1,$2,$3,3251) |
ohair@425 | 166 | $(call ListPathsSafely_Printf,$1,$2,$3,3501) |
ohair@425 | 167 | $(call ListPathsSafely_Printf,$1,$2,$3,3751) |
ohair@425 | 168 | |
ohair@425 | 169 | $(call ListPathsSafely_Printf,$1,$2,$3,4001) |
ohair@425 | 170 | $(call ListPathsSafely_Printf,$1,$2,$3,4251) |
ohair@425 | 171 | $(call ListPathsSafely_Printf,$1,$2,$3,4501) |
ohair@425 | 172 | $(call ListPathsSafely_Printf,$1,$2,$3,4751) |
ohair@425 | 173 | |
ohair@425 | 174 | $(call ListPathsSafely_Printf,$1,$2,$3,5001) |
ohair@425 | 175 | $(call ListPathsSafely_Printf,$1,$2,$3,5251) |
ohair@425 | 176 | $(call ListPathsSafely_Printf,$1,$2,$3,5501) |
ohair@425 | 177 | $(call ListPathsSafely_Printf,$1,$2,$3,5751) |
ohair@425 | 178 | |
ohair@425 | 179 | $(call ListPathsSafely_Printf,$1,$2,$3,6001) |
ohair@425 | 180 | $(call ListPathsSafely_Printf,$1,$2,$3,6251) |
ohair@425 | 181 | $(call ListPathsSafely_Printf,$1,$2,$3,6501) |
ohair@425 | 182 | $(call ListPathsSafely_Printf,$1,$2,$3,6751) |
ohair@425 | 183 | |
ohair@425 | 184 | $(call ListPathsSafely_Printf,$1,$2,$3,7001) |
ohair@425 | 185 | $(call ListPathsSafely_Printf,$1,$2,$3,7251) |
ohair@425 | 186 | $(call ListPathsSafely_Printf,$1,$2,$3,7501) |
ohair@425 | 187 | $(call ListPathsSafely_Printf,$1,$2,$3,7751) |
ohair@425 | 188 | |
ohair@425 | 189 | $(call ListPathsSafely_Printf,$1,$2,$3,8001) |
ohair@425 | 190 | $(call ListPathsSafely_Printf,$1,$2,$3,8251) |
ohair@425 | 191 | $(call ListPathsSafely_Printf,$1,$2,$3,8501) |
ohair@425 | 192 | $(call ListPathsSafely_Printf,$1,$2,$3,8751) |
ohair@425 | 193 | |
ohair@425 | 194 | $(call ListPathsSafely_Printf,$1,$2,$3,9001) |
ohair@425 | 195 | $(call ListPathsSafely_Printf,$1,$2,$3,9251) |
ohair@425 | 196 | $(call ListPathsSafely_Printf,$1,$2,$3,9501) |
ohair@425 | 197 | $(call ListPathsSafely_Printf,$1,$2,$3,9751) |
erikj@501 | 198 | |
erikj@501 | 199 | $(call ListPathsSafely_Printf,$1,$2,$3,10001) |
erikj@501 | 200 | $(call ListPathsSafely_Printf,$1,$2,$3,10251) |
erikj@501 | 201 | $(call ListPathsSafely_Printf,$1,$2,$3,10501) |
erikj@501 | 202 | $(call ListPathsSafely_Printf,$1,$2,$3,10751) |
erikj@501 | 203 | |
erikj@501 | 204 | $(call ListPathsSafely_Printf,$1,$2,$3,11001) |
erikj@501 | 205 | $(call ListPathsSafely_Printf,$1,$2,$3,11251) |
erikj@501 | 206 | $(call ListPathsSafely_Printf,$1,$2,$3,11501) |
erikj@501 | 207 | $(call ListPathsSafely_Printf,$1,$2,$3,11751) |
erikj@501 | 208 | |
erikj@501 | 209 | $(call ListPathsSafely_Printf,$1,$2,$3,12001) |
erikj@501 | 210 | $(call ListPathsSafely_Printf,$1,$2,$3,12251) |
erikj@501 | 211 | $(call ListPathsSafely_Printf,$1,$2,$3,12501) |
erikj@501 | 212 | $(call ListPathsSafely_Printf,$1,$2,$3,12751) |
erikj@501 | 213 | |
erikj@501 | 214 | $(call ListPathsSafely_Printf,$1,$2,$3,13001) |
erikj@501 | 215 | $(call ListPathsSafely_Printf,$1,$2,$3,13251) |
erikj@501 | 216 | $(call ListPathsSafely_Printf,$1,$2,$3,13501) |
erikj@501 | 217 | $(call ListPathsSafely_Printf,$1,$2,$3,13751) |
erikj@501 | 218 | |
erikj@501 | 219 | $(call ListPathsSafely_Printf,$1,$2,$3,14001) |
erikj@501 | 220 | $(call ListPathsSafely_Printf,$1,$2,$3,14251) |
erikj@501 | 221 | $(call ListPathsSafely_Printf,$1,$2,$3,14501) |
erikj@501 | 222 | $(call ListPathsSafely_Printf,$1,$2,$3,14751) |
erikj@501 | 223 | |
erikj@501 | 224 | $(call ListPathsSafely_Printf,$1,$2,$3,15001) |
erikj@501 | 225 | $(call ListPathsSafely_Printf,$1,$2,$3,15251) |
erikj@501 | 226 | $(call ListPathsSafely_Printf,$1,$2,$3,15501) |
erikj@501 | 227 | $(call ListPathsSafely_Printf,$1,$2,$3,15751) |
ohair@425 | 228 | endef |
ohair@425 | 229 | |
ohair@425 | 230 | define ListPathsSafelyNow_IfPrintf |
ohair@425 | 231 | ifneq (,$$(word $4,$$($1))) |
ohair@425 | 232 | $$(eval $1_LPS$4:=$$(call compress_paths,$$(wordlist $4,$5,$$($1)))) |
ohair@425 | 233 | $$(shell printf -- "$$(strip $$($1_LPS$4))\n" | $(decompress_paths) $3) |
ohair@425 | 234 | endif |
ohair@425 | 235 | endef |
ohair@425 | 236 | |
ohair@425 | 237 | # And an non-receipt version: |
ohair@425 | 238 | define ListPathsSafelyNow |
ohair@425 | 239 | ifneq (,$$(word 10001,$$($1))) |
ohair@425 | 240 | $$(error Cannot list safely more than 10000 paths. $1 has $$(words $$($1)) paths!) |
ohair@425 | 241 | endif |
ohair@425 | 242 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1,250) |
ohair@425 | 243 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,251,500) |
ohair@425 | 244 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,501,750) |
ohair@425 | 245 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,751,1000) |
ohair@425 | 246 | |
ohair@425 | 247 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1001,1250) |
ohair@425 | 248 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1251,1500) |
ohair@425 | 249 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1501,1750) |
ohair@425 | 250 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1751,2000) |
ohair@425 | 251 | |
ohair@425 | 252 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2001,2250) |
ohair@425 | 253 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2251,2500) |
ohair@425 | 254 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2501,2750) |
ohair@425 | 255 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2751,3000) |
ohair@425 | 256 | |
ohair@425 | 257 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3001,3250) |
ohair@425 | 258 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3251,3500) |
ohair@425 | 259 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3501,3750) |
ohair@425 | 260 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3751,4000) |
ohair@425 | 261 | |
ohair@425 | 262 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4001,4250) |
ohair@425 | 263 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4251,4500) |
ohair@425 | 264 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4501,4750) |
ohair@425 | 265 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4751,5000) |
ohair@425 | 266 | |
ohair@425 | 267 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5001,5250) |
ohair@425 | 268 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5251,5500) |
ohair@425 | 269 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5501,5750) |
ohair@425 | 270 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5751,6000) |
ohair@425 | 271 | |
ohair@425 | 272 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6001,6250) |
ohair@425 | 273 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6251,6500) |
ohair@425 | 274 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6501,6750) |
ohair@425 | 275 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6751,7000) |
ohair@425 | 276 | |
ohair@425 | 277 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7001,7250) |
ohair@425 | 278 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7251,7500) |
ohair@425 | 279 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7501,7750) |
ohair@425 | 280 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7751,8000) |
ohair@425 | 281 | |
ohair@425 | 282 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8001,8250) |
ohair@425 | 283 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8251,8500) |
ohair@425 | 284 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8501,8750) |
ohair@425 | 285 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8751,9000) |
ohair@425 | 286 | |
ohair@425 | 287 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9001,9250) |
ohair@425 | 288 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9251,9500) |
ohair@425 | 289 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9501,9750) |
ohair@425 | 290 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9751,10000) |
ohair@425 | 291 | |
ohair@425 | 292 | endef |
ohair@425 | 293 | |
erikj@445 | 294 | # The source tips can come from the Mercurial repository, or in the files |
erikj@445 | 295 | # $(HGTIP_FILENAME) which contains the tip but is also positioned in the same |
erikj@445 | 296 | # directory as the original $(HGDIR) directory. |
erikj@445 | 297 | # These should not be := assignments, only used from the root Makefile. |
erikj@445 | 298 | HG_VERSION = $(shell $(HG) version 2> /dev/null) |
erikj@445 | 299 | HG_DIRECTORY=.hg |
erikj@445 | 300 | HGTIP_FILENAME=.hgtip |
erikj@445 | 301 | HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO |
erikj@445 | 302 | REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \ |
erikj@445 | 303 | $(shell $(CD) $(SRC_ROOT) ; ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \ |
erikj@445 | 304 | $(LS) $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \ |
erikj@445 | 305 | 2> /dev/null))))) |
erikj@445 | 306 | |
erikj@445 | 307 | # Emit the repo:tip pairs to $@ |
erikj@445 | 308 | define GetSourceTips |
erikj@445 | 309 | $(CD) $(SRC_ROOT) ; \ |
erikj@445 | 310 | for i in $(REPO_LIST) IGNORE ; do \ |
erikj@445 | 311 | if [ "$${i}" = "IGNORE" ] ; then \ |
erikj@445 | 312 | continue; \ |
erikj@445 | 313 | elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \ |
erikj@445 | 314 | $(PRINTF) " %s:%s" \ |
erikj@445 | 315 | "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \ |
erikj@445 | 316 | elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \ |
erikj@445 | 317 | $(PRINTF) " %s:%s" \ |
erikj@445 | 318 | "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \ |
erikj@445 | 319 | fi; \ |
erikj@445 | 320 | done >> $@ |
erikj@445 | 321 | $(PRINTF) "\n" >> $@ |
erikj@445 | 322 | endef |
erikj@445 | 323 | |
erikj@445 | 324 | # Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk |
erikj@445 | 325 | define CreateHgTip |
erikj@445 | 326 | $(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME);\ |
erikj@445 | 327 | $(ECHO) $1/$(HGTIP_FILENAME) |
erikj@445 | 328 | endef |
erikj@445 | 329 | |
erikj@445 | 330 | define SetupLogging |
erikj@673 | 331 | ifeq ($$(LOG_LEVEL),trace) |
erikj@445 | 332 | # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make |
ohair@494 | 333 | # For each target executed, will print |
ohair@494 | 334 | # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer) |
ohair@494 | 335 | # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much (and causing a crash on Cygwin). |
erikj@445 | 336 | OLD_SHELL:=$$(SHELL) |
ohair@494 | 337 | WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL) |
ohair@494 | 338 | SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL) |
ohair@494 | 339 | endif |
ohair@494 | 340 | # Never remove warning messages; this is just for completeness |
ohair@494 | 341 | LOG_WARN= |
erikj@673 | 342 | ifneq ($$(findstring $$(LOG_LEVEL),info debug trace),) |
ohair@494 | 343 | LOG_INFO= |
ohair@494 | 344 | else |
ohair@494 | 345 | LOG_INFO=> /dev/null |
ohair@494 | 346 | endif |
erikj@673 | 347 | ifneq ($$(findstring $$(LOG_LEVEL),debug trace),) |
ohair@494 | 348 | LOG_DEBUG= |
ohair@494 | 349 | else |
ohair@494 | 350 | LOG_DEBUG=> /dev/null |
ohair@494 | 351 | endif |
erikj@673 | 352 | ifneq ($$(findstring $$(LOG_LEVEL),trace),) |
ohair@494 | 353 | LOG_TRACE= |
ohair@494 | 354 | else |
ohair@494 | 355 | LOG_TRACE=> /dev/null |
erikj@445 | 356 | endif |
erikj@445 | 357 | endef |
erikj@445 | 358 | |
erikj@445 | 359 | # Make sure logging is setup for everyone that includes MakeBase.gmk. |
erikj@445 | 360 | $(eval $(call SetupLogging)) |
erikj@445 | 361 | |
ohair@494 | 362 | # This is to be called by all SetupFoo macros |
ohair@494 | 363 | define LogSetupMacroEntry |
erikj@725 | 364 | $(if $(27),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk)) |
erikj@725 | 365 | $(if $(findstring $(LOG_LEVEL),debug trace), $(info $1 $(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26,$(if $($i),$(NEWLINE) $(strip [$i] $($i)))))) |
ohair@494 | 366 | endef |
ohair@494 | 367 | |
ohair@494 | 368 | # Make directory without forking mkdir if not needed |
ohair@494 | 369 | define MakeDir |
ohair@494 | 370 | ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)) |
ohair@494 | 371 | $$(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9) |
ohair@494 | 372 | endif |
ohair@494 | 373 | endef |
ohair@494 | 374 | |
ohair@494 | 375 | ifeq ($(OPENJDK_TARGET_OS),solaris) |
ohair@494 | 376 | # On Solaris, if the target is a symlink and exists, cp won't overwrite. |
erikj@670 | 377 | # Cp has to operate in recursive mode to allow for -P flag, to preserve soft links. If the |
erikj@670 | 378 | # name of the target file differs from the source file, rename after copy. |
ohair@494 | 379 | define install-file |
ohair@494 | 380 | $(MKDIR) -p $(@D) |
ohair@494 | 381 | $(RM) '$@' |
ohair@494 | 382 | $(CP) -f -r -P '$<' '$(@D)' |
erikj@670 | 383 | if [ "$(@F)" != "$(<F)" ]; then $(MV) '$(@D)/$(<F)' '$@'; fi |
ohair@494 | 384 | endef |
ohair@494 | 385 | else ifeq ($(OPENJDK_TARGET_OS),macosx) |
erikj@670 | 386 | # On mac, extended attributes sometimes creep into the source files, which may later |
erikj@670 | 387 | # cause the creation of ._* files which confuses testing. Clear these with xattr if |
erikj@670 | 388 | # set. Some files get their write permissions removed after being copied to the |
erikj@670 | 389 | # output dir. When these are copied again to images, xattr would fail. By only clearing |
erikj@670 | 390 | # attributes when they are present, failing on this is avoided. |
ohair@494 | 391 | define install-file |
ohair@494 | 392 | $(MKDIR) -p $(@D) |
erikj@670 | 393 | $(CP) -fRP '$<' '$@' |
erikj@670 | 394 | if [ -n "`$(XATTR) -l '$@'`" ]; then $(XATTR) -c '$@'; fi |
ohair@494 | 395 | endef |
ohair@494 | 396 | else |
ohair@494 | 397 | define install-file |
ohair@494 | 398 | $(MKDIR) -p $(@D) |
ohair@494 | 399 | $(CP) -fP '$<' '$@' |
ohair@494 | 400 | endef |
ohair@494 | 401 | endif |
ohair@494 | 402 | |
erikj@557 | 403 | # Convenience functions for working around make's limitations with $(filter ). |
erikj@557 | 404 | containing = $(foreach v,$2,$(if $(findstring $1,$v),$v)) |
erikj@557 | 405 | not-containing = $(foreach v,$2,$(if $(findstring $1,$v),,$v)) |
erikj@557 | 406 | |
erikj@557 | 407 | ################################################################################ |
erikj@557 | 408 | # In Cygwin, finds are very costly, both because of expensive forks and because |
erikj@557 | 409 | # of bad file system caching. Find is used extensively in $(shell) commands to |
erikj@557 | 410 | # find source files. This makes rerunning make with no or few changes rather |
erikj@557 | 411 | # expensive. To speed this up, these two macros are used to cache the results |
erikj@557 | 412 | # of simple find commands for reuse. |
erikj@557 | 413 | # |
erikj@557 | 414 | # Runs a find and stores both the directories where it was run and the results. |
erikj@557 | 415 | # This macro can be called multiple times to add to the cache. Only finds files |
erikj@557 | 416 | # with no filters. |
erikj@557 | 417 | # |
erikj@557 | 418 | # Needs to be called with $(eval ) |
erikj@557 | 419 | # |
erikj@557 | 420 | # Param 1 - Dir to find in |
erikj@557 | 421 | ifeq ($(OPENJDK_BUILD_OS),windows) |
erikj@557 | 422 | define FillCacheFind |
erikj@557 | 423 | FIND_CACHE_DIR += $1 |
erikj@557 | 424 | FIND_CACHE := $$(sort $$(FIND_CACHE) $$(shell $(FIND) $1 -type f -o -type l)) |
erikj@557 | 425 | endef |
erikj@557 | 426 | else |
erikj@557 | 427 | define FillCacheFind |
erikj@557 | 428 | endef |
erikj@557 | 429 | endif |
erikj@557 | 430 | |
erikj@557 | 431 | # Mimics find by looking in the cache if all of the directories have been cached. |
erikj@557 | 432 | # Otherwise reverts to shell find. This is safe to call on all platforms, even if |
erikj@557 | 433 | # cache is deactivated. |
erikj@557 | 434 | # |
erikj@557 | 435 | # The extra - is needed when FIND_CACHE_DIR is empty but should be harmless. |
erikj@557 | 436 | # Param 1 - Dirs to find in |
erikj@557 | 437 | define CacheFind |
erikj@557 | 438 | $(if $(filter-out $(addsuffix %,- $(FIND_CACHE_DIR)),$1),\ |
erikj@557 | 439 | $(shell $(FIND) $1 -type f -o -type l),\ |
erikj@557 | 440 | $(filter $(addsuffix %,$1),$(FIND_CACHE))) |
erikj@557 | 441 | endef |
erikj@557 | 442 | |
erikj@557 | 443 | ################################################################################ |
erikj@557 | 444 | |
ohair@425 | 445 | endif # _MAKEBASE_GMK |