jdk/makefiles/common/Defs.gmk
changeset 13164 72c5d01a857d
parent 13082 9b19b2302c28
child 13167 efec101d7d87
equal deleted inserted replaced
13082:9b19b2302c28 13164:72c5d01a857d
     1 #
       
     2 # Copyright (c) 1995, 2011, 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 include $(SPEC)
       
    51 include $(JDK_MAKE_SHARED_DIR)/Platform.gmk
       
    52 
       
    53 # Historically PLATFORM_SRC used to be src/$(PLATFORM), but we switched it to
       
    54 # src/solaris so if you want to build on Linux you didn't need a src/linux
       
    55 # directory.  In an ideal world it would be called src/genunix but we are not
       
    56 # there yet.
       
    57 #
       
    58 ifndef SHARE_SRC
       
    59   SHARE_SRC    = $(BUILDDIR)/../src/share
       
    60 endif
       
    61 
       
    62 # Files that cannot be included in the OpenJDK distribution are
       
    63 # collected under a parent directory which contains just those files.
       
    64 ifndef CLOSED_SRC
       
    65   CLOSED_SRC  = $(BUILDDIR)/../src/closed
       
    66 endif
       
    67 
       
    68 # If CLOSE_SRC_INCLUDED isn't set to true, check if there's any
       
    69 # closed directory.
       
    70 ifneq ($(CLOSED_SRC_INCLUDED), true)
       
    71   CLOSED_SRC_INCLUDED := $(shell \
       
    72     if [ -d $(CLOSED_SRC) ] ; then \
       
    73       echo true; \
       
    74     else \
       
    75       echo false; \
       
    76     fi)
       
    77 endif
       
    78 
       
    79 # Set OPENJDK based on CLOSED_SRC_INCLUDED
       
    80 ifeq ($(CLOSED_SRC_INCLUDED), false)
       
    81   OPENJDK = true
       
    82 endif
       
    83 
       
    84 # Define where closed directories are
       
    85 ifdef OPENJDK
       
    86   CLOSED_SRC =
       
    87   CLOSED_SHARE_SRC =
       
    88 else
       
    89   ifndef CLOSED_SHARE_SRC
       
    90     CLOSED_SHARE_SRC    = $(CLOSED_SRC)/share
       
    91   endif
       
    92 endif
       
    93 
       
    94 #
       
    95 # Get platform definitions
       
    96 #
       
    97 
       
    98 include $(JDK_TOPDIR)/makefiles/common/Defs-$(PLATFORM).gmk
       
    99 
       
   100 #
       
   101 # SE-Embedded support, if enabled
       
   102 #
       
   103 
       
   104 include $(JDK_TOPDIR)/makefiles/common/Defs-embedded.gmk
       
   105 
       
   106 #
       
   107 # Cross-compilation Settings
       
   108 #
       
   109 ifdef CROSS_COMPILE_ARCH
       
   110   # Can't run the tools we just built
       
   111   USE_ONLY_BOOTDIR_TOOLS = true
       
   112 
       
   113   # When cross-compiling CC generates code for the target, but
       
   114   # some parts of the build generate C code that has to be compiled
       
   115   # and executed on the build host - HOST_CC is the 'local' compiler.
       
   116   # For linux the default is /usr/bin/gcc; other platforms need to
       
   117   # set it explicitly
       
   118   ifeq ($(PLATFORM), linux)
       
   119     ifndef HOST_CC
       
   120       HOST_CC = $(USRBIN_PATH)gcc
       
   121     endif
       
   122   endif
       
   123 else
       
   124   # Must set HOST_CC if not already set
       
   125   ifndef HOST_CC
       
   126     HOST_CC = $(CC)
       
   127   endif
       
   128 endif
       
   129 
       
   130 # Reset the VM name for client-only builds
       
   131 ifeq ($(JVM_VARIANT),client)
       
   132   VM_NAME = client
       
   133 endif
       
   134 
       
   135 #
       
   136 # Freetype logic is applicable to OpenJDK only
       
   137 #
       
   138 ifdef OPENJDK
       
   139 
       
   140 ifeq ($(PLATFORM), windows)
       
   141   DEVTOOLS_FT_DIR=$(JDK_DEVTOOLS_DIR)/win32/freetype-$(ARCH)
       
   142 endif
       
   143 ifeq ($(PLATFORM), linux)
       
   144   DEVTOOLS_FT_DIR=$(JDK_DEVTOOLS_DIR)/$(PLATFORM)/freetype-$(ARCH)
       
   145 endif
       
   146 ifeq ($(PLATFORM), solaris)
       
   147   # historically for Solaris we have slightly different devtools 
       
   148   # naming conventions
       
   149   DEVTOOLS_FT_DIR=$(JDK_DEVTOOLS_DIR)/$(ARCH_FAMILY)/freetype-$(ARCH)
       
   150 endif
       
   151 
       
   152 DEVTOOLS_FT_DIR_EXISTS = $(shell \
       
   153   if [ -f $(DEVTOOLS_FT_DIR)/include/ft2build.h ] ; then \
       
   154     echo true; \
       
   155   else \
       
   156     echo false; \
       
   157   fi)
       
   158 
       
   159   ifdef ALT_FREETYPE_LIB_PATH
       
   160     FREETYPE_LIB_PATH = $(ALT_FREETYPE_LIB_PATH)
       
   161     ifeq ($(PLATFORM), macosx)
       
   162       USING_SYSTEM_FT_LIB=true
       
   163     endif
       
   164   else
       
   165     ifeq ($(DEVTOOLS_FT_DIR_EXISTS), true)
       
   166       FREETYPE_LIB_PATH = $(DEVTOOLS_FT_DIR)/lib
       
   167     else
       
   168       ifeq ($(PLATFORM), macosx)
       
   169         FREETYPE_LIB_PATH = /usr/X11R6/lib
       
   170       else
       
   171         FREETYPE_LIB_PATH = /usr/lib
       
   172       endif
       
   173       USING_SYSTEM_FT_LIB=true
       
   174     endif
       
   175   endif 
       
   176 
       
   177   ifdef ALT_FREETYPE_HEADERS_PATH
       
   178     FREETYPE_HEADERS_PATH = $(ALT_FREETYPE_HEADERS_PATH)
       
   179   else
       
   180     ifeq ($(DEVTOOLS_FT_DIR_EXISTS), true)
       
   181       FREETYPE_HEADERS_PATH = $(DEVTOOLS_FT_DIR)/include
       
   182     else
       
   183       ifeq ($(PLATFORM), macosx)
       
   184         FREETYPE_HEADERS_PATH = /usr/X11R6/include
       
   185       else
       
   186         FREETYPE_HEADERS_PATH = /usr/include
       
   187       endif
       
   188     endif
       
   189   endif
       
   190 endif
       
   191 
       
   192 #
       
   193 # zlib version
       
   194 #
       
   195 ZLIB_VERSION = 1.2.5
       
   196 
       
   197 
       
   198 #
       
   199 # Localizations for the different parts of the product beyond English
       
   200 #
       
   201 
       
   202 JRE_LOCALES   = de es fr it ja ko pt_BR sv zh_CN zh_TW zh_HK
       
   203 PLUGIN_LOCALES = de es fr it ja ko pt_BR sv zh_CN zh_TW zh_HK
       
   204 JDK_LOCALES  = ja zh_CN
       
   205 
       
   206 #
       
   207 # A list of locales we support but don't have resource files.
       
   208 # This is defined to optimize the search of resource bundles.
       
   209 #
       
   210 JRE_NONEXIST_LOCALES = en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
       
   211 
       
   212 #
       
   213 # For now, most libraries except libjava and libjvm itself link against libjvm
       
   214 # and libjava, the latter for its exported common utilities. libjava only
       
   215 # links against libjvm. Programs' makefiles take their own responsibility for
       
   216 # adding other libs.
       
   217 #
       
   218 # The makefiles for these packages do not link against libjvm and libjava.
       
   219 # This list will eventually go away and each Programs' makefiles
       
   220 # will have to explicitly declare that they want to link to libjava/libjvm
       
   221 #
       
   222 NO_JAVALIB_PKGS = \
       
   223 		sun.security.mscapi \
       
   224 		sun.security.krb5 \
       
   225 		sun.security.pkcs11 \
       
   226 		sun.security.jgss \
       
   227 		sun.security.jgss.wrapper \
       
   228 		sun.security.ec \
       
   229 		sun.security.smartcardio \
       
   230 		com.sun.security.auth.module
       
   231 
       
   232 ifdef PACKAGE
       
   233 # put JAVALIB first, but do not lose any platform specific values....
       
   234   ifeq (,$(findstring $(PACKAGE),$(NO_JAVALIB_PKGS)))
       
   235     LDLIBS_COMMON = $(JAVALIB)
       
   236   endif
       
   237 endif # PACKAGE
       
   238 
       
   239 #
       
   240 # Libraries that must appear ahead of libc.so on the link command line
       
   241 #
       
   242 ifdef PROGRAM
       
   243 
       
   244   ifeq ($(PLATFORM), solaris)
       
   245     LDLIBS_COMMON = -lthread -ldl
       
   246   endif
       
   247 
       
   248   ifeq ($(PLATFORM), linux)
       
   249     LDLIBS_COMMON = -ldl
       
   250   endif
       
   251 
       
   252   ifeq ($(PLATFORM), macosx)
       
   253     LDLIBS_COMMON = -pthread
       
   254   endif
       
   255 
       
   256 endif # PROGRAM
       
   257 
       
   258 LDLIBS_COMMON += $(EXTRA_LIBS)
       
   259 
       
   260 # for generated binaries
       
   261 BINDIR              = $(OUTPUTDIR)/bin$(ISA_DIR)
       
   262 # for generated libraries
       
   263 LIBDIR              = $(OUTPUTDIR)/lib
       
   264 ABS_LIBDIR          = $(ABS_OUTPUTDIR)/lib
       
   265 # Optional place to save the windows .lib files
       
   266 LIBFILES_DIR        = $(OUTPUTDIR)/libfiles
       
   267 # for ext jre files
       
   268 EXTDIR              = $(LIBDIR)/ext
       
   269 # for generated include files
       
   270 INCLUDEDIR          = $(OUTPUTDIR)/include
       
   271 # for generated class files
       
   272 CLASSBINDIR         = $(OUTPUTDIR)/classes
       
   273 DEMOCLASSDIR        = $(OUTPUTDIR)/democlasses
       
   274 # for generated tool class files
       
   275 BUILDTOOLCLASSDIR   = $(OUTPUTDIR)/btclasses
       
   276 # for build tool jar files
       
   277 BUILDTOOLJARDIR     = $(OUTPUTDIR)/btjars
       
   278 ABS_BUILDTOOLJARDIR = $(ABS_OUTPUTDIR)/btjars
       
   279 # for generated tool class files
       
   280 BUILDTOOLBINDIR     = $(OUTPUTDIR)/btbins
       
   281 # for generated java source files
       
   282 GENSRCDIR           = $(OUTPUTDIR)/gensrc
       
   283 # for generated C source files (not javah)
       
   284 GENNATIVESRCDIR     = $(OUTPUTDIR)/gennativesrc
       
   285 # for imported source files
       
   286 IMPORTSRCDIR        = $(OUTPUTDIR)/impsrc
       
   287 # for imported documents
       
   288 IMPORTDOCDIR        = $(OUTPUTDIR)/impdoc
       
   289 # for generated demo
       
   290 DEMODIR             = $(OUTPUTDIR)/demo
       
   291 NEWDEMODIR	    = $(OUTPUTDIR)/newdemo
       
   292 # for sample code
       
   293 SAMPLEDIR           = $(OUTPUTDIR)/sample
       
   294 # for generated documentation
       
   295 DOCSDIR             = $(OUTPUTDIR)/docs$(DOCSDIRSUFFIX)
       
   296 DOCSDIRSUFFIX       =
       
   297 
       
   298 # The MESSAGE, WARNING and ERROR files are used to store sanityck and 
       
   299 # warnings and errors. 
       
   300 ifndef ERROR_FILE
       
   301   ERROR_FILE   = $(OUTPUTDIR)/sanityCheckErrors.txt
       
   302 endif
       
   303 ifndef WARNING_FILE
       
   304   WARNING_FILE = $(OUTPUTDIR)/sanityCheckWarnings.txt
       
   305 endif
       
   306 ifndef MESSAGE_FILE
       
   307   MESSAGE_FILE = $(OUTPUTDIR)/sanityCheckMessages.txt
       
   308 endif
       
   309 
       
   310 #where the demo source can be found
       
   311 DEMOSRCDIR          = $(SHARE_SRC)/demo
       
   312 
       
   313 #where the sample source can be found
       
   314 SAMPLESRCDIR          = $(SHARE_SRC)/sample
       
   315 
       
   316 # An attempt is made to generate unique enough directories for the
       
   317 # generated files to not have name collisisons. Most build units
       
   318 # defines PRODUCT (except Release.gmk), but then they may or may 
       
   319 # not define PACKAGE, PROGRAM, and LIBRARY. This code attempts to
       
   320 # generate a unique OBJDIR/CLASSHDRDIR for each build unit based
       
   321 # on which of those values are set within each build unit.
       
   322 
       
   323 UNIQUE_LOCATION_STRING = tmp
       
   324 
       
   325 ifneq ($(PRODUCT),)
       
   326   UNIQUE_LOCATION_STRING += /$(PRODUCT)
       
   327 endif
       
   328 
       
   329 ifneq ($(PACKAGE),)
       
   330   UNIQUE_LOCATION_STRING += /$(PACKAGE)
       
   331 endif
       
   332 
       
   333 ifneq ($(PROGRAM),)
       
   334   UNIQUE_LOCATION_STRING += /$(PROGRAM)
       
   335 endif
       
   336 
       
   337 ifneq ($(LIBRARY),)
       
   338   ifneq ($(LIBRARY_OUTPUT),)
       
   339     UNIQUE_LOCATION_STRING += /$(LIBRARY_OUTPUT)
       
   340   else
       
   341     UNIQUE_LOCATION_STRING += /$(LIBRARY)
       
   342   endif
       
   343 endif
       
   344 
       
   345 # the use of += above makes a space separated list which we need to 
       
   346 # remove for filespecs.
       
   347 #
       
   348 NULLSTRING :=
       
   349 ONESPACE := $(NULLSTRING) # space before this comment is required.
       
   350 UNIQUE_PATH = $(subst $(ONESPACE),,$(UNIQUE_LOCATION_STRING))
       
   351 
       
   352 # TEMPDIR is a unique general purpose directory
       
   353 # need to use 'override' because GNU Make on Linux exports the wrong
       
   354 # value.
       
   355 TEMPDIR      ?= $(OUTPUTDIR)/$(UNIQUE_PATH)
       
   356 ABS_TEMPDIR  ?= $(ABS_OUTPUTDIR)/$(UNIQUE_PATH)
       
   357 
       
   358 # This must be created right away for pattern rules in Sanity.gmk to work.
       
   359 dummy1:=$(shell $(MKDIR) -p $(TEMPDIR))
       
   360 dummy2:=$(shell $(MKDIR) -p $(TEMP_DISK))
       
   361 
       
   362 # OBJDIRNAME is the name of the directory where the object code is to
       
   363 #   be placed. It's name depends on whether the data model architecture 
       
   364 #   is 32-bit or not.
       
   365 ifneq ($(ARCH_DATA_MODEL), 32)
       
   366   OBJDIRNAME  = obj$(ARCH_DATA_MODEL)$(OBJDIRNAME_SUFFIX)
       
   367 else
       
   368   OBJDIRNAME  = obj$(OBJDIRNAME_SUFFIX)
       
   369 endif
       
   370 OBJDIR      = $(TEMPDIR)/$(OBJDIRNAME)
       
   371 
       
   372 # CLASSHDRDIR is where the generated C Class Header files go.
       
   373 CLASSHDRDIR = $(TEMPDIR)/CClassHeaders
       
   374 
       
   375 #
       
   376 # CLASSDESTDIR can be used to specify the directory where generated classes
       
   377 # are to be placed. The default is CLASSBINDIR.
       
   378 #
       
   379 ifndef CLASSDESTDIR
       
   380 CLASSDESTDIR = $(CLASSBINDIR)
       
   381 endif
       
   382 
       
   383 INCLUDES = -I. -I$(CLASSHDRDIR) \
       
   384 	$(patsubst %,-I%,$(subst $(CLASSPATH_SEPARATOR), ,$(VPATH.h))) $(OTHER_INCLUDES)
       
   385 OTHER_CPPFLAGS += $(INCLUDES)
       
   386 
       
   387 #
       
   388 # vpaths.  These are the default locations searched for source files.
       
   389 # GNUmakefiles of individual areas often override the default settings.
       
   390 # There are no longer default vpath entries for C and assembler files
       
   391 # so we can ensure that libraries don't get their hands on JVM files.
       
   392 #
       
   393 # We define an intermediate variable for Java files because
       
   394 # we use its value later to help define $SOURCEPATH
       
   395 
       
   396 ifeq ($(PLATFORM), macosx)
       
   397   VPATH0.java = $(subst $(ONESPACE),:,$(GENSRCDIR) $(call JavaSrcDirList,,classes))
       
   398 else
       
   399   VPATH0.java = $(GENSRCDIR)$(CLASSPATH_SEPARATOR)$(PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/classes
       
   400 endif
       
   401 
       
   402 ifdef OPENJDK
       
   403   VPATH.java = $(VPATH0.java)
       
   404 else
       
   405   #
       
   406   # If filenames are duplicated between open/closed workspaces, prefer
       
   407   # the closed files.
       
   408   #
       
   409   # Source ordering is important: some targets depend on closed files
       
   410   # replacing open ones, and thus the closed file sources must be found
       
   411   # before the open ones.
       
   412   #
       
   413   # Don't reorder without consulting the teams that depend on this behavior.
       
   414   #
       
   415   VPATH.java = $(CLOSED_PLATFORM_SRC)/classes$(CLASSPATH_SEPARATOR)$(CLOSED_SHARE_SRC)/classes$(CLASSPATH_SEPARATOR)$(VPATH0.java)
       
   416 endif
       
   417 vpath %.java $(VPATH.java)
       
   418 vpath %.class $(CLASSBINDIR)
       
   419 vpath %.$(OBJECT_SUFFIX) $(OBJDIR)
       
   420 
       
   421 #
       
   422 # VPATH.h is used elsewhere to generate include flags.  By default, 
       
   423 # anyone has access to the include files that the JVM area exports,
       
   424 # namely jni.h, jvm.h, and jni_utils.h, plus their platform-specific
       
   425 # relatives.
       
   426 #
       
   427 VPATH0.h =   $(PLATFORM_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(SHARE_SRC)/javavm/export
       
   428 ifdef OPENJDK
       
   429   VPATH.h = $(VPATH0.h)
       
   430 else
       
   431   VPATH.h = $(CLOSED_SHARE_SRC)/javavm/export$(CLASSPATH_SEPARATOR)$(VPATH0.h)
       
   432 endif
       
   433 vpath %.h   $(VPATH.h)
       
   434 
       
   435 #
       
   436 # Used in two ways: helps link against libjava.so. Also if overridden
       
   437 # determines where your shared library is installed.
       
   438 #
       
   439 ifndef LIB_LOCATION
       
   440   LIB_LOCATION    =  $(LIBDIR)/$(LIBARCH)
       
   441 endif
       
   442 
       
   443 #
       
   444 # Java header and stub variables
       
   445 #
       
   446 CLASSHDRS     = $(patsubst %,$(CLASSHDRDIR)/%.h,$(subst .,_,$(CLASSES.export)))
       
   447 CLASSSTUBOBJS = classstubs.$(OBJECT_SUFFIX)
       
   448 STUBPREAMBLE  = $(INCLUDEDIR)/StubPreamble.h
       
   449 
       
   450 #
       
   451 # Classpath seen by javac (different from the one seen by the VM
       
   452 # running javac), and useful variables.
       
   453 #
       
   454 SOURCEPATH	= $(VPATH.java)
       
   455 PKG		= $(shell $(EXPR) $(PACKAGE) : '\([a-z]*\)')
       
   456 PKGDIR		= $(subst .,/,$(PACKAGE))
       
   457 
       
   458 #
       
   459 # The java/javac/jdk variables (JAVAC_CMD, JAVA_CMD, etc.)
       
   460 #
       
   461 include $(JDK_MAKE_SHARED_DIR)/Defs-java.gmk
       
   462 
       
   463 UNIQUE_PATH_PATTERN = $(subst /,.,$(UNIQUE_PATH))
       
   464 
       
   465 # Run MAKE $@ for a launcher:
       
   466 #   $(call make-launcher, name, mainclass, java-args, main-args)
       
   467 define make-launcher
       
   468 $(CD) $(BUILDDIR)/launchers && \
       
   469 $(MAKE) -f Makefile.launcher \
       
   470         PROGRAM=$(strip $1) \
       
   471         MAIN_CLASS=$(strip $2) \
       
   472         MAIN_JAVA_ARGS="$(strip $3)" \
       
   473         MAIN_ARGS="$(strip $4)"
       
   474 endef
       
   475 
       
   476 #
       
   477 # Convenient macros
       
   478 #
       
   479 
       
   480 # Prepare $@ target, remove old one and making sure directory exists
       
   481 define prep-target
       
   482 mkdir -p $(@D)
       
   483 rm -f $@
       
   484 endef
       
   485 
       
   486 # Simple install of $< file to $@
       
   487 define install-file
       
   488 $(prep-target)
       
   489 $(CP) $< $@
       
   490 endef
       
   491 
       
   492 define chmod-file
       
   493 $(CHMOD) $1 $@
       
   494 endef
       
   495 
       
   496 define install-sym-link
       
   497 $(LN) -s $1 $@
       
   498 endef
       
   499 
       
   500 define install-manifest-file
       
   501 $(install-file)
       
   502 endef
       
   503 
       
   504 # Cleanup rule for after debug java run (hotspot.log file is left around)
       
   505 #   (This could be an old leftover file in a read-only area, use the @- prefix)
       
   506 HOTSPOT_LOG_NAME = hotspot.log
       
   507 define java-vm-cleanup
       
   508 if [ -w $(HOTSPOT_LOG_NAME) ] ; then rm -f $(HOTSPOT_LOG_NAME); fi
       
   509 endef
       
   510 
       
   511 # Current directory
       
   512 CURRENT_DIRECTORY := $(shell $(PWD))
       
   513 
       
   514 #
       
   515 # Create BYFILE OPT and DBG settings, if CFLAGS_OPT/foobar.o is set then it is
       
   516 #    used for this file, otherwise the default settings are used.
       
   517 #
       
   518 CFLAGS_$(VARIANT)/BYFILE    = $(CFLAGS_$(VARIANT)/$(@F)) \
       
   519                               $(CFLAGS_$(VARIANT)$(CFLAGS_$(VARIANT)/$(@F)))
       
   520 CXXFLAGS_$(VARIANT)/BYFILE  = $(CXXFLAGS_$(VARIANT)/$(@F)) \
       
   521                               $(CXXFLAGS_$(VARIANT)$(CXXFLAGS_$(VARIANT)/$(@F)))
       
   522 
       
   523 #
       
   524 # Tool flags
       
   525 #
       
   526 # EXTRA_CFLAGS are used to define cross-compilation options
       
   527 #
       
   528 ASFLAGS         = $(ASFLAGS_$(VARIANT)) $(ASFLAGS_COMMON) $(OTHER_ASFLAGS)
       
   529 CFLAGS          = $(CFLAGS_$(VARIANT)/BYFILE)   $(CFLAGS_COMMON) $(OTHER_CFLAGS) $(EXTRA_CFLAGS)
       
   530 CXXFLAGS        = $(CXXFLAGS_$(VARIANT)/BYFILE) $(CXXFLAGS_COMMON) $(OTHER_CXXFLAGS) $(EXTRA_CFLAGS)
       
   531 CPPFLAGS        = $(CPPFLAGS_$(VARIANT)) $(CPPFLAGS_COMMON) $(OTHER_CPPFLAGS) \
       
   532 		  $(DEFINES) $(OPTIONS:%=-D%) 
       
   533 LDFLAGS         = $(LDFLAGS_$(VARIANT)) $(LDFLAGS_COMMON) $(OTHER_LDFLAGS)
       
   534 LDLIBS          = $(OTHER_LDLIBS) $(LDLIBS_$(VARIANT)) $(LDLIBS_COMMON)
       
   535 LINTFLAGS       = $(LINTFLAGS_$(VARIANT)) $(LINTFLAGS_COMMON) \
       
   536 		  $(OTHER_LINTFLAGS)
       
   537 
       
   538 VERSION_DEFINES = -DRELEASE='"$(RELEASE)"'
       
   539 
       
   540 ifdef INSANE
       
   541   export INSANE
       
   542 endif
       
   543 
       
   544 ifdef ALT_COPYRIGHT_YEAR
       
   545   COPYRIGHT_YEAR = $(ALT_COPYRIGHT_YEAR)
       
   546 else
       
   547   COPYRIGHT_YEAR := $(shell $(DATE) '+%Y')
       
   548 endif
       
   549 
       
   550 ifndef OPENJDK
       
   551 include $(JDK_TOPDIR)/make/closed/common/Defs.gmk
       
   552 endif
       
   553 
       
   554 # Install of imported file (JDK_IMPORT_PATH, or some other external location)
       
   555 define install-importonly-file
       
   556 @$(ECHO) "ASSEMBLY_IMPORT: $@"
       
   557 $(prep-target)
       
   558 $(CP) $< $@
       
   559 @if [ "$(PLATFORM)" = "linux" -a "$(@F)" = "libjvm.so" ] ; then     \
       
   560   if [ -x /usr/sbin/selinuxenabled ] ; then                         \
       
   561     /usr/sbin/selinuxenabled;                                       \
       
   562     if [ $$? = 0 ] ; then                                           \
       
   563       $(ECHO) "/usr/bin/chcon -t textrel_shlib_t $@";               \
       
   564       /usr/bin/chcon -t textrel_shlib_t $@;                         \
       
   565       if [ $$? != 0 ]; then                                         \
       
   566         echo "ERROR: Cannot chcon $@";                              \
       
   567       fi;                                                           \
       
   568     fi;                                                             \
       
   569   fi;                                                               \
       
   570 fi
       
   571 endef
       
   572 
       
   573 define install-import-file
       
   574 $(install-importonly-file)
       
   575 endef
       
   576 
       
   577 .PHONY: all build clean clobber