Mon, 19 Nov 2012 14:06:30 -0800
8003300: build-infra: fails on solaris when objcopy is not found
Summary: Only call BASIC_FIXUP_EXECUTABLE() if objcopy was found.
Reviewed-by: tbell
Contributed-by: erik.joelsson@oracle.com
1 #
2 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
26 # Utilities used in this Makefile
27 BASENAME=basename
28 CAT=cat
29 CD=cd
30 CMP=cmp
31 CP=cp
32 ECHO=echo
33 MKDIR=mkdir
34 PRINTF=printf
35 PWD=pwd
36 TAR=tar
37 ifeq ($(PLATFORM),windows)
38 ZIP=zip
39 else
40 # store symbolic links as the link
41 ZIP=zip -y
42 endif
43 # Insure we have a path that looks like it came from pwd
44 # (This is mostly for Windows sake and drive letters)
45 define UnixPath # path
46 $(shell (cd "$1" && $(PWD)))
47 endef
49 # Current root directory
50 CURRENT_DIRECTORY := $(shell $(PWD))
52 # Build directory root
53 BUILD_DIR_ROOT = $(CURRENT_DIRECTORY)/build
55 # All configured Makefiles to run
56 ALL_MAKEFILES = $(wildcard $(BUILD_DIR_ROOT)/*-*/Makefile)
58 # All bundles to create
59 ALL_IMAGE_DIRS = $(wildcard $(BUILD_DIR_ROOT)/*-*/images/*-image)
61 # Build all the standard 'all', 'images', and 'clean' targets
62 all images clean: checks
63 @if [ "$(ALL_MAKEFILES)" = "" ] ; then \
64 $(ECHO) "ERROR: No configurations to build"; exit 1; \
65 fi
66 @for bdir in $(dir $(ALL_MAKEFILES)) ; do \
67 $(ECHO) "$(CD) $${bdir} && $(MAKE) $@" ; \
68 $(CD) $${bdir} && $(MAKE) $@ ; \
69 done
71 # TBD: Deploy input
72 $(BUILD_DIR_ROOT)/.deploy_input:
73 @if [ "$(ALL_MAKEFILES)" = "" ] ; then \
74 $(ECHO) "ERROR: No configurations to build"; exit 1; \
75 fi
76 @for bdir in $(dir $(ALL_MAKEFILES)) ; do \
77 if [ deploy/make/Makefile ] ; then \
78 echo "Attempting deploy build." ; \
79 ( \
80 $(RM) -r $${bdir}/deploy_input ; \
81 $(MKDIR) -p $${bdir}/deploy_input ; \
82 ( $(CD) $${bdir}/images && $(TAR) -cf - j2sdk-image j2re-image ) \
83 | ( $(CD) $${bdir}/deploy_input && $(TAR) -xf - ) ; \
84 ) ; \
85 fi; \
86 done
87 touch $@
89 # TBD: Deploy images
90 deploy: $(BUILD_DIR_ROOT)/.deploy_input
91 @if [ "$(ALL_MAKEFILES)" = "" ] ; then \
92 $(ECHO) "ERROR: No configurations to build"; exit 1; \
93 fi
94 @for bdir in $(dir $(ALL_MAKEFILES)) ; do \
95 if [ deploy/make/Makefile ] ; then \
96 echo "Attempting deploy build." ; \
97 ( \
98 $(CD) deploy/make && \
99 $(MAKE) \
100 ABS_OUTPUTDIR=$${bdir}/deploy_input \
101 OUTPUTDIR=$${bdir}/deploy_input \
102 ) ; \
103 fi; \
104 done
106 # TBD: Install bundles
107 install:
109 # Bundle creation
110 bundles:
111 @if [ "$(ALL_IMAGE_DIRS)" = "" ] ; then \
112 $(ECHO) "ERROR: No images to bundle"; exit 1; \
113 fi
114 @for i in $(ALL_IMAGE_DIRS) ; do \
115 $(MKDIR) -p $${i}/../../bundles && \
116 $(RM) $${i}/../../bundles/`$(BASENAME) $${i}`.zip && \
117 $(ECHO) "$(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip ." && \
118 $(CD) $${i} && $(ZIP) -q -r ../../bundles/`$(BASENAME) $${i}`.zip . ; \
119 done
121 # Clobber all the built files
122 clobber::
123 $(RM) -r $(BUILD_DIR_ROOT)
125 # Make various checks to insure the build will be successful
126 # Possibilities:
127 # * Check that if any closed repo is provided, they all must be.
128 # * Check that all open repos exist, at least until we are ready for some
129 # kind of partial build.
130 checks:
131 @$(ECHO) "No checks yet"
133 # Keep track of user targets
134 USER_TARGETS += all deploy install images clean clobber checks
136 ###########################################################################
137 # To help in adoption of the new configure&&make build process, a bridge
138 # build will use the old settings to run configure and do the build.
140 # Build with the configure bridge
141 bridgeBuild: bridge2configure images
143 # Bridge from old Makefile ALT settings to configure options
144 bridge2configure: $(BUILD_DIR_ROOT)/.bridge2configureOpts
145 bash ./configure $(strip $(shell $(CAT) $<))
147 # Create a file with configure options created from old Makefile mechanisms.
148 $(BUILD_DIR_ROOT)/.bridge2configureOpts: $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest
149 $(RM) $@
150 $(CP) $< $@
152 # Use this file to only change when obvious things have changed
153 $(BUILD_DIR_ROOT)/.bridge2configureOptsLatest: FRC
154 $(RM) $@.tmp
155 $(MKDIR) -p $(BUILD_DIR_ROOT)
156 @$(ECHO) " --with-debug-level=$(if $(DEBUG_LEVEL),$(DEBUG_LEVEL),release) " >> $@.tmp
157 ifdef ARCH_DATA_MODEL
158 @$(ECHO) " --with-target-bits=$(ARCH_DATA_MODEL) " >> $@.tmp
159 endif
160 ifdef ALT_PARALLEL_COMPILE_JOBS
161 @$(ECHO) " --with-num-cores=$(ALT_PARALLEL_COMPILE_JOBS) " >> $@.tmp
162 endif
163 ifdef ALT_BOOTDIR
164 @$(ECHO) " --with-boot-jdk=$(call UnixPath,$(ALT_BOOTDIR)) " >> $@.tmp
165 endif
166 ifdef ALT_CUPS_HEADERS_PATH
167 @$(ECHO) " --with-cups-include=$(call UnixPath,$(ALT_CUPS_HEADERS_PATH)) " >> $@.tmp
168 endif
169 ifdef ALT_FREETYPE_HEADERS_PATH
170 @$(ECHO) " --with-freetype=$(call UnixPath,$(ALT_FREETYPE_HEADERS_PATH)/..) " >> $@.tmp
171 endif
172 @if [ -f $@ ] ; then \
173 if ! $(CMP) $@ $@.tmp > /dev/null ; then \
174 $(CP) $@.tmp $@ ; \
175 fi ; \
176 else \
177 $(CP) $@.tmp $@ ; \
178 fi
179 $(RM) $@.tmp
181 # Clobber all the built files
182 clobber:: bridge2clobber
183 bridge2clobber::
184 $(RM) $(BUILD_DIR_ROOT)/.bridge2*
185 $(RM) $(BUILD_DIR_ROOT)/.deploy_input
187 # Keep track of phony targets
188 PHONY_LIST += bridge2configure bridgeBuild bridge2clobber
190 ###########################################################################
191 # Sanity checks (history target)
192 #
194 sanity: checks
196 # Keep track of user targets
197 USER_TARGETS += sanity
199 ###########################################################################
200 # Javadocs
201 #
203 javadocs:
204 cd common/makefiles && $(MAKE) -f MakefileJavadoc.gmk
206 # Keep track of user targets
207 USER_TARGETS += javadocs
209 ###########################################################################
210 # JPRT targets
212 ifndef JPRT_ARCHIVE_BUNDLE
213 JPRT_ARCHIVE_BUNDLE=/tmp/jprt_bundles/j2sdk-image.zip
214 endif
216 jprt_build_product: DEBUG_LEVEL=release
217 jprt_build_product: BUILD_DIRNAME=*-release
218 jprt_build_product: jprt_build_generic
220 jprt_build_fastdebug: DEBUG_LEVEL=fastdebug
221 jprt_build_fastdebug: BUILD_DIRNAME=*-fastdebug
222 jprt_build_fastdebug: jprt_build_generic
224 jprt_build_debug: DEBUG_LEVEL=slowdebug
225 jprt_build_debug: BUILD_DIRNAME=*-debug
226 jprt_build_debug: jprt_build_generic
228 jprt_build_generic: $(JPRT_ARCHIVE_BUNDLE)
230 $(JPRT_ARCHIVE_BUNDLE): bridgeBuild bundles
231 $(MKDIR) -p $(@D)
232 $(RM) $@
233 $(CP) $(BUILD_DIR_ROOT)/$(BUILD_DIRNAME)/bundles/j2sdk-image.zip $@
235 # Keep track of phony targets
236 PHONY_LIST += jprt_build_product jprt_build_fastdebug jprt_build_debug \
237 jprt_build_generic
239 ###########################################################################
240 # Help target
242 HELP_FORMAT=%12s%s\n
244 help:
245 @$(PRINTF) "# JDK Makefile\n"
246 @$(PRINTF) "#\n"
247 @$(PRINTF) "# Usage: make [Target]\n"
248 @$(PRINTF) "#\n"
249 @$(PRINTF) "# $(HELP_FORMAT)" "Target " "Description"
250 @$(PRINTF) "# $(HELP_FORMAT)" "------ " "-----------"
251 @for i in $(USER_TARGETS) ; do \
252 $(MAKE) help_$${i} ; \
253 done
254 @$(PRINTF) "#\n"
256 help_all:
257 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
258 "Build the entire jdk but not the images"
259 help_images:
260 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
261 "Create the jdk images for the builds"
262 help_deploy:
263 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
264 "Create the jdk deploy images from the jdk images"
265 help_install:
266 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
267 "Create the jdk install bundles from the deploy images"
268 help_clean:
269 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
270 "Clean and prepare for a fresh build from scratch"
271 help_clobber:
272 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
273 "Clean and also purge any hidden derived data"
274 help_checks:
275 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
276 "Perform various checks to make sure we can build"
277 help_sanity:
278 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
279 "Same as 'make checks'"
280 help_javadocs:
281 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
282 "Build the javadocs"
283 help_help:
284 @$(PRINTF) "# $(HELP_FORMAT)" "$(subst help_,,$@) - " \
285 "Print out the help messages"
287 # Keep track of user targets
288 USER_TARGETS += help
290 ###########################################################################
291 # Phony targets
292 .PHONY: $(PHONY_LIST) $(USER_TARGETS)
294 # Force target
295 FRC: