1 #
   2 # Copyright (c) 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.
   8 #
   9 # This code is distributed in the hope that it will be useful, but WITHOUT
  10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12 # version 2 for more details (a copy is included in the LICENSE file that
  13 # accompanied this code).
  14 #
  15 # You should have received a copy of the GNU General Public License version
  16 # 2 along with this work; if not, write to the Free Software Foundation,
  17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18 #
  19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #  
  23 #
  24 
  25 # This file defines variables and macros which are used in the makefiles to 
  26 # allow distributions to augment or replace common hotspot code with 
  27 # distribution-specific source files.
  28 
  29 # Requires: GAMMADIR
  30 # Provides:
  31 #   variables: HS_COMMON_SRC, HS_ALT_SRC, HS_COMMON_SRC_REL, and HS_ALT_SRC_REL
  32 #   functions: altsrc-equiv, if-has-altsrc, altsrc, altsrc-replace
  33 
  34 HS_COMMON_SRC_REL=src
  35 
  36 # This needs to be changed to a more generic location, but we keep it as this 
  37 # for now for compatibility
  38 ifneq ($(OPENJDK),true)
  39   HS_ALT_SRC_REL=src/closed
  40 else
  41   HS_ALT_SRC=NO_SUCH_PATH
  42 endif
  43 HS_COMMON_SRC=$(GAMMADIR)/$(HS_COMMON_SRC_REL)
  44 HS_ALT_SRC=$(GAMMADIR)/$(HS_ALT_SRC_REL)
  45 
  46 
  47 ## altsrc-equiv 
  48 # 
  49 # Convert a common source path to an alternative source path
  50 #
  51 # Parameter: An absolute path into the common sources
  52 # Result: The matching path to the alternate-source location
  53 #
  54 altsrc-equiv=$(subst $(HS_COMMON_SRC)/,$(HS_ALT_SRC)/,$(1))
  55 
  56 
  57 ## if-has-altsrc
  58 #
  59 # Conditional macro to test for the existence of an alternate source path
  60 #
  61 # Parameter: An absolute path into the common sources
  62 # Parameter: Result if the alternative-source location exists
  63 # Parameter: Result if the alternative-source location does not exist
  64 # Result: expands to parameter 2 or 3 depending on existence of alternate source
  65 #
  66 if-has-altsrc=$(if $(wildcard $(call altsrc-equiv,$(1))),$(2),$(3))
  67 
  68 
  69 ## altsrc
  70 #
  71 # Converts common source path to alternate source path if the alternate 
  72 # path exists, otherwise evaluates to nul (empty string)
  73 # 
  74 # Parameter: An absolute path into the common sources
  75 # Result: The equivalent path to the alternate-source location, if such a 
  76 #         location exists on the filesystem.  Otherwise it expands to empty.
  77 # 
  78 altsrc=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1)))
  79 
  80 ## commonsrc
  81 # 
  82 # Returns parameter.
  83 #
  84 commonsrc=$(1)
  85 
  86 
  87 ## altsrc-replace
  88 #
  89 # Converts a common source path to an alternate source path if the alternate
  90 # source path exists.  Otherwise it evaluates to the input common source path.
  91 #
  92 # Parameter: An absolute path into the common sources
  93 # Result: A path to either the common or alternate sources
  94 #
  95 altsrc-replace=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1)),$(1))