1 # 2 # Copyright (c) 2012, 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 # The final naming of profiles internally/externally is TBD. The generated 30 # files use 1,2,3,4 for simplicity and conciseness. Internally we use 31 # profile_1, profile_2 and profile_3. Note that profile_4 is a full JRE so 32 # we never have to use it directly. 33 34 ALL_PROFILES := profile_1 profile_2 profile_3 35 36 # This defines targets to generate per-profile Version.java/class files into 37 # distinct locations 38 39 VERSION_JAVA_DIR := sun/misc 40 VERSION_JAVA_FILE := Version.java 41 VERSION_JAVA_PATH := $(VERSION_JAVA_DIR)/$(VERSION_JAVA_FILE) 42 VERSION_CLASS_PATH := $(VERSION_JAVA_PATH:.java=.class) 43 44 PROFILE_VERSION_JAVA_TARGETS := $(foreach i, $(ALL_PROFILES), $(subst XXX,$i, $(JDK_OUTPUTDIR)/gen_XXX/$(VERSION_JAVA_PATH))) 45 46 PROFILE_VERSION_CLASS_TARGETS := $(foreach i, $(PROFILE_VERSION_JAVA_TARGETS), $(i:.java=.class)) 47 48 # These are the external names of each profile 49 PROFILE_NAMES := compact1 compact2 compact3 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