Tue, 18 Sep 2012 11:29:16 -0700
7197849: Update new build-infra makefiles
Reviewed-by: ihse, erikj, ohrstrom, 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 | ifeq (,$(findstring 3.81,$(MAKE_VERSION))) |
ohair@425 | 37 | ifeq (,$(findstring 3.82,$(MAKE_VERSION))) |
ohair@425 | 38 | $(error This version of GNU Make is too low ($(MAKE_VERSION)). Please upgrade to 3.81 or newer.) |
ohair@425 | 39 | endif |
ohair@425 | 40 | endif |
ohair@425 | 41 | |
ohair@425 | 42 | ifneq (,$(CYGPATH)) |
ohair@425 | 43 | # Cygwin styff, if needed but most is going to be |
ohair@425 | 44 | # done in configure! |
ohair@425 | 45 | ifeq (yes,$(CHECK_FOR_VCINSTALLDIR)) |
ohair@425 | 46 | ifeq (,$(VCINSTALLDIR)) |
ohair@425 | 47 | $(info Could not find compiler paths!) |
ohair@425 | 48 | $(info You probably configured the build from within a) |
ohair@425 | 49 | $(info VS command prompt, but you are not using such a) |
ohair@425 | 50 | $(info prompt right now.) |
ohair@425 | 51 | $(info If you instead run configure from a plain cygwin shell, it) |
ohair@425 | 52 | $(info will attempt to setup VS for you! Please try that.) |
ohair@425 | 53 | $(error Giving up for now.) |
ohair@425 | 54 | endif |
ohair@425 | 55 | endif |
ohair@425 | 56 | endif |
ohair@425 | 57 | |
ohair@425 | 58 | # The build times report is turned off by setting REPORT_BUILD_TIMES to nothing. |
ohair@425 | 59 | # This is necessary for the target clean which will erase the |
ohair@425 | 60 | # directories where the buildtimes are stored. |
ohair@425 | 61 | REPORT_BUILD_TIMES=1 |
ohair@425 | 62 | # Store the build times in this directory. |
ohair@425 | 63 | BUILDTIMESDIR=$(OUTPUT_ROOT)/tmp/buildtimes |
ohair@425 | 64 | |
ohair@425 | 65 | # Record starting time for build of a sub repository. |
ohair@425 | 66 | define RecordStartTime |
ohair@425 | 67 | $(MKDIR) -p $(BUILDTIMESDIR) |
ohair@425 | 68 | $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1 |
ohair@425 | 69 | $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable |
ohair@425 | 70 | endef |
ohair@425 | 71 | |
ohair@425 | 72 | # Indicate that we started to build a sub repository and record starting time. |
ohair@425 | 73 | define MakeStart |
ohair@425 | 74 | $(call RecordStartTime,$1) |
ohair@425 | 75 | $(BUILD_LOG_WRAPPER) $(PRINTF) "\n\n%s\n%s\n##### %-60.60s #####\n%s\n\n" \ |
ohair@425 | 76 | "########################################################################" \ |
ohair@425 | 77 | "########################################################################" \ |
ohair@425 | 78 | "Entering $1 for target(s) $2" \ |
ohair@425 | 79 | "########################################################################" |
ohair@425 | 80 | endef |
ohair@425 | 81 | |
ohair@425 | 82 | # Record ending time and calculate the difference and store it in a |
ohair@425 | 83 | # easy to read format. Handles builds that cross midnight. Expects |
ohair@425 | 84 | # that a build will never take 24 hours or more. |
ohair@425 | 85 | define RecordEndTime |
ohair@425 | 86 | $(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1 |
ohair@425 | 87 | $(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable |
ohair@425 | 88 | $(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \ |
ohair@425 | 89 | $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \ |
ohair@425 | 90 | M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \ |
ohair@425 | 91 | > $(BUILDTIMESDIR)/build_time_diff_$1 |
ohair@425 | 92 | endef |
ohair@425 | 93 | |
erikj@445 | 94 | # Check if the current target is the final target, as specified by |
erikj@445 | 95 | # the user on the command line. If so, call PrintEndMessage. |
erikj@445 | 96 | define CheckIfFinished |
erikj@445 | 97 | $(if $(filter $@,$(MAKECMDGOALS)),$(call PrintEndMessage)) |
erikj@445 | 98 | # If no taget is given, "all" is default. Check for that, too. |
erikj@445 | 99 | # At most one of the tests can be true. |
erikj@445 | 100 | $(if $(MAKECMDGOALS),,$(if $(filter $@,all),$(call PrintEndMessage))) |
erikj@445 | 101 | endef |
erikj@445 | 102 | |
ohair@425 | 103 | # Indicate that we are done. |
ohair@425 | 104 | # Record ending time and print out the total time it took to build. |
ohair@425 | 105 | define MakeFinish |
ohair@425 | 106 | $(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,$1),) |
ohair@425 | 107 | $(BUILD_LOG_WRAPPER) $(PRINTF) "%s\n##### %-60.60s #####\n%s\n##### %-60.60s #####\n%s\n\n" \ |
ohair@425 | 108 | "########################################################################" \ |
ohair@425 | 109 | "Leaving $1 for target(s) $2" \ |
ohair@425 | 110 | "########################################################################" \ |
ohair@425 | 111 | $(if $(REPORT_BUILD_TIMES),"Build time `$(CAT) $(BUILDTIMESDIR)/build_time_diff_$1` for target(s) $2","") \ |
ohair@425 | 112 | "########################################################################" |
erikj@445 | 113 | $(call CheckIfFinished) |
ohair@425 | 114 | endef |
ohair@425 | 115 | |
ohair@425 | 116 | # Find all build_time_* files and print their contents in a list sorted |
ohair@425 | 117 | # on the name of the sub repository. |
ohair@425 | 118 | define ReportBuildTimes |
ohair@425 | 119 | $(BUILD_LOG_WRAPPER) $(PRINTF) -- "-- Build times ----------\nTarget %s\nStart %s\nEnd %s\n%s\n%s\n-------------------------\n" \ |
ohair@425 | 120 | "$1" \ |
ohair@425 | 121 | "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \ |
ohair@425 | 122 | "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \ |
ohair@425 | 123 | "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \ |
ohair@425 | 124 | "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`" |
ohair@425 | 125 | endef |
ohair@425 | 126 | |
ohair@425 | 127 | define ResetTimers |
ohair@425 | 128 | $$(shell $(MKDIR) -p $(BUILDTIMESDIR) && $(RM) $(BUILDTIMESDIR)/build_time_*) |
ohair@425 | 129 | endef |
ohair@425 | 130 | |
ohair@425 | 131 | define StartTimer |
ohair@425 | 132 | $(call RecordStartTime,TOTAL) |
ohair@425 | 133 | endef |
ohair@425 | 134 | |
ohair@425 | 135 | define StopTimer |
ohair@425 | 136 | $(if $(REPORT_BUILD_TIMES),$(call RecordEndTime,TOTAL) && $(call ReportBuildTimes,$1),) |
ohair@425 | 137 | endef |
ohair@425 | 138 | |
erikj@445 | 139 | # Hook to be called as the very first thing when running a normal build |
erikj@445 | 140 | define AtRootMakeStart |
ohair@478 | 141 | $(if $(findstring --jobserver,$(MAKEFLAGS)), $(error make -j is not supported, use make JOBS=n)) |
erikj@445 | 142 | $(call PrintStartMessage) |
erikj@445 | 143 | $(call StartTimer) |
erikj@445 | 144 | endef |
erikj@445 | 145 | |
erikj@445 | 146 | # Hook to be called as the very last thing for targets that are "top level" targets |
erikj@445 | 147 | define AtRootMakeEnd |
erikj@445 | 148 | $(call StopTimer) |
erikj@445 | 149 | $(call CheckIfFinished) |
erikj@445 | 150 | endef |
erikj@445 | 151 | |
ohair@425 | 152 | # If the variable that you want to send to stdout for piping into a file or otherwise, |
ohair@425 | 153 | # is potentially long, for example the a list of file paths, eg a list of all package directories. |
ohair@425 | 154 | # Then you need to use ListPathsSafely, which optimistically splits the output into several shell |
ohair@425 | 155 | # calls as well as use compression on recurrent file paths segments, to get around the potential |
ohair@425 | 156 | # command line length problem that exists in cygwin and other shells. |
ohair@425 | 157 | compress_pre:=$(strip $(shell cat $(SRC_ROOT)/common/makefiles/compress.pre)) |
ohair@425 | 158 | compress_post:=$(strip $(shell cat $(SRC_ROOT)/common/makefiles/compress.post)) |
ohair@425 | 159 | compress_paths=$(compress_pre)\ |
ohair@425 | 160 | $(subst $(SRC_ROOT),X97,\ |
ohair@425 | 161 | $(subst $(OUTPUT_ROOT),X98,\ |
ohair@425 | 162 | $(subst X,X00,\ |
ohair@425 | 163 | $(subst $(SPACE),\n,$(strip $1)))))\ |
ohair@425 | 164 | $(compress_post) |
ohair@425 | 165 | |
ohair@425 | 166 | decompress_paths=sed -f $(SRC_ROOT)/common/makefiles/uncompress.sed -e 's|X99|\\n|g' \ |
ohair@425 | 167 | -e 's|X98|$(OUTPUT_ROOT)|g' -e 's|X97|$(SRC_ROOT)|g' \ |
ohair@425 | 168 | -e 's|X00|X|g' | tr '\n' '$2' |
ohair@425 | 169 | |
ohair@425 | 170 | define ListPathsSafely_If |
ohair@425 | 171 | $(if $(word $3,$($1)),$(eval $1_LPS$3:=$(call compress_paths,$(wordlist $3,$4,$($1))))) |
ohair@425 | 172 | endef |
ohair@425 | 173 | |
ohair@425 | 174 | define ListPathsSafely_Printf |
ohair@425 | 175 | $(if $(strip $($1_LPS$4)),printf -- "$(strip $($1_LPS$4))\n" | $(decompress_paths) $3) |
ohair@425 | 176 | endef |
ohair@425 | 177 | |
ohair@425 | 178 | # Receipt example: |
ohair@425 | 179 | # rm -f thepaths |
ohair@425 | 180 | # $(call ListPathsSafely,THEPATHS,\n, >> thepaths) |
ohair@425 | 181 | # The \n argument means translate spaces into \n |
ohair@425 | 182 | # if instead , , (a space) is supplied, then spaces remain spaces. |
ohair@425 | 183 | define ListPathsSafely |
ohair@425 | 184 | $(if $(word 10001,$($1)),$(error Cannot list safely more than 10000 paths. $1 has $(words $($1)) paths!)) |
ohair@425 | 185 | $(call ListPathsSafely_If,$1,$2,1,250) |
ohair@425 | 186 | $(call ListPathsSafely_If,$1,$2,251,500) |
ohair@425 | 187 | $(call ListPathsSafely_If,$1,$2,501,750) |
ohair@425 | 188 | $(call ListPathsSafely_If,$1,$2,751,1000) |
ohair@425 | 189 | |
ohair@425 | 190 | $(call ListPathsSafely_If,$1,$2,1001,1250) |
ohair@425 | 191 | $(call ListPathsSafely_If,$1,$2,1251,1500) |
ohair@425 | 192 | $(call ListPathsSafely_If,$1,$2,1501,1750) |
ohair@425 | 193 | $(call ListPathsSafely_If,$1,$2,1751,2000) |
ohair@425 | 194 | |
ohair@425 | 195 | $(call ListPathsSafely_If,$1,$2,2001,2250) |
ohair@425 | 196 | $(call ListPathsSafely_If,$1,$2,2251,2500) |
ohair@425 | 197 | $(call ListPathsSafely_If,$1,$2,2501,2750) |
ohair@425 | 198 | $(call ListPathsSafely_If,$1,$2,2751,3000) |
ohair@425 | 199 | |
ohair@425 | 200 | $(call ListPathsSafely_If,$1,$2,3001,3250) |
ohair@425 | 201 | $(call ListPathsSafely_If,$1,$2,3251,3500) |
ohair@425 | 202 | $(call ListPathsSafely_If,$1,$2,3501,3750) |
ohair@425 | 203 | $(call ListPathsSafely_If,$1,$2,3751,4000) |
ohair@425 | 204 | |
ohair@425 | 205 | $(call ListPathsSafely_If,$1,$2,4001,4250) |
ohair@425 | 206 | $(call ListPathsSafely_If,$1,$2,4251,4500) |
ohair@425 | 207 | $(call ListPathsSafely_If,$1,$2,4501,4750) |
ohair@425 | 208 | $(call ListPathsSafely_If,$1,$2,4751,5000) |
ohair@425 | 209 | |
ohair@425 | 210 | $(call ListPathsSafely_If,$1,$2,5001,5250) |
ohair@425 | 211 | $(call ListPathsSafely_If,$1,$2,5251,5500) |
ohair@425 | 212 | $(call ListPathsSafely_If,$1,$2,5501,5750) |
ohair@425 | 213 | $(call ListPathsSafely_If,$1,$2,5751,6000) |
ohair@425 | 214 | |
ohair@425 | 215 | $(call ListPathsSafely_If,$1,$2,6001,6250) |
ohair@425 | 216 | $(call ListPathsSafely_If,$1,$2,6251,6500) |
ohair@425 | 217 | $(call ListPathsSafely_If,$1,$2,6501,6750) |
ohair@425 | 218 | $(call ListPathsSafely_If,$1,$2,6751,7000) |
ohair@425 | 219 | |
ohair@425 | 220 | $(call ListPathsSafely_If,$1,$2,7001,7250) |
ohair@425 | 221 | $(call ListPathsSafely_If,$1,$2,7251,7500) |
ohair@425 | 222 | $(call ListPathsSafely_If,$1,$2,7501,7750) |
ohair@425 | 223 | $(call ListPathsSafely_If,$1,$2,7751,8000) |
ohair@425 | 224 | |
ohair@425 | 225 | $(call ListPathsSafely_If,$1,$2,8001,8250) |
ohair@425 | 226 | $(call ListPathsSafely_If,$1,$2,8251,8500) |
ohair@425 | 227 | $(call ListPathsSafely_If,$1,$2,8501,8750) |
ohair@425 | 228 | $(call ListPathsSafely_If,$1,$2,8751,9000) |
ohair@425 | 229 | |
ohair@425 | 230 | $(call ListPathsSafely_If,$1,$2,9001,9250) |
ohair@425 | 231 | $(call ListPathsSafely_If,$1,$2,9251,9500) |
ohair@425 | 232 | $(call ListPathsSafely_If,$1,$2,9501,9750) |
ohair@425 | 233 | $(call ListPathsSafely_If,$1,$2,9751,10000) |
ohair@425 | 234 | |
ohair@425 | 235 | $(call ListPathsSafely_Printf,$1,$2,$3,1) |
ohair@425 | 236 | $(call ListPathsSafely_Printf,$1,$2,$3,251) |
ohair@425 | 237 | $(call ListPathsSafely_Printf,$1,$2,$3,501) |
ohair@425 | 238 | $(call ListPathsSafely_Printf,$1,$2,$3,751) |
ohair@425 | 239 | |
ohair@425 | 240 | $(call ListPathsSafely_Printf,$1,$2,$3,1001) |
ohair@425 | 241 | $(call ListPathsSafely_Printf,$1,$2,$3,1251) |
ohair@425 | 242 | $(call ListPathsSafely_Printf,$1,$2,$3,1501) |
ohair@425 | 243 | $(call ListPathsSafely_Printf,$1,$2,$3,1751) |
ohair@425 | 244 | |
ohair@425 | 245 | $(call ListPathsSafely_Printf,$1,$2,$3,2001) |
ohair@425 | 246 | $(call ListPathsSafely_Printf,$1,$2,$3,2251) |
ohair@425 | 247 | $(call ListPathsSafely_Printf,$1,$2,$3,2501) |
ohair@425 | 248 | $(call ListPathsSafely_Printf,$1,$2,$3,2751) |
ohair@425 | 249 | |
ohair@425 | 250 | $(call ListPathsSafely_Printf,$1,$2,$3,3001) |
ohair@425 | 251 | $(call ListPathsSafely_Printf,$1,$2,$3,3251) |
ohair@425 | 252 | $(call ListPathsSafely_Printf,$1,$2,$3,3501) |
ohair@425 | 253 | $(call ListPathsSafely_Printf,$1,$2,$3,3751) |
ohair@425 | 254 | |
ohair@425 | 255 | $(call ListPathsSafely_Printf,$1,$2,$3,4001) |
ohair@425 | 256 | $(call ListPathsSafely_Printf,$1,$2,$3,4251) |
ohair@425 | 257 | $(call ListPathsSafely_Printf,$1,$2,$3,4501) |
ohair@425 | 258 | $(call ListPathsSafely_Printf,$1,$2,$3,4751) |
ohair@425 | 259 | |
ohair@425 | 260 | $(call ListPathsSafely_Printf,$1,$2,$3,5001) |
ohair@425 | 261 | $(call ListPathsSafely_Printf,$1,$2,$3,5251) |
ohair@425 | 262 | $(call ListPathsSafely_Printf,$1,$2,$3,5501) |
ohair@425 | 263 | $(call ListPathsSafely_Printf,$1,$2,$3,5751) |
ohair@425 | 264 | |
ohair@425 | 265 | $(call ListPathsSafely_Printf,$1,$2,$3,6001) |
ohair@425 | 266 | $(call ListPathsSafely_Printf,$1,$2,$3,6251) |
ohair@425 | 267 | $(call ListPathsSafely_Printf,$1,$2,$3,6501) |
ohair@425 | 268 | $(call ListPathsSafely_Printf,$1,$2,$3,6751) |
ohair@425 | 269 | |
ohair@425 | 270 | $(call ListPathsSafely_Printf,$1,$2,$3,7001) |
ohair@425 | 271 | $(call ListPathsSafely_Printf,$1,$2,$3,7251) |
ohair@425 | 272 | $(call ListPathsSafely_Printf,$1,$2,$3,7501) |
ohair@425 | 273 | $(call ListPathsSafely_Printf,$1,$2,$3,7751) |
ohair@425 | 274 | |
ohair@425 | 275 | $(call ListPathsSafely_Printf,$1,$2,$3,8001) |
ohair@425 | 276 | $(call ListPathsSafely_Printf,$1,$2,$3,8251) |
ohair@425 | 277 | $(call ListPathsSafely_Printf,$1,$2,$3,8501) |
ohair@425 | 278 | $(call ListPathsSafely_Printf,$1,$2,$3,8751) |
ohair@425 | 279 | |
ohair@425 | 280 | $(call ListPathsSafely_Printf,$1,$2,$3,9001) |
ohair@425 | 281 | $(call ListPathsSafely_Printf,$1,$2,$3,9251) |
ohair@425 | 282 | $(call ListPathsSafely_Printf,$1,$2,$3,9501) |
ohair@425 | 283 | $(call ListPathsSafely_Printf,$1,$2,$3,9751) |
ohair@425 | 284 | endef |
ohair@425 | 285 | |
ohair@425 | 286 | define ListPathsSafelyNow_IfPrintf |
ohair@425 | 287 | ifneq (,$$(word $4,$$($1))) |
ohair@425 | 288 | $$(eval $1_LPS$4:=$$(call compress_paths,$$(wordlist $4,$5,$$($1)))) |
ohair@425 | 289 | $$(shell printf -- "$$(strip $$($1_LPS$4))\n" | $(decompress_paths) $3) |
ohair@425 | 290 | endif |
ohair@425 | 291 | endef |
ohair@425 | 292 | |
ohair@425 | 293 | # And an non-receipt version: |
ohair@425 | 294 | define ListPathsSafelyNow |
ohair@425 | 295 | ifneq (,$$(word 10001,$$($1))) |
ohair@425 | 296 | $$(error Cannot list safely more than 10000 paths. $1 has $$(words $$($1)) paths!) |
ohair@425 | 297 | endif |
ohair@425 | 298 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1,250) |
ohair@425 | 299 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,251,500) |
ohair@425 | 300 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,501,750) |
ohair@425 | 301 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,751,1000) |
ohair@425 | 302 | |
ohair@425 | 303 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1001,1250) |
ohair@425 | 304 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1251,1500) |
ohair@425 | 305 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1501,1750) |
ohair@425 | 306 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1751,2000) |
ohair@425 | 307 | |
ohair@425 | 308 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2001,2250) |
ohair@425 | 309 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2251,2500) |
ohair@425 | 310 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2501,2750) |
ohair@425 | 311 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2751,3000) |
ohair@425 | 312 | |
ohair@425 | 313 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3001,3250) |
ohair@425 | 314 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3251,3500) |
ohair@425 | 315 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3501,3750) |
ohair@425 | 316 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3751,4000) |
ohair@425 | 317 | |
ohair@425 | 318 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4001,4250) |
ohair@425 | 319 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4251,4500) |
ohair@425 | 320 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4501,4750) |
ohair@425 | 321 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4751,5000) |
ohair@425 | 322 | |
ohair@425 | 323 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5001,5250) |
ohair@425 | 324 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5251,5500) |
ohair@425 | 325 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5501,5750) |
ohair@425 | 326 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5751,6000) |
ohair@425 | 327 | |
ohair@425 | 328 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6001,6250) |
ohair@425 | 329 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6251,6500) |
ohair@425 | 330 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6501,6750) |
ohair@425 | 331 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6751,7000) |
ohair@425 | 332 | |
ohair@425 | 333 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7001,7250) |
ohair@425 | 334 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7251,7500) |
ohair@425 | 335 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7501,7750) |
ohair@425 | 336 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7751,8000) |
ohair@425 | 337 | |
ohair@425 | 338 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8001,8250) |
ohair@425 | 339 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8251,8500) |
ohair@425 | 340 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8501,8750) |
ohair@425 | 341 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8751,9000) |
ohair@425 | 342 | |
ohair@425 | 343 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9001,9250) |
ohair@425 | 344 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9251,9500) |
ohair@425 | 345 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9501,9750) |
ohair@425 | 346 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9751,10000) |
ohair@425 | 347 | |
ohair@425 | 348 | endef |
ohair@425 | 349 | |
erikj@445 | 350 | # The source tips can come from the Mercurial repository, or in the files |
erikj@445 | 351 | # $(HGTIP_FILENAME) which contains the tip but is also positioned in the same |
erikj@445 | 352 | # directory as the original $(HGDIR) directory. |
erikj@445 | 353 | # These should not be := assignments, only used from the root Makefile. |
erikj@445 | 354 | HG_VERSION = $(shell $(HG) version 2> /dev/null) |
erikj@445 | 355 | HG_DIRECTORY=.hg |
erikj@445 | 356 | HGTIP_FILENAME=.hgtip |
erikj@445 | 357 | HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO |
erikj@445 | 358 | REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \ |
erikj@445 | 359 | $(shell $(CD) $(SRC_ROOT) ; ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \ |
erikj@445 | 360 | $(LS) $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \ |
erikj@445 | 361 | 2> /dev/null))))) |
erikj@445 | 362 | |
erikj@445 | 363 | # Emit the repo:tip pairs to $@ |
erikj@445 | 364 | define GetSourceTips |
erikj@445 | 365 | $(CD) $(SRC_ROOT) ; \ |
erikj@445 | 366 | for i in $(REPO_LIST) IGNORE ; do \ |
erikj@445 | 367 | if [ "$${i}" = "IGNORE" ] ; then \ |
erikj@445 | 368 | continue; \ |
erikj@445 | 369 | elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \ |
erikj@445 | 370 | $(PRINTF) " %s:%s" \ |
erikj@445 | 371 | "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \ |
erikj@445 | 372 | elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \ |
erikj@445 | 373 | $(PRINTF) " %s:%s" \ |
erikj@445 | 374 | "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \ |
erikj@445 | 375 | fi; \ |
erikj@445 | 376 | done >> $@ |
erikj@445 | 377 | $(PRINTF) "\n" >> $@ |
erikj@445 | 378 | endef |
erikj@445 | 379 | |
erikj@445 | 380 | # Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk |
erikj@445 | 381 | define CreateHgTip |
erikj@445 | 382 | $(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME);\ |
erikj@445 | 383 | $(ECHO) $1/$(HGTIP_FILENAME) |
erikj@445 | 384 | endef |
erikj@445 | 385 | |
erikj@445 | 386 | define SetupLogging |
erikj@445 | 387 | ifneq ($(findstring $(LOG),debug trace),) |
erikj@445 | 388 | # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make |
erikj@445 | 389 | OLD_SHELL:=$$(SHELL) |
erikj@445 | 390 | SHELL = $$(warning Building $$@$$(if $$<, (from $$<))$(if $$?, ($$? newer)))$$(OLD_SHELL) -x |
erikj@445 | 391 | endif |
erikj@445 | 392 | endef |
erikj@445 | 393 | |
erikj@445 | 394 | # Make sure logging is setup for everyone that includes MakeBase.gmk. |
erikj@445 | 395 | $(eval $(call SetupLogging)) |
erikj@445 | 396 | |
ohair@425 | 397 | endif # _MAKEBASE_GMK |