annotate common/makefiles/MakeBase.gmk @ 476:2ba6f4da4bf3

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