Fri, 26 Oct 2012 14:29:57 -0700
8000992: Update new build-infra makefiles
Summary: Build-infra project integration. Multiple authors on this work: erikj and ihse primarily, also changes from ohair, tbell, and dholmes. Special credit to ohstrom for his smartjavac work.
Reviewed-by: erikj, ihse, dholmes, 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 |
ohair@425 | 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 |
ohair@425 | 68 | $(if $(word 10001,$($1)),$(error Cannot list safely more than 10000 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 | |
ohair@425 | 119 | $(call ListPathsSafely_Printf,$1,$2,$3,1) |
ohair@425 | 120 | $(call ListPathsSafely_Printf,$1,$2,$3,251) |
ohair@425 | 121 | $(call ListPathsSafely_Printf,$1,$2,$3,501) |
ohair@425 | 122 | $(call ListPathsSafely_Printf,$1,$2,$3,751) |
ohair@425 | 123 | |
ohair@425 | 124 | $(call ListPathsSafely_Printf,$1,$2,$3,1001) |
ohair@425 | 125 | $(call ListPathsSafely_Printf,$1,$2,$3,1251) |
ohair@425 | 126 | $(call ListPathsSafely_Printf,$1,$2,$3,1501) |
ohair@425 | 127 | $(call ListPathsSafely_Printf,$1,$2,$3,1751) |
ohair@425 | 128 | |
ohair@425 | 129 | $(call ListPathsSafely_Printf,$1,$2,$3,2001) |
ohair@425 | 130 | $(call ListPathsSafely_Printf,$1,$2,$3,2251) |
ohair@425 | 131 | $(call ListPathsSafely_Printf,$1,$2,$3,2501) |
ohair@425 | 132 | $(call ListPathsSafely_Printf,$1,$2,$3,2751) |
ohair@425 | 133 | |
ohair@425 | 134 | $(call ListPathsSafely_Printf,$1,$2,$3,3001) |
ohair@425 | 135 | $(call ListPathsSafely_Printf,$1,$2,$3,3251) |
ohair@425 | 136 | $(call ListPathsSafely_Printf,$1,$2,$3,3501) |
ohair@425 | 137 | $(call ListPathsSafely_Printf,$1,$2,$3,3751) |
ohair@425 | 138 | |
ohair@425 | 139 | $(call ListPathsSafely_Printf,$1,$2,$3,4001) |
ohair@425 | 140 | $(call ListPathsSafely_Printf,$1,$2,$3,4251) |
ohair@425 | 141 | $(call ListPathsSafely_Printf,$1,$2,$3,4501) |
ohair@425 | 142 | $(call ListPathsSafely_Printf,$1,$2,$3,4751) |
ohair@425 | 143 | |
ohair@425 | 144 | $(call ListPathsSafely_Printf,$1,$2,$3,5001) |
ohair@425 | 145 | $(call ListPathsSafely_Printf,$1,$2,$3,5251) |
ohair@425 | 146 | $(call ListPathsSafely_Printf,$1,$2,$3,5501) |
ohair@425 | 147 | $(call ListPathsSafely_Printf,$1,$2,$3,5751) |
ohair@425 | 148 | |
ohair@425 | 149 | $(call ListPathsSafely_Printf,$1,$2,$3,6001) |
ohair@425 | 150 | $(call ListPathsSafely_Printf,$1,$2,$3,6251) |
ohair@425 | 151 | $(call ListPathsSafely_Printf,$1,$2,$3,6501) |
ohair@425 | 152 | $(call ListPathsSafely_Printf,$1,$2,$3,6751) |
ohair@425 | 153 | |
ohair@425 | 154 | $(call ListPathsSafely_Printf,$1,$2,$3,7001) |
ohair@425 | 155 | $(call ListPathsSafely_Printf,$1,$2,$3,7251) |
ohair@425 | 156 | $(call ListPathsSafely_Printf,$1,$2,$3,7501) |
ohair@425 | 157 | $(call ListPathsSafely_Printf,$1,$2,$3,7751) |
ohair@425 | 158 | |
ohair@425 | 159 | $(call ListPathsSafely_Printf,$1,$2,$3,8001) |
ohair@425 | 160 | $(call ListPathsSafely_Printf,$1,$2,$3,8251) |
ohair@425 | 161 | $(call ListPathsSafely_Printf,$1,$2,$3,8501) |
ohair@425 | 162 | $(call ListPathsSafely_Printf,$1,$2,$3,8751) |
ohair@425 | 163 | |
ohair@425 | 164 | $(call ListPathsSafely_Printf,$1,$2,$3,9001) |
ohair@425 | 165 | $(call ListPathsSafely_Printf,$1,$2,$3,9251) |
ohair@425 | 166 | $(call ListPathsSafely_Printf,$1,$2,$3,9501) |
ohair@425 | 167 | $(call ListPathsSafely_Printf,$1,$2,$3,9751) |
ohair@425 | 168 | endef |
ohair@425 | 169 | |
ohair@425 | 170 | define ListPathsSafelyNow_IfPrintf |
ohair@425 | 171 | ifneq (,$$(word $4,$$($1))) |
ohair@425 | 172 | $$(eval $1_LPS$4:=$$(call compress_paths,$$(wordlist $4,$5,$$($1)))) |
ohair@425 | 173 | $$(shell printf -- "$$(strip $$($1_LPS$4))\n" | $(decompress_paths) $3) |
ohair@425 | 174 | endif |
ohair@425 | 175 | endef |
ohair@425 | 176 | |
ohair@425 | 177 | # And an non-receipt version: |
ohair@425 | 178 | define ListPathsSafelyNow |
ohair@425 | 179 | ifneq (,$$(word 10001,$$($1))) |
ohair@425 | 180 | $$(error Cannot list safely more than 10000 paths. $1 has $$(words $$($1)) paths!) |
ohair@425 | 181 | endif |
ohair@425 | 182 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1,250) |
ohair@425 | 183 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,251,500) |
ohair@425 | 184 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,501,750) |
ohair@425 | 185 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,751,1000) |
ohair@425 | 186 | |
ohair@425 | 187 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1001,1250) |
ohair@425 | 188 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1251,1500) |
ohair@425 | 189 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1501,1750) |
ohair@425 | 190 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,1751,2000) |
ohair@425 | 191 | |
ohair@425 | 192 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2001,2250) |
ohair@425 | 193 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2251,2500) |
ohair@425 | 194 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2501,2750) |
ohair@425 | 195 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,2751,3000) |
ohair@425 | 196 | |
ohair@425 | 197 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3001,3250) |
ohair@425 | 198 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3251,3500) |
ohair@425 | 199 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3501,3750) |
ohair@425 | 200 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,3751,4000) |
ohair@425 | 201 | |
ohair@425 | 202 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4001,4250) |
ohair@425 | 203 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4251,4500) |
ohair@425 | 204 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4501,4750) |
ohair@425 | 205 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,4751,5000) |
ohair@425 | 206 | |
ohair@425 | 207 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5001,5250) |
ohair@425 | 208 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5251,5500) |
ohair@425 | 209 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5501,5750) |
ohair@425 | 210 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,5751,6000) |
ohair@425 | 211 | |
ohair@425 | 212 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6001,6250) |
ohair@425 | 213 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6251,6500) |
ohair@425 | 214 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6501,6750) |
ohair@425 | 215 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,6751,7000) |
ohair@425 | 216 | |
ohair@425 | 217 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7001,7250) |
ohair@425 | 218 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7251,7500) |
ohair@425 | 219 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7501,7750) |
ohair@425 | 220 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,7751,8000) |
ohair@425 | 221 | |
ohair@425 | 222 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8001,8250) |
ohair@425 | 223 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8251,8500) |
ohair@425 | 224 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8501,8750) |
ohair@425 | 225 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,8751,9000) |
ohair@425 | 226 | |
ohair@425 | 227 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9001,9250) |
ohair@425 | 228 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9251,9500) |
ohair@425 | 229 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9501,9750) |
ohair@425 | 230 | $(call ListPathsSafelyNow_IfPrintf,$1,$2,$3,9751,10000) |
ohair@425 | 231 | |
ohair@425 | 232 | endef |
ohair@425 | 233 | |
erikj@445 | 234 | # The source tips can come from the Mercurial repository, or in the files |
erikj@445 | 235 | # $(HGTIP_FILENAME) which contains the tip but is also positioned in the same |
erikj@445 | 236 | # directory as the original $(HGDIR) directory. |
erikj@445 | 237 | # These should not be := assignments, only used from the root Makefile. |
erikj@445 | 238 | HG_VERSION = $(shell $(HG) version 2> /dev/null) |
erikj@445 | 239 | HG_DIRECTORY=.hg |
erikj@445 | 240 | HGTIP_FILENAME=.hgtip |
erikj@445 | 241 | HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO |
erikj@445 | 242 | REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \ |
erikj@445 | 243 | $(shell $(CD) $(SRC_ROOT) ; ( $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) ; \ |
erikj@445 | 244 | $(LS) $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) ) \ |
erikj@445 | 245 | 2> /dev/null))))) |
erikj@445 | 246 | |
erikj@445 | 247 | # Emit the repo:tip pairs to $@ |
erikj@445 | 248 | define GetSourceTips |
erikj@445 | 249 | $(CD) $(SRC_ROOT) ; \ |
erikj@445 | 250 | for i in $(REPO_LIST) IGNORE ; do \ |
erikj@445 | 251 | if [ "$${i}" = "IGNORE" ] ; then \ |
erikj@445 | 252 | continue; \ |
erikj@445 | 253 | elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \ |
erikj@445 | 254 | $(PRINTF) " %s:%s" \ |
erikj@445 | 255 | "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \ |
erikj@445 | 256 | elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \ |
erikj@445 | 257 | $(PRINTF) " %s:%s" \ |
erikj@445 | 258 | "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \ |
erikj@445 | 259 | fi; \ |
erikj@445 | 260 | done >> $@ |
erikj@445 | 261 | $(PRINTF) "\n" >> $@ |
erikj@445 | 262 | endef |
erikj@445 | 263 | |
erikj@445 | 264 | # Create the HGTIP_FILENAME file. Called from jdk/make/closed/bundles.gmk |
erikj@445 | 265 | define CreateHgTip |
erikj@445 | 266 | $(HG) tip --repository $1 --template '{node|short}\n' > $1/$(HGTIP_FILENAME);\ |
erikj@445 | 267 | $(ECHO) $1/$(HGTIP_FILENAME) |
erikj@445 | 268 | endef |
erikj@445 | 269 | |
erikj@445 | 270 | define SetupLogging |
ohair@494 | 271 | ifeq ($$(LOG), trace) |
erikj@445 | 272 | # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make |
ohair@494 | 273 | # For each target executed, will print |
ohair@494 | 274 | # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer) |
ohair@494 | 275 | # but with a limit of 20 on <ALL NEWER PREREQUISITES>, to avoid cluttering logs too much (and causing a crash on Cygwin). |
erikj@445 | 276 | OLD_SHELL:=$$(SHELL) |
ohair@494 | 277 | WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL) |
ohair@494 | 278 | 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 | 279 | endif |
ohair@494 | 280 | # Never remove warning messages; this is just for completeness |
ohair@494 | 281 | LOG_WARN= |
ohair@494 | 282 | ifneq ($$(findstring $$(LOG),info debug trace),) |
ohair@494 | 283 | LOG_INFO= |
ohair@494 | 284 | else |
ohair@494 | 285 | LOG_INFO=> /dev/null |
ohair@494 | 286 | endif |
ohair@494 | 287 | ifneq ($$(findstring $$(LOG),debug trace),) |
ohair@494 | 288 | LOG_DEBUG= |
ohair@494 | 289 | else |
ohair@494 | 290 | LOG_DEBUG=> /dev/null |
ohair@494 | 291 | endif |
ohair@494 | 292 | ifneq ($$(findstring $$(LOG),trace),) |
ohair@494 | 293 | LOG_TRACE= |
ohair@494 | 294 | else |
ohair@494 | 295 | LOG_TRACE=> /dev/null |
erikj@445 | 296 | endif |
erikj@445 | 297 | endef |
erikj@445 | 298 | |
erikj@445 | 299 | # Make sure logging is setup for everyone that includes MakeBase.gmk. |
erikj@445 | 300 | $(eval $(call SetupLogging)) |
erikj@445 | 301 | |
ohair@494 | 302 | # This is to be called by all SetupFoo macros |
ohair@494 | 303 | define LogSetupMacroEntry |
ohair@494 | 304 | $(if $(26),$(error Internal makefile error: Too many arguments to LogSetupMacroEntry, please update MakeBase.gmk)) |
ohair@494 | 305 | $(if $(findstring $(LOG),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,$(if $($i),$(NEWLINE) $(strip [$i] $($i)))))) |
ohair@494 | 306 | endef |
ohair@494 | 307 | |
ohair@494 | 308 | # Make directory without forking mkdir if not needed |
ohair@494 | 309 | define MakeDir |
ohair@494 | 310 | ifneq ($$(wildcard $1 $2 $3 $4 $5 $6 $7 $8 $9),$$(strip $1 $2 $3 $4 $5 $6 $7 $8 $9)) |
ohair@494 | 311 | $$(shell $(MKDIR) -p $1 $2 $3 $4 $5 $6 $7 $8 $9) |
ohair@494 | 312 | endif |
ohair@494 | 313 | endef |
ohair@494 | 314 | |
ohair@494 | 315 | ifeq ($(OPENJDK_TARGET_OS),solaris) |
ohair@494 | 316 | # On Solaris, if the target is a symlink and exists, cp won't overwrite. |
ohair@494 | 317 | define install-file |
ohair@494 | 318 | $(MKDIR) -p $(@D) |
ohair@494 | 319 | $(RM) '$@' |
ohair@494 | 320 | $(CP) -f -r -P '$<' '$(@D)' |
ohair@494 | 321 | endef |
ohair@494 | 322 | else ifeq ($(OPENJDK_TARGET_OS),macosx) |
ohair@494 | 323 | define install-file |
ohair@494 | 324 | $(MKDIR) -p $(@D) |
ohair@494 | 325 | $(CP) -fpRP '$<' '$@' |
ohair@494 | 326 | endef |
ohair@494 | 327 | else |
ohair@494 | 328 | define install-file |
ohair@494 | 329 | $(MKDIR) -p $(@D) |
ohair@494 | 330 | $(CP) -fP '$<' '$@' |
ohair@494 | 331 | endef |
ohair@494 | 332 | endif |
ohair@494 | 333 | |
ohair@425 | 334 | endif # _MAKEBASE_GMK |