1 # 2 # Copyright 1995-2008 Sun Microsystems, Inc. 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. Sun designates this 8 # particular file as subject to the "Classpath" exception as provided 9 # by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 22 # CA 95054 USA or visit www.sun.com if you need additional information or 23 # have any questions. 24 # 25 26 # 27 # Common variables used by all the Java makefiles. This file should 28 # not contain rules. 29 # 30 31 # WARNING: This file is shared with other workspaces. 32 # So when it includes other files, it must use JDK_TOPDIR. 33 # 34 35 # Check for strange explicit settings (change to empty or true) 36 ifdef OPENJDK 37 ifneq ($(OPENJDK),true) 38 x:=$(error "OPENJDK (if defined) can only be set to true") 39 endif 40 endif 41 42 # 43 # On Solaris, the 'make' utility from Sun will not work with these makefiles. 44 # This little rule is only understood by Sun's make, and is harmless 45 # when seen by the GNU make tool. If using Sun's make, this causes the 46 # make command to fail. 47 # 48 SUN_MAKE_TEST:sh = echo "ERROR: PLEASE USE GNU VERSION OF MAKE"; exit 33 49 50 ifndef JDK_TOPDIR 51 ifdef BUILDDIR 52 JDK_TOPDIR=$(BUILDDIR)/.. 53 else 54 JDK_TOPDIR:=$(error "ERROR: Cannot define top of jdk repository") 55 endif 56 endif 57 ifndef BUILDDIR 58 # Hack, due to deploy repository using this file. 59 BUILDDIR=$(JDK_TOPDIR)/make 60 endif 61 ifndef JDK_MAKE_SHARED_DIR 62 JDK_MAKE_SHARED_DIR=$(JDK_TOPDIR)/make/common/shared 63 endif 64 65 include $(JDK_MAKE_SHARED_DIR)/Platform.gmk 66 67 TOPDIR=$(BUILDDIR)/.. 68 69 include $(JDK_TOPDIR)/make/common/CancelImplicits.gmk 70 71 # Historically PLATFORM_SRC used to be src/$(PLATFORM), but we switched it to 72 # src/solaris so if you want to build on Linux you didn't need a src/linux 73 # directory. In an ideal world it would be called src/genunix but we are not 74 # there yet. 75 # 76 ifndef SHARE_SRC 77 SHARE_SRC = $(BUILDDIR)/../src/share 78 endif 79 80 # Files that cannot be included in the OpenJDK distribution are 81 # collected under a parent directory which contains just those files. 82 ifndef CLOSED_SRC 83 CLOSED_SRC = $(BUILDDIR)/../src/closed 84 endif 85 86 # If we have no closed directory, force it to an openjdk build 87 CLOSED_SRC_DIR_EXISTS := $(shell \ 88 if [ -d $(CLOSED_SRC) ] ; then \ 89 echo true; \ 90 else \ 91 echo false; \ 92 fi) 93 ifeq ($(CLOSED_SRC_DIR_EXISTS), false) 94 OPENJDK = true 95 endif 96 97 # Define where closed directories are 98 ifdef OPENJDK 99 CLOSED_SRC = 100 CLOSED_SHARE_SRC = 101 else 102 ifndef CLOSED_SHARE_SRC 103 CLOSED_SHARE_SRC = $(CLOSED_SRC)/share 104 endif 105 endif 106 107 # If OPENJDK is defined, we may still need to use some native libraries that 108 # exist only as part of the closed source. If the closed sources are not 109 # available, the libraries must have been pre-built. Since these libraries 110 # and the JDK internal interfaces to these are reasonably stable this is not 111 # a significant problem. But we do need to provide a way to locate them, 112 # including a way to point to a new one when there have been changes. 113 # 114 # If you have a formal binary plugs download, set ALT_BINARY_PLUGS_PATH 115 # to the location. 116 # (Optionally you can set ALT_CLOSED_JDK_IMPORT_PATH to point to the latest 117 # build JDK, or last promotion for this JDK version, but will not work 118 # on windows). 119 # 120 # As the OPENJDK is built, the binary plugs are used instead of building the 121 # libraries. 122 # Individual Makefiles that specify USE_BINARY_PLUG_LIBRARY, will get 123 # the binary plug copy (or a copy from a built JDK). 124 # 125 # See common/internal/BinaryPlugs.gmk for more information. 126 # 127 # Usage notes: 128 # 129 # ALT_BINARY_PLUGS_JARFILE is probably rarely needed. It can be used 130 # to identify the exact jar file to be used for all closed classes.. 131 # 132 # ALT_BINARY_PLUGS_PATH points to a directory containing precisely the 133 # binaries needed to build. 134 # 135 # ALT_BUILD_BINARY_PLUGS_PATH points to a directory containing binary plug dirs 136 # multiple architectures named using the standard conventions 137 # This is useful for build scripts that need to build multiple architectures 138 # of the OpenJDK. 139 # 140 # ALT_CLOSED_JDK_IMPORT_PATH points to the top-level of a specific platform 141 # JDK image. 142 # 143 # The precedence is that 144 # 1. ALT_BINARY_PLUGS_JARFILE overrides any other location of the classes 145 # 2. ALT_BINARY_PLUGS_PATH overrides all locations of classes and libraries 146 # 3. ALT_BUILD_BINARY_PLUGS_PATH is used to find a ALT_BINARY_PLUGS_PATH 147 # 4. ALT_CLOSED_JDK_IMPORT_PATH is used to locate classes and libraries 148 # Note: If any of the ALT_ variables are modified here, it is assumed 149 # that the build should be done with IMPORT_BINARY_PLUGS=true as 150 # well. Otherwise the default will be IMPORT_BINARY_PLUGS=false. 151 # Lastly, setting IMPORT_BINARY_PLUGS=false on the command line 152 # will override this logic, and plugs will not be imported. 153 # 154 155 # Always needed, defines the name of the imported/exported jarfile 156 BINARY_PLUGS_JARNAME = rt-closed.jar 157 158 ifdef OPENJDK 159 ifdef ALT_CLOSED_JDK_IMPORT_PATH 160 CLOSED_JDK_IMPORT_PATH = $(ALT_CLOSED_JDK_IMPORT_PATH) 161 BINARY_PLUGS_PATH = $(CLOSED_JDK_IMPORT_PATH) 162 BINARY_PLUGS_JARFILE = $(CLOSED_JDK_IMPORT_PATH)/jre/lib/rt.jar 163 IMPORT_BINARY_PLUGS=true 164 endif 165 ifdef ALT_BUILD_BINARY_PLUGS_PATH 166 BUILD_BINARY_PLUGS_PATH = $(ALT_BUILD_BINARY_PLUGS_PATH) 167 IMPORT_BINARY_PLUGS=true 168 else 169 BUILD_BINARY_PLUGS_PATH = $(SLASH_JAVA)/re/jdk/$(JDK_VERSION)/promoted/latest/openjdk/binaryplugs 170 endif 171 BINARY_PLUGS_PATH = $(BUILD_BINARY_PLUGS_PATH)/$(PLATFORM)-$(ARCH) 172 BINARY_PLUGS_JARFILE = $(BINARY_PLUGS_PATH)/jre/lib/$(BINARY_PLUGS_JARNAME) 173 ifdef ALT_BINARY_PLUGS_PATH 174 BINARY_PLUGS_PATH = $(ALT_BINARY_PLUGS_PATH) 175 BINARY_PLUGS_JARFILE = $(BINARY_PLUGS_PATH)/jre/lib/$(BINARY_PLUGS_JARNAME) 176 IMPORT_BINARY_PLUGS=true 177 endif 178 ifdef ALT_BINARY_PLUGS_JARFILE 179 BINARY_PLUGS_JARFILE = $(ALT_BINARY_PLUGS_JARFILE) 180 IMPORT_BINARY_PLUGS=true 181 endif 182 endif # OPENJDK 183 184 # 185 # Get platform definitions 186 # 187 188 include $(JDK_TOPDIR)/make/common/Defs-$(PLATFORM).gmk 189 190 # 191 # Freetype logic is applicable to OpenJDK only 192 # 193 ifdef OPENJDK 194 195 #if we use system lib we do not need to copy it to build tree 196 USING_SYSTEM_FT_LIB=false 197 198 ifeq ($(PLATFORM), windows) 199 DEVTOOLS_FT_DIR=$(JDK_DEVTOOLS_DIR)/win32/freetype-$(ARCH) 200 endif 201 ifeq ($(PLATFORM), linux) 202 DEVTOOLS_FT_DIR=$(JDK_DEVTOOLS_DIR)/$(PLATFORM)/freetype-$(ARCH) 203 endif 204 ifeq ($(PLATFORM), solaris) 205 # historically for Solaris we have slightly different devtools 206 # naming conventions 207 DEVTOOLS_FT_DIR=$(JDK_DEVTOOLS_DIR)/$(ARCH_FAMILY)/freetype-$(ARCH) 208 endif 209 210 DEVTOOLS_FT_DIR_EXISTS = $(shell \ 211 if [ -f $(DEVTOOLS_FT_DIR)/include/ft2build.h ] ; then \ 212 echo true; \ 213 else \ 214 echo false; \ 215 fi) 216 217 ifdef ALT_FREETYPE_LIB_PATH 218 FREETYPE_LIB_PATH = $(ALT_FREETYPE_LIB_PATH) 219 else 220 ifeq ($(DEVTOOLS_FT_DIR_EXISTS), true) 221 FREETYPE_LIB_PATH = $(DEVTOOLS_FT_DIR)/lib 222 else 223 FREETYPE_LIB_PATH = /usr/lib 224 USING_SYSTEM_FT_LIB=true 225 endif 226 endif 227 228 ifeq ($(PLATFORM), windows) 229 FREETYPE_LIB = $(FREETYPE_LIB_PATH)/freetype.lib 230 else 231 FREETYPE_LIB = -L$(FREETYPE_LIB_PATH) -lfreetype 232 endif 233 234 ifdef ALT_FREETYPE_HEADERS_PATH 235 FREETYPE_HEADERS_PATH = $(ALT_FREETYPE_HEADERS_PATH) 236 else 237 ifeq ($(DEVTOOLS_FT_DIR_EXISTS), true) 238 FREETYPE_HEADERS_PATH = $(DEVTOOLS_FT_DIR)/include 239 else 240 FREETYPE_HEADERS_PATH = /usr/include 241 endif 242 endif 243 endif 244 245 # 246 # zlib version 247 # 248 ZLIB_VERSION = 1.2.3 249 250 251 # 252 # Localizations for the different parts of the product beyond English 253 # 254 255 JRE_LOCALES = de es fr it ja ko sv zh_CN zh_TW zh_HK 256 PLUGIN_LOCALES = de es fr it ja ko sv zh_CN zh_TW zh_HK 257 JDK_LOCALES = ja zh_CN 258 259 # 260 # A list of locales we support but don't have resource files. 261 # This is defined to optimize the search of resource bundles. 262 # 263 JRE_NONEXIST_LOCALES = en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh 264 265 # 266 # All libraries except libjava and libjvm itself link against libjvm and 267 # libjava, the latter for its exported common utilities. libjava only links 268 # against libjvm. Programs' makefiles take their own responsibility for 269 # adding other libs. 270 # 271 ifdef PACKAGE 272 # put JAVALIB first, but do not lose any platform specific values.... 273 LDLIBS_COMMON = $(JAVALIB) 274 endif # PACKAGE 275 276 # 277 # Libraries that must appear ahead of libc.so on the link command line 278 # 279 ifdef PROGRAM 280 281 ifeq ($(PLATFORM), solaris) 282 LDLIBS_COMMON = -lthread -ldl 283 endif 284 285 ifeq ($(PLATFORM), linux) 286 LDLIBS_COMMON = -ldl 287 endif 288 289 endif # PROGRAM 290 291 LDLIBS_COMMON += $(EXTRA_LIBS) 292 293 # 294 # Default is to build, not import native binaries 295 # 296 ifndef IMPORT_NATIVE_BINARIES 297 IMPORT_NATIVE_BINARIES=false 298 endif 299 # If importing libraries in, no incremental builds 300 ifeq ($(IMPORT_NATIVE_BINARIES),true) 301 INCREMENTAL_BUILD=false 302 endif 303 304 # for generated libraries 305 LIBDIR = $(OUTPUTDIR)/lib 306 ABS_LIBDIR = $(ABS_OUTPUTDIR)/lib 307 # Optional place to save the windows .lib files 308 LIBFILES_DIR = $(OUTPUTDIR)/libfiles 309 # for ext jre files 310 EXTDIR = $(LIBDIR)/ext 311 # for generated include files 312 INCLUDEDIR = $(OUTPUTDIR)/include 313 # for generated class files 314 CLASSBINDIR = $(OUTPUTDIR)/classes 315 DEMOCLASSDIR = $(OUTPUTDIR)/democlasses 316 # for generated tool class files 317 BUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses 318 # for build tool jar files 319 BUILDTOOLJARDIR = $(OUTPUTDIR)/btjars 320 ABS_BUILDTOOLJARDIR = $(ABS_OUTPUTDIR)/btjars 321 # for generated tool class files 322 BUILDTOOLBINDIR = $(OUTPUTDIR)/btbins 323 # for generated java source files 324 GENSRCDIR = $(OUTPUTDIR)/gensrc 325 # for generated C source files (not javah) 326 GENNATIVESRCDIR = $(OUTPUTDIR)/gennativesrc 327 # for imported source files 328 IMPORTSRCDIR = $(OUTPUTDIR)/impsrc 329 # for imported documents 330 IMPORTDOCDIR = $(OUTPUTDIR)/impdoc 331 # for generated demo 332 DEMODIR = $(OUTPUTDIR)/demo 333 # for sample code 334 SAMPLEDIR = $(OUTPUTDIR)/sample 335 # for generated documentation 336 DOCSDIR = $(OUTPUTDIR)/docs$(DOCSDIRSUFFIX) 337 DOCSDIRSUFFIX = 338 339 # The MESSAGE, WARNING and ERROR files are used to store sanityck and 340 # SCCS check messages, warnings and errors. 341 ifndef ERROR_FILE 342 ERROR_FILE = $(OUTPUTDIR)/sanityCheckErrors.txt 343 endif 344 ifndef WARNING_FILE 345 WARNING_FILE = $(OUTPUTDIR)/sanityCheckWarnings.txt 346 endif 347 ifndef MESSAGE_FILE 348 MESSAGE_FILE = $(OUTPUTDIR)/sanityCheckMessages.txt 349 endif 350 351 JDK_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2sdk-image 352 JRE_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-image 353 354 #where the demo source can be found 355 DEMOSRCDIR = $(SHARE_SRC)/demo 356 357 # An attempt is made to generate unique enough directories for the 358 # generated files to not have name collisisons. Most build units 359 # defines PRODUCT (except Release.gmk), but then they may or may 360 # not define PACKAGE, THREADIR (only HPI uses this), PROGRAM, and 361 # LIBRARY. This code chunk attempts to generate a unique 362 # OBJDIR/CLASSHDRDIR for each build unit based on which of those 363 # values are set within each build unit. 364 365 UNIQUE_LOCATION_STRING = tmp 366 367 ifneq ($(PRODUCT),) 368 UNIQUE_LOCATION_STRING += /$(PRODUCT) 369 endif 370 371 ifneq ($(PACKAGE),) 372 UNIQUE_LOCATION_STRING += /$(PACKAGE) 373 endif 374 375 ifneq ($(PROGRAM),) 376 UNIQUE_LOCATION_STRING += /$(PROGRAM) 377 endif 378 379 ifneq ($(LIBRARY),) 380 ifneq ($(LIBRARY_OUTPUT),) 381 UNIQUE_LOCATION_STRING += /$(LIBRARY_OUTPUT) 382 else 383 UNIQUE_LOCATION_STRING += /$(LIBRARY) 384 endif 385 endif 386 387 ifneq ($(THREADDIR),) 388 UNIQUE_LOCATION_STRING += /$(THREADDIR) 389 endif 390 391 # the use of += above makes a space separated list which we need to 392 # remove for filespecs. 393 # 394 NULLSTRING := 395 ONESPACE := $(NULLSTRING) # space before this comment is required. 396 UNIQUE_PATH = $(subst $(ONESPACE),,$(UNIQUE_LOCATION_STRING)) 397 398 # TEMPDIR is a unique general purpose directory 399 # need to use 'override' because GNU Make on Linux exports the wrong 400 # value. 401 override TEMPDIR = $(OUTPUTDIR)/$(UNIQUE_PATH) 402 override ABS_TEMPDIR = $(ABS_OUTPUTDIR)/$(UNIQUE_PATH) 403 404 # This must be created right away for pattern rules in Sanity.gmk to work. 405 dummy1:=$(shell $(MKDIR) -p $(TEMPDIR)) 406 dummy2:=$(shell $(MKDIR) -p $(TEMP_DISK)) 407 408 # OBJDIRNAME is the name of the directory where the object code is to 409 # be placed. It's name depends on whether the data model architecture 410 # is 32-bit or not. 411 ifneq ($(ARCH_DATA_MODEL), 32) 412 OBJDIRNAME = obj$(ARCH_DATA_MODEL)$(OBJDIRNAME_SUFFIX) 413 else 414 OBJDIRNAME = obj$(OBJDIRNAME_SUFFIX) 415 endif 416 OBJDIR = $(TEMPDIR)/$(OBJDIRNAME) 417 418 # CLASSHDRDIR is where the generated C Class Header files go. 419 CLASSHDRDIR = $(TEMPDIR)/CClassHeaders 420 421 # 422 # CLASSDESTDIR can be used to specify the directory where generated classes 423 # are to be placed. The default is CLASSBINDIR. 424 # 425 ifndef CLASSDESTDIR 426 CLASSDESTDIR = $(CLASSBINDIR) 427 endif 428 429 INCLUDES = -I. -I$(CLASSHDRDIR) \ 430 $(patsubst %,-I%,$(subst $(CLASSPATH_SEPARATOR), ,$(VPATH.h))) $(OTHER_INCLUDES) 431 OTHER_CPPFLAGS = $(INCLUDES) 432 433 434 # 435 # vpaths. These are the default locations searched for source files. 436 # GNUmakefiles of individual areas often override the default settings. 437 # There are no longer default vpath entries for C and assembler files 438 # so we can ensure that libraries don't get their hands on JVM files. 439 # 440 # We define an intermediate variable for Java files because 441 # we use its value later to help define $SOURCEPATH 442 443 VPATH0.java = $(GENSRCDIR)$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/classes 444 ifdef OPENJDK 445 VPATH.java = $(VPATH0.java) 446 else 447 # 448 # If filenames are duplicated between open/closed workspaces, prefer 449 # the closed files. 450 # 451 # Source ordering is important: some targets depend on closed files 452 # replacing open ones, and thus the closed file sources must be found 453 # before the open ones. 454 # 455 # Don't reorder without consulting the teams that depend on this behavior. 456 # 457 VPATH.java = $(CLOSED_PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(CLOSED_SHARE_SRC)/classes$(CLASSPATH_SEPARATOR)$(VPATH0.java) 458 endif 459 vpath %.java $(VPATH.java) 460 vpath %.class $(CLASSBINDIR) 461 vpath %.$(OBJECT_SUFFIX) $(OBJDIR) 462 463 # 464 # VPATH.h is used elsewhere to generate include flags. By default, 465 # anyone has access to the include files that the JVM area exports, 466 # namely jni.h, jvm.h, and jni_utils.h, plus their platform-specific 467 # relatives. 468 # 469 VPATH.h = $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export 470 vpath %.h $(VPATH.h) 471 472 # 473 # Used in two ways: helps link against libjava.so. Also if overridden 474 # determines where your shared library is installed. 475 # 476 ifndef LIB_LOCATION 477 LIB_LOCATION = $(LIBDIR)/$(LIBARCH) 478 endif 479 480 # 481 # Java header and stub variables 482 # 483 CLASSHDRS = $(patsubst %,$(CLASSHDRDIR)/%.h,$(subst .,_,$(CLASSES.export))) 484 CLASSSTUBOBJS = classstubs.$(OBJECT_SUFFIX) 485 STUBPREAMBLE = $(INCLUDEDIR)/StubPreamble.h 486 487 # 488 # Classpath seen by javac (different from the one seen by the VM 489 # running javac), and useful variables. 490 # 491 SOURCEPATH = $(VPATH.java) 492 PKG = $(shell $(EXPR) $(PACKAGE) : '\([a-z]*\)') 493 PKGDIR = $(subst .,/,$(PACKAGE)) 494 495 # 496 # The java/javac/jdk variables (JAVAC_CMD, JAVA_CMD, etc.) 497 # 498 include $(JDK_MAKE_SHARED_DIR)/Defs-java.gmk 499 500 # 501 # Convenient macros 502 # 503 504 # Prepare $@ target, remove old one and making sure directory exists 505 define prep-target 506 $(MKDIR) -p $(@D) 507 $(RM) $@ 508 endef 509 510 # Simple install of $< file to $@ 511 define install-file 512 $(prep-target) 513 $(CP) $< $@ 514 endef 515 516 # Cleanup rule for after debug java run (hotspot.log file is left around) 517 # (This could be an old leftover file in a read-only area, use the @- prefix) 518 HOTSPOT_LOG_NAME = hotspot.log 519 define java-vm-cleanup 520 if [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fi 521 endef 522 523 # Default make settings for processing SUBDIRS with clobber or clean names 524 SUBDIRS_MAKEFLAGS-clobber = INCREMENTAL_BUILD=false 525 SUBDIRS_MAKEFLAGS-clean = INCREMENTAL_BUILD=false 526 527 # Current directory 528 CURRENT_DIRECTORY := $(shell $(PWD)) 529 530 # If no timing wanted, we need to define these as empty 531 ifdef NO_TIMING 532 533 TIMING_ID:=NA 534 535 define TIMING_start 536 t=0:0:0:0 537 endef 538 539 define TIMING_end 540 time_used=0 541 endef 542 543 else # NO_TIMING 544 545 # Default timing id 546 TIMING_ID:=$(shell $(BASENAME) $(CURRENT_DIRECTORY)) 547 548 # Timing start (must be used in same shell, e.g. same command line) 549 # Defines the shell variable $1 to have the start time. 550 define TIMING_start 551 $1=`$(DATE) +%j:%H:%M:%S` 552 endef 553 554 # Timing end (must be used in same shell, e.g. same command line) 555 # Expects shell variable $1 to have been defined as the start time. 556 # Expects shell variable $2 to have timing id string 557 # Sets total_seconds shell variable as the total seconds used. 558 # Sets time_used shell variable to contain format "%dh%dm%ds" 559 define TIMING_end 560 begTime="$${$1}"; \ 561 timing_id="$${$2}"; \ 562 endTime=`$(DATE) +%j:%H:%M:%S`; \ 563 d1=`$(ECHO) $${begTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \ 564 if [ "$${d1}" = "" ] ; then d1=0; fi; \ 565 h1=`$(ECHO) $${begTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \ 566 if [ "$${h1}" = "" ] ; then h1=0; fi; \ 567 m1=`$(ECHO) $${begTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \ 568 if [ "$${m1}" = "" ] ; then m1=0; fi; \ 569 s1=`$(ECHO) $${begTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \ 570 if [ "$${s1}" = "" ] ; then s1=0; fi; \ 571 d2=`$(ECHO) $${endTime} | $(CUT) -d':' -f1 | $(SED) -e 's@^0*@@'`; \ 572 if [ "$${d2}" = "" ] ; then d2=0; fi; \ 573 h2=`$(ECHO) $${endTime} | $(CUT) -d':' -f2 | $(SED) -e 's@^0*@@'`; \ 574 if [ "$${h2}" = "" ] ; then h2=0; fi; \ 575 m2=`$(ECHO) $${endTime} | $(CUT) -d':' -f3 | $(SED) -e 's@^0*@@'`; \ 576 if [ "$${m2}" = "" ] ; then m2=0; fi; \ 577 s2=`$(ECHO) $${endTime} | $(CUT) -d':' -f4 | $(SED) -e 's@^0*@@'`; \ 578 if [ "$${s2}" = "" ] ; then s2=0; fi; \ 579 t1_secs=`$(EXPR) $${d1} '*' 60 '*' 60 '*' 24 '+' $${h1} '*' 60 '*' 60 \ 580 '+' $${m1} '*' 60 '+' $${s1}`; \ 581 t2_secs=`$(EXPR) $${d2} '*' 60 '*' 60 '*' 24 '+' $${h2} '*' 60 '*' 60 \ 582 '+' $${m2} '*' 60 '+' $${s2}`; \ 583 total_seconds=`$(EXPR) $${t2_secs} '-' $${t1_secs}`; \ 584 if [ "$${total_seconds}" -lt 0 ] ; then total_seconds=0; fi; \ 585 t_hour=`$(EXPR) $${total_seconds} '/' '(' 60 '*' 60 ')'`h; \ 586 t_min=`$(EXPR) '(' $${total_seconds} '%' '(' 60 '*' 60 ')' ')' '/' 60`m; \ 587 t_sec=`$(EXPR) $${total_seconds} '%' 60`s; \ 588 time_used=$${t_sec}; \ 589 if [ "$${t_hour}" != "0h" ] ; then \ 590 time_used=$${t_hour}$${t_min}$${t_sec}; \ 591 elif [ "$${t_min}" != "0m" ] ; then \ 592 time_used=$${t_min}$${t_sec}; \ 593 else \ 594 time_used=$${t_sec}; \ 595 fi; \ 596 $(PRINTF) " Timing: %05d seconds or %s for %s\n" \ 597 $${total_seconds} $${time_used} $${timing_id} 598 endef 599 600 endif # NO_TIMING 601 602 # Given a SUBDIRS list, cd into them and make them 603 # SUBDIRS_MAKEFLAGS Make settings for a subdir make 604 # SUBDIRS_MAKEFLAGS-$@ Make settings specific to this target 605 define SUBDIRS-loop 606 @$(ECHO) "Begin Processing SUBDIRS: $(SUBDIRS)" 607 @for i in DUMMY $(SUBDIRS) ; do \ 608 if [ "$$i" != "DUMMY" ] ; then \ 609 $(ECHO) ">>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \ 610 timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \ 611 $(call TIMING_start,startTime); \ 612 curDir=$(CURRENT_DIRECTORY); \ 613 $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \ 614 $(SUBDIRS_MAKEFLAGS) \ 615 $(SUBDIRS_MAKEFLAGS-$@) \ 616 FULL_VERSION=$(FULL_VERSION) \ 617 RELEASE=$(RELEASE) || exit 1; \ 618 $(CD) $${curDir}; \ 619 $(call TIMING_end,startTime,timing_id); \ 620 $(ECHO) "<<<Finished Recursively making "$$i" "$@" @ `$(DATE)`." ; \ 621 fi ; \ 622 done 623 @$(ECHO) "Done Processing SUBDIRS: $(SUBDIRS)" 624 endef 625 626 # Given a OTHERSUBDIRS list, cd into them and make them (extra loop define) 627 # OTHERSUBDIRS_MAKEFLAGS Make settings for a subdir make 628 define OTHERSUBDIRS-loop 629 @$(ECHO) "Begin Processing OTHERSUBDIRS: $(OTHERSUBDIRS)" 630 @for i in DUMMY $(OTHERSUBDIRS) ; do \ 631 if [ "$$i" != "DUMMY" ] ; then \ 632 $(ECHO) ">>>Recursively making "$$i" "$@" @ `$(DATE)` ..."; \ 633 timing_id="$(TIMING_ID)-`$(BASENAME) $${i}`"; \ 634 $(call TIMING_start,startTime); \ 635 curDir=$(CURRENT_DIRECTORY); \ 636 $(CD) $$i; $(MAKE) $@ TIMING_ID=$${timing_id} \ 637 $(OTHERSUBDIRS_MAKEFLAGS) \ 638 FULL_VERSION=$(FULL_VERSION) \ 639 RELEASE=$(RELEASE) || exit 1; \ 640 $(CD) $${curDir}; \ 641 $(call TIMING_end,startTime,timing_id); \ 642 $(ECHO) "<<<Finished Recursively making "$$i" "$@" @ `$(DATE)`." ; \ 643 fi ; \ 644 done 645 @$(ECHO) "Done Processing OTHERSUBDIRS: $(OTHERSUBDIRS)" 646 endef 647 648 # 649 # Create BYFILE OPT and DBG settings, if CFLAGS_OPT/foobar.o is set then it is 650 # used for this file, otherwise the default settings are used. 651 # 652 CFLAGS_$(VARIANT)/BYFILE = $(CFLAGS_$(VARIANT)/$(@F)) \ 653 $(CFLAGS_$(VARIANT)$(CFLAGS_$(VARIANT)/$(@F))) 654 CXXFLAGS_$(VARIANT)/BYFILE = $(CXXFLAGS_$(VARIANT)/$(@F)) \ 655 $(CXXFLAGS_$(VARIANT)$(CXXFLAGS_$(VARIANT)/$(@F))) 656 657 # 658 # Tool flags 659 # 660 ASFLAGS = $(ASFLAGS_$(VARIANT)) $(ASFLAGS_COMMON) $(OTHER_ASFLAGS) 661 CFLAGS = $(CFLAGS_$(VARIANT)/BYFILE) $(CFLAGS_COMMON) $(OTHER_CFLAGS) 662 CXXFLAGS = $(CXXFLAGS_$(VARIANT)/BYFILE) $(CXXFLAGS_COMMON) $(OTHER_CXXFLAGS) 663 CPPFLAGS = $(CPPFLAGS_$(VARIANT)) $(CPPFLAGS_COMMON) $(OTHER_CPPFLAGS) \ 664 $(DEFINES) $(OPTIONS:%=-D%) 665 LDFLAGS = $(LDFLAGS_$(VARIANT)) $(LDFLAGS_COMMON) $(OTHER_LDFLAGS) 666 LDLIBS = $(OTHER_LDLIBS) $(LDLIBS_$(VARIANT)) $(LDLIBS_COMMON) 667 LINTFLAGS = $(LINTFLAGS_$(VARIANT)) $(LINTFLAGS_COMMON) \ 668 $(OTHER_LINTFLAGS) 669 670 # this should be moved into Defs-<platform>.gmk..... 671 ifeq ($(PLATFORM), windows) 672 VERSION_DEFINES = -DRELEASE="\"$(RELEASE)\"" 673 else 674 VERSION_DEFINES = -DRELEASE='"$(RELEASE)"' 675 endif 676 677 # Note: As a rule, GNU Make rules should not appear in any of the 678 # Defs*.gmk files. These were added for Kestrel-Solaris and do address 679 # a TeamWare bug. They should be moved elsewhere for Merlin. 680 # 681 # Override gnumake built-in rules which do sccs get operations badly. 682 # (They put the checked out code in the current directory, not in the 683 # directory of the original file.) 684 # Since this is a symptom of a teamware failure, complain and die on the spot. 685 686 # This message immediately goes to stdout and the build terminates. 687 define SCCS-trouble 688 $(error \ 689 "ERROR: File $@ referenced while building in $(CURRENT_DIRECTORY) \ 690 is out of date with respect to its SCCS file $<. \ 691 This can happen from an unresolved Teamware conflict, a file movement, or \ 692 a failure in which SCCS files are updated but the 'sccs get' was not done. \ 693 You should double check for other out of date files in your workspace. \ 694 Or run: cd $(TOPDIR) && $(MAKE) sccs_get") 695 endef 696 697 %:: s.% 698 @$(SCCS-trouble) 699 %:: SCCS/s.% 700 @$(SCCS-trouble) 701 @$(ECHO) " is out of date with respect to its SCCS file." >> $(WARNING_FILE) 702 @$(ECHO) " This file may be from an unresolved Teamware conflict." >> $(WARNING_FILE) 703 @$(ECHO) " This is also a symptom of a Teamware bringover/putback failure" >> $(WARNING_FILE) 704 @$(ECHO) " in which SCCS files are updated but not checked out." >> $(WARNING_FILE) 705 @$(ECHO) " Check for other out of date files in your workspace." >> $(WARNING_FILE) 706 @$(ECHO) "" >> $(WARNING_FILE) 707 @#exit 666 708 709 ifdef INSANE 710 export INSANE 711 endif 712 713 ifdef ALT_COPYRIGHT_YEAR 714 COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR) 715 else 716 COPYRIGHT_YEAR := $(shell $(DATE) '+%Y') 717 endif 718 719 # Install of imported file (JDK_IMPORT_PATH, or some other external location) 720 define install-import-file 721 @$(ECHO) "ASSEMBLY_IMPORT: $@" 722 $(prep-target) 723 $(CP) $< $@ 724 @if [ "$(PLATFORM)" = "linux" -a "$(@F)" = "libjvm.so" ] ; then \ 725 if [ -x /usr/sbin/selinuxenabled ] ; then \ 726 /usr/sbin/selinuxenabled; \ 727 if [ $$? = 0 ] ; then \ 728 $(ECHO) "/usr/bin/chcon -t textrel_shlib_t $@"; \ 729 /usr/bin/chcon -t textrel_shlib_t $@; \ 730 if [ $$? != 0 ]; then \ 731 echo "ERROR: Cannot chcon $@"; \ 732 fi; \ 733 fi; \ 734 fi; \ 735 fi 736 endef 737 738 .PHONY: all build clean clobber