NewMakefile.gmk

Tue, 11 Dec 2012 11:29:58 +0100

author
erikj
date
Tue, 11 Dec 2012 11:29:58 +0100
changeset 532
2795874efd16
parent 494
e64f2cb57d05
child 559
ef6adbf511cc
permissions
-rw-r--r--

8003945: build-infra: problems finding compiler when using --with-dev-kit
Summary: Search all compiler names in dev-kit dir first.
Reviewed-by: tbell

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

mercurial