bobv@2508: # bobv@2508: # Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. bobv@2508: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. bobv@2508: # bobv@2508: # This code is free software; you can redistribute it and/or modify it bobv@2508: # under the terms of the GNU General Public License version 2 only, as bobv@2508: # published by the Free Software Foundation. bobv@2508: # bobv@2508: # This code is distributed in the hope that it will be useful, but WITHOUT bobv@2508: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or bobv@2508: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License bobv@2508: # version 2 for more details (a copy is included in the LICENSE file that bobv@2508: # accompanied this code). bobv@2508: # bobv@2508: # You should have received a copy of the GNU General Public License version bobv@2508: # 2 along with this work; if not, write to the Free Software Foundation, bobv@2508: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. bobv@2508: # bobv@2508: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA bobv@2508: # or visit www.oracle.com if you need additional information or have any bobv@2508: # questions. bobv@2508: # bobv@2508: # bobv@2508: kamg@2515: # This file defines variables and macros which are used in the makefiles to kamg@2515: # allow distributions to augment or replace common hotspot code with dholmes@2863: # distribution-specific source files. This capability is disabled when dholmes@2863: # an OPENJDK build is requested, unless HS_ALT_SRC_REL has been set externally. bobv@2508: kamg@2515: # Requires: GAMMADIR kamg@2515: # Provides: kamg@2515: # variables: HS_COMMON_SRC, HS_ALT_SRC, HS_COMMON_SRC_REL, and HS_ALT_SRC_REL kamg@2515: # functions: altsrc-equiv, if-has-altsrc, altsrc, altsrc-replace bobv@2508: kamg@2515: HS_COMMON_SRC_REL=src bobv@2508: dholmes@2863: ifneq ($(OPENJDK),true) dholmes@2863: # This needs to be changed to a more generic location, but we keep it dholmes@2863: # as this for now for compatibility dholmes@2863: HS_ALT_SRC_REL=src/closed dholmes@2863: else dholmes@2863: HS_ALT_SRC_REL=NO_SUCH_PATH dholmes@2863: endif bobv@2508: kamg@2515: HS_COMMON_SRC=$(GAMMADIR)/$(HS_COMMON_SRC_REL) kamg@2515: HS_ALT_SRC=$(GAMMADIR)/$(HS_ALT_SRC_REL) bobv@2508: kamg@2515: ## altsrc-equiv kamg@2515: # kamg@2515: # Convert a common source path to an alternative source path kamg@2515: # kamg@2515: # Parameter: An absolute path into the common sources kamg@2515: # Result: The matching path to the alternate-source location kamg@2515: # kamg@2515: altsrc-equiv=$(subst $(HS_COMMON_SRC)/,$(HS_ALT_SRC)/,$(1)) bobv@2508: kamg@2515: kamg@2515: ## if-has-altsrc kamg@2515: # kamg@2515: # Conditional macro to test for the existence of an alternate source path kamg@2515: # kamg@2515: # Parameter: An absolute path into the common sources kamg@2515: # Parameter: Result if the alternative-source location exists kamg@2515: # Parameter: Result if the alternative-source location does not exist kamg@2515: # Result: expands to parameter 2 or 3 depending on existence of alternate source kamg@2515: # kamg@2515: if-has-altsrc=$(if $(wildcard $(call altsrc-equiv,$(1))),$(2),$(3)) kamg@2515: kamg@2515: kamg@2515: ## altsrc kamg@2515: # kamg@2515: # Converts common source path to alternate source path if the alternate kamg@2515: # path exists, otherwise evaluates to nul (empty string) kamg@2515: # kamg@2515: # Parameter: An absolute path into the common sources kamg@2515: # Result: The equivalent path to the alternate-source location, if such a kamg@2515: # location exists on the filesystem. Otherwise it expands to empty. kamg@2515: # kamg@2515: altsrc=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1))) kamg@2515: kamg@2515: ## commonsrc kamg@2515: # kamg@2515: # Returns parameter. kamg@2515: # kamg@2515: commonsrc=$(1) kamg@2515: kamg@2515: kamg@2515: ## altsrc-replace kamg@2515: # kamg@2515: # Converts a common source path to an alternate source path if the alternate kamg@2515: # source path exists. Otherwise it evaluates to the input common source path. kamg@2515: # kamg@2515: # Parameter: An absolute path into the common sources kamg@2515: # Result: A path to either the common or alternate sources kamg@2515: # kamg@2515: altsrc-replace=$(call if-has-altsrc,$(1),$(call altsrc-equiv,$(1)),$(1))