1 #
   2 # Copyright (c) 2012, 2013, 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 # This was split out from Profiles.gmk to allow GenSrcMisc.gmk to include it
  27 # without attempting to generate lists for output files that don't exist yet
  28 
  29 # These are the external names of each profile
  30 
  31 PROFILE_NAMES := compact1 compact2 compact3
  32 
  33 # The include files use 1,2,3,4 for simplicity and conciseness. Internally we
  34 # use profile_1, profile_2 and profile_3. Note that profile_4 is a full JRE so
  35 # we never have to use it directly.
  36 
  37 ALL_PROFILES := profile_1 profile_2 profile_3
  38 
  39 # This defines targets to generate per-profile Version.java/class files into
  40 # distinct locations
  41 
  42 VERSION_JAVA_DIR := sun/misc
  43 VERSION_JAVA_FILE := Version.java
  44 VERSION_JAVA_PATH := $(VERSION_JAVA_DIR)/$(VERSION_JAVA_FILE)
  45 VERSION_CLASS_PATH := $(VERSION_JAVA_PATH:.java=.class)
  46 
  47 PROFILE_VERSION_JAVA_TARGETS := $(foreach i, $(ALL_PROFILES), $(subst XXX,$i, $(JDK_OUTPUTDIR)/gen_XXX/$(VERSION_JAVA_PATH)))
  48 
  49 PROFILE_VERSION_CLASS_TARGETS := $(foreach i, $(PROFILE_VERSION_JAVA_TARGETS), $(i:.java=.class))
  50 
  51 # Function to map from profile designator, profile_1 etc, to its number
  52 profile_number = $(if $(patsubst profile_%,%, $(1)),$(patsubst profile_%,%, $(1)), $(words $(PROFILE_NAMES) extra))
  53 
  54 # Function to map from profile number, 1, 2 etc, to the corresponding name
  55 # An invalid number maps to an empty name
  56 profile_name = $(word $(1), $(PROFILE_NAMES))
  57 
  58 # Function to isolate a profile number from a Version.java target
  59 # Evaluates to the arg if the arg is not a profile version target
  60 profile_version_number = $(patsubst $(JDK_OUTPUTDIR)/gen_profile_%/$(VERSION_JAVA_PATH), %, $(1))
  61 
  62 # Function to go from a profile Version.java target to profile name. If not 
  63 # a profile version target then we need a number that maps to an empty name
  64 profile_version_name = $(word $(if $(filter-out $(call profile_version_number, $(1)), $(1)), $(call profile_version_number, $(1)), $(words $(PROFILE_NAMES) extra)), $(PROFILE_NAMES))
  65