1 # |
|
2 # Copyright (c) 2013, 2016, 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 # Copy the generated output into well-defined places in the dist directory. |
|
28 |
|
29 # This must be the first rule |
|
30 default: all |
|
31 |
|
32 include $(SPEC) |
|
33 include MakeBase.gmk |
|
34 |
|
35 $(eval $(call IncludeCustomExtension, hotspot, Dist.gmk)) |
|
36 |
|
37 DIST_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/dist |
|
38 |
|
39 # Unfortunately, all platforms have different target subdirs. |
|
40 ifeq ($(OPENJDK_TARGET_OS), windows) |
|
41 LIB_SUBDIR := bin |
|
42 else ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
43 LIB_SUBDIR := lib |
|
44 else |
|
45 LIB_SUBDIR := lib$(OPENJDK_TARGET_CPU_LIBDIR) |
|
46 endif |
|
47 |
|
48 ################################################################################ |
|
49 # Setup make rules to copy a native library and associated data. |
|
50 # |
|
51 # Parameter 1 is the name of the rule. This name is used as variable prefix, |
|
52 # and the targets generated are listed in a variable by that name. |
|
53 # |
|
54 # Remaining parameters are named arguments. These include: |
|
55 # NAME -- The base name of the native library (e.g. 'jvm') |
|
56 # VARIANT -- The variant to copy from |
|
57 # VARIANT_TARGET_DIR -- The variant target sub dir, with trailing slash, optional |
|
58 SetupDistLibFile = $(NamedParamsMacroTemplate) |
|
59 define SetupDistLibFileBody |
|
60 ifneq ($$($1_VARIANT), ) |
|
61 $1_SRC_DIR := $$(HOTSPOT_OUTPUTDIR)/variant-$$($1_VARIANT)/lib$$($1_NAME) |
|
62 else |
|
63 $1_SRC_DIR := $$(HOTSPOT_OUTPUTDIR)/lib$$($1_NAME) |
|
64 endif |
|
65 $1_LIB_NAME := $(LIBRARY_PREFIX)$$($1_NAME) |
|
66 $1_TARGET_DIR := $$(DIST_OUTPUTDIR)/$$(LIB_SUBDIR)/$$($1_VARIANT_TARGET_DIR) |
|
67 |
|
68 # Copy the the native library. |
|
69 $$(eval $$(call SetupCopyFiles, $1_COPY_LIB, \ |
|
70 DEST := $$($1_TARGET_DIR), \ |
|
71 FILES := $$(wildcard \ |
|
72 $$($1_SRC_DIR)/$$($1_LIB_NAME)$(SHARED_LIBRARY_SUFFIX)), \ |
|
73 )) |
|
74 |
|
75 TARGETS += $$($1_COPY_LIB) |
|
76 |
|
77 # Copy related data (debug symbols, static-build symbols file etc) |
|
78 $$(eval $$(call SetupCopyFiles, $1_COPY_FILES, \ |
|
79 DEST := $$($1_TARGET_DIR), \ |
|
80 FILES := $$(wildcard \ |
|
81 $$(addprefix $$($1_SRC_DIR)/$$($1_LIB_NAME), \ |
|
82 .diz .debuginfo .pdb .map .symbols)), \ |
|
83 )) |
|
84 |
|
85 TARGETS += $$($1_COPY_FILES) |
|
86 |
|
87 ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
88 # Debug symbols on macosx is a directory, not a single file, per library. |
|
89 $1_DSYM_SRC := $$($1_SRC_DIR)/$$($1_LIB_NAME)$(SHARED_LIBRARY_SUFFIX).dSYM) |
|
90 ifneq ($$(wildcard $$($1_DSYM_SRC)), ) |
|
91 $$(eval $$(call SetupCopyFiles, $1_COPY_DSYM_DIR, \ |
|
92 DEST := $$($1_TARGET_DIR), \ |
|
93 SRC := $$($1_SRC_DIR), \ |
|
94 FILES := $$(shell $(FIND) $$($1_DSYM_SRC) -type f), \ |
|
95 )) |
|
96 TARGETS += $$($1_COPY_DSYM_DIR) |
|
97 endif |
|
98 endif |
|
99 endef |
|
100 |
|
101 ################################################################################ |
|
102 # Copy common files, which are independent on the jvm variant(s) being built. |
|
103 # For files that were generated during the build, we assume all versions of |
|
104 # these files are identical, and just pick one arbitrarily to use as source. |
|
105 |
|
106 ANY_JVM_VARIANT := $(firstword $(JVM_VARIANTS)) |
|
107 JVM_VARIANT_OUTPUTDIR := $(HOTSPOT_OUTPUTDIR)/variant-$(ANY_JVM_VARIANT) |
|
108 |
|
109 ### Copy platform-independent .h files |
|
110 INCLUDE_FILES_SRC_DIR := $(HOTSPOT_TOPDIR)/src/share/vm |
|
111 $(eval $(call SetupCopyFiles, COPY_INCLUDE, \ |
|
112 SRC := $(INCLUDE_FILES_SRC_DIR), \ |
|
113 DEST := $(DIST_OUTPUTDIR)/include, \ |
|
114 FLATTEN := true, \ |
|
115 FILES := $(INCLUDE_FILES_SRC_DIR)/prims/jni.h \ |
|
116 $(INCLUDE_FILES_SRC_DIR)/code/jvmticmlr.h \ |
|
117 $(INCLUDE_FILES_SRC_DIR)/services/jmm.h)) |
|
118 |
|
119 TARGETS += $(COPY_INCLUDE) |
|
120 |
|
121 ### Copy jni_md.h |
|
122 |
|
123 # This might have been defined in a custom extension |
|
124 ifeq ($(JNI_MD_H_SRC), ) |
|
125 JNI_MD_H_SRC := $(HOTSPOT_TOPDIR)/src/cpu/$(HOTSPOT_TARGET_CPU_ARCH)/vm/jni_$(HOTSPOT_TARGET_CPU_ARCH).h |
|
126 endif |
|
127 |
|
128 ifeq ($(OPENJDK_TARGET_OS), macosx) |
|
129 # NOTE: This should most likely be darwin, but the old hotspot build uses bsd |
|
130 JNI_MD_SUBDIR := bsd |
|
131 else ifeq ($(OPENJDK_TARGET_OS), windows) |
|
132 JNI_MD_SUBDIR := win32 |
|
133 else |
|
134 JNI_MD_SUBDIR := $(OPENJDK_TARGET_OS) |
|
135 endif |
|
136 |
|
137 # SetupCopyFiles is not used here since it's non-trivial to copy a single |
|
138 # file with a different target name. |
|
139 $(DIST_OUTPUTDIR)/include/$(JNI_MD_SUBDIR)/jni_md.h: $(JNI_MD_H_SRC) |
|
140 $(call LogInfo, Copying hotspot/dist/include/$(JNI_MD_SUBDIR)/jni_md.h) |
|
141 $(install-file) |
|
142 |
|
143 TARGETS += $(DIST_OUTPUTDIR)/include/$(JNI_MD_SUBDIR)/jni_md.h |
|
144 |
|
145 $(eval $(call SetupCopyFiles, COPY_JVMTI_H, \ |
|
146 DEST := $(DIST_OUTPUTDIR)/include, \ |
|
147 FLATTEN := true, \ |
|
148 FILES := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.h)) |
|
149 |
|
150 TARGETS += $(COPY_JVMTI_H) |
|
151 |
|
152 # NOTE: In the old build, this file was not copied on Windows. |
|
153 ifneq ($(OPENJDK_TARGET_OS), windows) |
|
154 $(eval $(call SetupCopyFiles, COPY_JVMTI_HTML, \ |
|
155 DEST := $(DIST_OUTPUTDIR)/docs/platform/jvmti, \ |
|
156 FILES := $(JVM_VARIANT_OUTPUTDIR)/gensrc/jvmtifiles/jvmti.html)) |
|
157 endif |
|
158 |
|
159 TARGETS += $(COPY_JVMTI_HTML) |
|
160 |
|
161 ifeq ($(OPENJDK_TARGET_OS), windows) |
|
162 $(eval $(call SetupCopyFiles, COPY_JVM_LIB, \ |
|
163 DEST := $(DIST_OUTPUTDIR)/lib, \ |
|
164 FILES :=$(JVM_VARIANT_OUTPUTDIR)/libjvm/objs/jvm.lib)) |
|
165 |
|
166 TARGETS += $(COPY_JVM_LIB) |
|
167 endif |
|
168 |
|
169 # Copy libjsig, if it exists |
|
170 $(eval $(call SetupDistLibFile, DIST_jsig, \ |
|
171 NAME := jsig, \ |
|
172 )) |
|
173 |
|
174 ################################################################################ |
|
175 # Copy variant-specific files |
|
176 |
|
177 # Setup make rules to copy a single variant to dist. |
|
178 # $1: The name of the variant |
|
179 define SetupDistForVariant |
|
180 ifneq ($$(filter client minimal, $1), ) |
|
181 VARIANT_TARGET_DIR := $1 |
|
182 else |
|
183 # Use 'server' as default target directory name for all other variants. |
|
184 VARIANT_TARGET_DIR := server |
|
185 endif |
|
186 |
|
187 $$(eval $$(call SetupDistLibFile, DIST_$(strip $1)_jvm, \ |
|
188 NAME := jvm, \ |
|
189 VARIANT := $1, \ |
|
190 VARIANT_TARGET_DIR := $$(VARIANT_TARGET_DIR)/, \ |
|
191 )) |
|
192 |
|
193 # Copy the dtrace libraries, if they exist |
|
194 $$(eval $$(call SetupDistLibFile, DIST_$(strip $1)_jvm_db, \ |
|
195 NAME := jvm_db, \ |
|
196 VARIANT := $1, \ |
|
197 VARIANT_TARGET_DIR := $$(VARIANT_TARGET_DIR)/, \ |
|
198 )) |
|
199 |
|
200 $$(eval $$(call SetupDistLibFile, DIST_$(strip $1)_jvm_dtrace, \ |
|
201 NAME := jvm_dtrace, \ |
|
202 VARIANT := $1, \ |
|
203 VARIANT_TARGET_DIR := $$(VARIANT_TARGET_DIR)/, \ |
|
204 )) |
|
205 |
|
206 # Copy the Xusage.txt file |
|
207 $$(eval $$(call SetupCopyFiles, DIST_$(strip $1)_Xusage, \ |
|
208 DEST := $$(DIST_OUTPUTDIR)/$$(LIB_SUBDIR)/$(strip $1), \ |
|
209 FILES := $$(HOTSPOT_OUTPUTDIR)/variant-$(strip $1)/support/misc/Xusage.txt, \ |
|
210 )) |
|
211 |
|
212 TARGETS += $$(DIST_$(strip $1)_Xusage) |
|
213 endef |
|
214 |
|
215 $(foreach variant, $(JVM_VARIANTS), \ |
|
216 $(eval $(call SetupDistForVariant, $(variant))) \ |
|
217 ) |
|
218 |
|
219 ################################################################################ |
|
220 |
|
221 all: $(TARGETS) |
|
222 |
|
223 .PHONY: all |
|