1 # 2 # Copyright (c) 1995, 2008, 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 # 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 ifdef ALT_FREETYPE_HEADERS_PATH 229 FREETYPE_HEADERS_PATH = $(ALT_FREETYPE_HEADERS_PATH) 230 else 231 ifeq ($(DEVTOOLS_FT_DIR_EXISTS), true) 232 FREETYPE_HEADERS_PATH = $(DEVTOOLS_FT_DIR)/include 233 else 234 FREETYPE_HEADERS_PATH = /usr/include 235 endif 236 endif 237 endif 238 239 # 240 # zlib version 241 # 242 ZLIB_VERSION = 1.2.3 243 244 245 # 246 # Localizations for the different parts of the product beyond English 247 # 248 249 JRE_LOCALES = de es fr it ja ko sv zh_CN zh_TW zh_HK 250 PLUGIN_LOCALES = de es fr it ja ko sv zh_CN zh_TW zh_HK 251 JDK_LOCALES = ja zh_CN 252 253 # 254 # A list of locales we support but don't have resource files. 255 # This is defined to optimize the search of resource bundles. 256 # 257 JRE_NONEXIST_LOCALES = en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh 258 259 # 260 # All libraries except libjava and libjvm itself link against libjvm and 261 # libjava, the latter for its exported common utilities. libjava only links 262 # against libjvm. Programs' makefiles take their own responsibility for 263 # adding other libs. 264 # 265 ifdef PACKAGE 266 # put JAVALIB first, but do not lose any platform specific values.... 267 LDLIBS_COMMON = $(JAVALIB) 268 endif # PACKAGE 269 270 # 271 # Libraries that must appear ahead of libc.so on the link command line 272 # 273 ifdef PROGRAM 274 275 ifeq ($(PLATFORM), solaris) 276 LDLIBS_COMMON = -lthread -ldl 277 endif 278 279 ifeq ($(PLATFORM), linux) 280 LDLIBS_COMMON = -ldl 281 endif 282 283 endif # PROGRAM 284 285 LDLIBS_COMMON += $(EXTRA_LIBS) 286 287 # 288 # Default is to build, not import native binaries 289 # 290 ifndef IMPORT_NATIVE_BINARIES 291 IMPORT_NATIVE_BINARIES=false 292 endif 293 # If importing libraries in, no incremental builds 294 ifeq ($(IMPORT_NATIVE_BINARIES),true) 295 INCREMENTAL_BUILD=false 296 endif 297 298 # for generated libraries 299 LIBDIR = $(OUTPUTDIR)/lib 300 ABS_LIBDIR = $(ABS_OUTPUTDIR)/lib 301 # Optional place to save the windows .lib files 302 LIBFILES_DIR = $(OUTPUTDIR)/libfiles 303 # for ext jre files 304 EXTDIR = $(LIBDIR)/ext 305 # for generated include files 306 INCLUDEDIR = $(OUTPUTDIR)/include 307 # for generated class files 308 CLASSBINDIR = $(OUTPUTDIR)/classes 309 DEMOCLASSDIR = $(OUTPUTDIR)/democlasses 310 # for generated tool class files 311 BUILDTOOLCLASSDIR = $(OUTPUTDIR)/btclasses 312 # for build tool jar files 313 BUILDTOOLJARDIR = $(OUTPUTDIR)/btjars 314 ABS_BUILDTOOLJARDIR = $(ABS_OUTPUTDIR)/btjars 315 # for generated tool class files 316 BUILDTOOLBINDIR = $(OUTPUTDIR)/btbins 317 # for generated java source files 318 GENSRCDIR = $(OUTPUTDIR)/gensrc 319 # for generated C source files (not javah) 320 GENNATIVESRCDIR = $(OUTPUTDIR)/gennativesrc 321 # for imported source files 322 IMPORTSRCDIR = $(OUTPUTDIR)/impsrc 323 # for imported documents 324 IMPORTDOCDIR = $(OUTPUTDIR)/impdoc 325 # for generated demo 326 DEMODIR = $(OUTPUTDIR)/demo 327 # for sample code 328 SAMPLEDIR = $(OUTPUTDIR)/sample 329 # for generated documentation 330 DOCSDIR = $(OUTPUTDIR)/docs$(DOCSDIRSUFFIX) 331 DOCSDIRSUFFIX = 332 333 # The MESSAGE, WARNING and ERROR files are used to store sanityck and 334 # SCCS check messages, warnings and errors. 335 ifndef ERROR_FILE 336 ERROR_FILE = $(OUTPUTDIR)/sanityCheckErrors.txt 337 endif 338 ifndef WARNING_FILE 339 WARNING_FILE = $(OUTPUTDIR)/sanityCheckWarnings.txt 340 endif 341 ifndef MESSAGE_FILE 342 MESSAGE_FILE = $(OUTPUTDIR)/sanityCheckMessages.txt 343 endif 344 345 JDK_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2sdk-image 346 JRE_IMAGE_DIR = $(ABS_OUTPUTDIR)/j2re-image 347 348 #where the demo source can be found 349 DEMOSRCDIR = $(SHARE_SRC)/demo 350 351 # An attempt is made to generate unique enough directories for the 352 # generated files to not have name collisisons. Most build units 353 # defines PRODUCT (except Release.gmk), but then they may or may 354 # not define PACKAGE, THREADIR (only HPI uses this), PROGRAM, and 355 # LIBRARY. This code chunk attempts to generate a unique 356 # OBJDIR/CLASSHDRDIR for each build unit based on which of those 357 # values are set within each build unit. 358 359 UNIQUE_LOCATION_STRING = tmp 360 361 ifneq ($(PRODUCT),) 362 UNIQUE_LOCATION_STRING += /$(PRODUCT) 363 endif 364 365 ifneq ($(PACKAGE),) 366 UNIQUE_LOCATION_STRING += /$(PACKAGE) 367 endif 368 369 ifneq ($(PROGRAM),) 370 UNIQUE_LOCATION_STRING += /$(PROGRAM) 371 endif 372 373 ifneq ($(LIBRARY),) 374 ifneq ($(LIBRARY_OUTPUT),) 375 UNIQUE_LOCATION_STRING += /$(LIBRARY_OUTPUT) 376 else 377 UNIQUE_LOCATION_STRING += /$(LIBRARY) 378 endif 379 endif 380 381 ifneq ($(THREADDIR),) 382 UNIQUE_LOCATION_STRING += /$(THREADDIR) 383 endif 384 385 # the use of += above makes a space separated list which we need to 386 # remove for filespecs. 387 # 388 NULLSTRING := 389 ONESPACE := $(NULLSTRING) # space before this comment is required. 390 UNIQUE_PATH = $(subst $(ONESPACE),,$(UNIQUE_LOCATION_STRING)) 391 392 # TEMPDIR is a unique general purpose directory 393 # need to use 'override' because GNU Make on Linux exports the wrong 394 # value. 395 override TEMPDIR = $(OUTPUTDIR)/$(UNIQUE_PATH) 396 override ABS_TEMPDIR = $(ABS_OUTPUTDIR)/$(UNIQUE_PATH) 397 398 # This must be created right away for pattern rules in Sanity.gmk to work. 399 dummy1:=$(shell $(MKDIR) -p $(TEMPDIR)) 400 dummy2:=$(shell $(MKDIR) -p $(TEMP_DISK)) 401 402 # OBJDIRNAME is the name of the directory where the object code is to 403 # be placed. It's name depends on whether the data model architecture 404 # is 32-bit or not. 405 ifneq ($(ARCH_DATA_MODEL), 32) 406 OBJDIRNAME = obj$(ARCH_DATA_MODEL)$(OBJDIRNAME_SUFFIX) 407 else 408 OBJDIRNAME = obj$(OBJDIRNAME_SUFFIX) 409 endif 410 OBJDIR = $(TEMPDIR)/$(OBJDIRNAME) 411 412 # CLASSHDRDIR is where the generated C Class Header files go. 413 CLASSHDRDIR = $(TEMPDIR)/CClassHeaders 414 415 # 416 # CLASSDESTDIR can be used to specify the directory where generated classes 417 # are to be placed. The default is CLASSBINDIR. 418 # 419 ifndef CLASSDESTDIR 420 CLASSDESTDIR = $(CLASSBINDIR) 421 endif 422 423 INCLUDES = -I. -I$(CLASSHDRDIR) \ 424 $(patsubst %,-I%,$(subst $(CLASSPATH_SEPARATOR), ,$(VPATH.h))) $(OTHER_INCLUDES) 425 OTHER_CPPFLAGS = $(INCLUDES) 426 427 428 # 429 # vpaths. These are the default locations searched for source files. 430 # GNUmakefiles of individual areas often override the default settings. 431 # There are no longer default vpath entries for C and assembler files 432 # so we can ensure that libraries don't get their hands on JVM files. 433 # 434 # We define an intermediate variable for Java files because 435 # we use its value later to help define $SOURCEPATH 436 437 VPATH0.java = $(GENSRCDIR)$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/classes 438 ifdef OPENJDK 439 VPATH.java = $(VPATH0.java) 440 else 441 # 442 # If filenames are duplicated between open/closed workspaces, prefer 443 # the closed files. 444 # 445 # Source ordering is important: some targets depend on closed files 446 # replacing open ones, and thus the closed file sources must be found 447 # before the open ones. 448 # 449 # Don't reorder without consulting the teams that depend on this behavior. 450 # 451 VPATH.java = $(CLOSED_PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(CLOSED_SHARE_SRC)/classes$(CLASSPATH_SEPARATOR)$(VPATH0.java) 452 endif 453 vpath %.java $(VPATH.java) 454 vpath %.class $(CLASSBINDIR) 455 vpath %.$(OBJECT_SUFFIX) $(OBJDIR) 456 457 # 458 # VPATH.h is used elsewhere to generate include flags. By default, 459 # anyone has access to the include files that the JVM area exports, 460 # namely jni.h, jvm.h, and jni_utils.h, plus their platform-specific 461 # relatives. 462 # 463 VPATH.h = $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export 464 vpath %.h $(VPATH.h) 465 466 # 467 # Used in two ways: helps link against libjava.so. Also if overridden 468 # determines where your shared library is installed. 469 # 470 ifndef LIB_LOCATION 471 LIB_LOCATION = $(LIBDIR)/$(LIBARCH) 472 endif 473 474 # 475 # Java header and stub variables 476 # 477 CLASSHDRS = $(patsubst %,$(CLASSHDRDIR)/%.h,$(subst .,_,$(CLASSES.export))) 478 CLASSSTUBOBJS = classstubs.$(OBJECT_SUFFIX) 479 STUBPREAMBLE = $(INCLUDEDIR)/StubPreamble.h 480 481 # 482 # Classpath seen by javac (different from the one seen by the VM 483 # running javac), and useful variables. 484 # 485 SOURCEPATH = $(VPATH.java) 486 PKG = $(shell $(EXPR) $(PACKAGE) : '\([a-z]*\)') 487 PKGDIR = $(subst .,/,$(PACKAGE)) 488 489 # 490 # The java/javac/jdk variables (JAVAC_CMD, JAVA_CMD, etc.) 491 # 492 include $(JDK_MAKE_SHARED_DIR)/Defs-java.gmk 493 494 # 495 # The modules variables 496 # 497 include $(JDK_TOPDIR)/make/common/Defs-modules.gmk 498 499 # 500 # Macros to find the module that $@ belongs to 501 # 502 503 # Install a file to its module 504 define install-module-file 505 dest=$(call GetModuleDest, $(@D)/) ; \ 506 $(MKDIR) -p $$dest; \ 507 $(CP) -f $@ $$dest 508 endef 509 510 # Install all files from the directory to its module 511 define install-module-dir 512 dest=$(call GetModuleDest, $(@D)/) ; \ 513 $(MKDIR) -p $$dest; \ 514 $(CP) -rf $(@D)/* $$dest 515 endef 516 517 # chmod the file in its module 518 define chmod-module-file 519 dest=$(call GetModuleDest, $@) ; \ 520 $(CHMOD) $1 $$dest 521 endef 522 523 # install a sym link in its module 524 define install-module-sym-link 525 dest=$(call GetModuleDest, $@) ; \ 526 $(LN) -sf $1 $$dest 527 endef 528 529 530 # Run MAKE $@ for a launcher: 531 # $(call make-launcher, name, mainclass, java-args, main-args) 532 define make-launcher 533 $(CD) $(BUILDDIR)/launchers && \ 534 $(MAKE) -f Makefile.launcher \ 535 PROGRAM=$(strip $1) \ 536 MAIN_CLASS=$(strip $2) \ 537 MAIN_JAVA_ARGS="$(strip $3)" \ 538 MAIN_ARGS="$(strip $4)" \ 539 MODULE="$(strip $5)" \ 540 PROGRAM_MODULE="$(strip $5)" 541 endef 542 543 # 544 # Convenient macros 545 # 546 547 # Prepare $@ target, remove old one and making sure directory exists 548 define prep-target 549 $(MKDIR) -p $(@D) 550 $(RM) $@ 551 endef 552 553 # Simple install of $< file to $@ 554 # and also install $< file to its module directory 555 define install-file 556 $(prep-target) 557 $(CP) $< $@ 558 @$(install-module-file) 559 endef 560 561 # Include header files always belongs the base module 562 define install-include-file 563 $(prep-target) 564 $(CP) $< $@ 565 dest=$(call GetBaseModuleDest, $(@D)/) ; \ 566 $(MKDIR) -p $$dest; \ 567 $(CP) -f $@ $$dest 568 endef 569 570 define chmod-file 571 $(CHMOD) $1 $@ 572 @$(call chmod-module-file, $1) 573 endef 574 575 define install-sym-link 576 $(LN) -s $1 $@ 577 @$(call install-module-sym-link, $1) 578 endef 579 580 # 581 # Marcos for files not belonging to any module 582 define install-non-module-file 583 $(prep-target) 584 $(CP) $< $@ 585 endef 586 587 define install-manifest-file 588 $(install-non-module-file) 589 endef 590 591 # Cleanup rule for after debug java run (hotspot.log file is left around) 592 # (This could be an old leftover file in a read-only area, use the @- prefix) 593 HOTSPOT_LOG_NAME = hotspot.log 594 define java-vm-cleanup 595 if [ -w $(HOTSPOT_LOG_NAME) ] ; then $(RM) $(HOTSPOT_LOG_NAME); fi 596 endef 597 598 # Current directory 599 CURRENT_DIRECTORY := $(shell $(PWD)) 600 601 # 602 # Create BYFILE OPT and DBG settings, if CFLAGS_OPT/foobar.o is set then it is 603 # used for this file, otherwise the default settings are used. 604 # 605 CFLAGS_$(VARIANT)/BYFILE = $(CFLAGS_$(VARIANT)/$(@F)) \ 606 $(CFLAGS_$(VARIANT)$(CFLAGS_$(VARIANT)/$(@F))) 607 CXXFLAGS_$(VARIANT)/BYFILE = $(CXXFLAGS_$(VARIANT)/$(@F)) \ 608 $(CXXFLAGS_$(VARIANT)$(CXXFLAGS_$(VARIANT)/$(@F))) 609 610 # 611 # Tool flags 612 # 613 ASFLAGS = $(ASFLAGS_$(VARIANT)) $(ASFLAGS_COMMON) $(OTHER_ASFLAGS) 614 CFLAGS = $(CFLAGS_$(VARIANT)/BYFILE) $(CFLAGS_COMMON) $(OTHER_CFLAGS) 615 CXXFLAGS = $(CXXFLAGS_$(VARIANT)/BYFILE) $(CXXFLAGS_COMMON) $(OTHER_CXXFLAGS) 616 CPPFLAGS = $(CPPFLAGS_$(VARIANT)) $(CPPFLAGS_COMMON) $(OTHER_CPPFLAGS) \ 617 $(DEFINES) $(OPTIONS:%=-D%) 618 LDFLAGS = $(LDFLAGS_$(VARIANT)) $(LDFLAGS_COMMON) $(OTHER_LDFLAGS) 619 LDLIBS = $(OTHER_LDLIBS) $(LDLIBS_$(VARIANT)) $(LDLIBS_COMMON) 620 LINTFLAGS = $(LINTFLAGS_$(VARIANT)) $(LINTFLAGS_COMMON) \ 621 $(OTHER_LINTFLAGS) 622 623 VERSION_DEFINES = -DRELEASE='"$(RELEASE)"' 624 625 # Note: As a rule, GNU Make rules should not appear in any of the 626 # Defs*.gmk files. These were added for Kestrel-Solaris and do address 627 # a TeamWare bug. They should be moved elsewhere for Merlin. 628 # 629 # Override gnumake built-in rules which do sccs get operations badly. 630 # (They put the checked out code in the current directory, not in the 631 # directory of the original file.) 632 # Since this is a symptom of a teamware failure, complain and die on the spot. 633 634 # This message immediately goes to stdout and the build terminates. 635 define SCCS-trouble 636 $(error \ 637 "ERROR: File $@ referenced while building in $(CURRENT_DIRECTORY) \ 638 is out of date with respect to its SCCS file $<. \ 639 This can happen from an unresolved Teamware conflict, a file movement, or \ 640 a failure in which SCCS files are updated but the 'sccs get' was not done. \ 641 You should double check for other out of date files in your workspace. \ 642 Or run: cd $(TOPDIR) && $(MAKE) sccs_get") 643 endef 644 645 %:: s.% 646 @$(SCCS-trouble) 647 %:: SCCS/s.% 648 @$(SCCS-trouble) 649 @$(ECHO) " is out of date with respect to its SCCS file." >> $(WARNING_FILE) 650 @$(ECHO) " This file may be from an unresolved Teamware conflict." >> $(WARNING_FILE) 651 @$(ECHO) " This is also a symptom of a Teamware bringover/putback failure" >> $(WARNING_FILE) 652 @$(ECHO) " in which SCCS files are updated but not checked out." >> $(WARNING_FILE) 653 @$(ECHO) " Check for other out of date files in your workspace." >> $(WARNING_FILE) 654 @$(ECHO) "" >> $(WARNING_FILE) 655 @#exit 666 656 657 ifdef INSANE 658 export INSANE 659 endif 660 661 ifdef ALT_COPYRIGHT_YEAR 662 COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR) 663 else 664 COPYRIGHT_YEAR := $(shell $(DATE) '+%Y') 665 endif 666 667 # Install of imported file (JDK_IMPORT_PATH, or some other external location) 668 define install-importonly-file 669 @$(ECHO) "ASSEMBLY_IMPORT: $@" 670 $(prep-target) 671 $(CP) $< $@ 672 @if [ "$(PLATFORM)" = "linux" -a "$(@F)" = "libjvm.so" ] ; then \ 673 if [ -x /usr/sbin/selinuxenabled ] ; then \ 674 /usr/sbin/selinuxenabled; \ 675 if [ $$? = 0 ] ; then \ 676 $(ECHO) "/usr/bin/chcon -t textrel_shlib_t $@"; \ 677 /usr/bin/chcon -t textrel_shlib_t $@; \ 678 if [ $$? != 0 ]; then \ 679 echo "ERROR: Cannot chcon $@"; \ 680 fi; \ 681 fi; \ 682 fi; \ 683 fi 684 endef 685 686 define install-import-file 687 $(install-importonly-file) 688 @$(install-module-file) 689 endef 690 691 .PHONY: all build clean clobber