blob: 6d7673e0e0cdbae6b1c55c2f467a1776fb727699 [file] [log] [blame]
erikjaf85fc42012-07-03 16:10:44 -07001#
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
26default: all
27
28include $(SPEC)
29include MakeBase.gmk
30
31#######
32
33IMPORT_TARGET_FILES :=
34
35IMPORT_CLASSES := CORBA JAXP JAXWS LANGTOOLS
36IMPORT_SOURCES := CORBA JAXP JAXWS LANGTOOLS
37# Only Corba has binaries
38IMPORT_BINARIES := CORBA
39
40#######
41
42# Put the libraries here. Different locations for different target apis.
43ifeq ($(OPENJDK_TARGET_OS_API),posix)
ohair46fcac92012-09-18 11:29:24 -070044 INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
45 HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)
erikjaf85fc42012-07-03 16:10:44 -070046else
47 INSTALL_LIBRARIES_HERE:=$(JDK_OUTPUTDIR)/bin
48 HOTSPOT_LIB_DIR:=$(HOTSPOT_DIST)/jre/bin
49endif
50
51#######
52
53#
54# jar xf/unzip fails when executing them all in parallel
55# introduce artificial dependency (_DEP) buuhhh
56
57define ImportClasses
58$1_CLASSES_DEP := $$(IMPORT_TARGET_CLASSES)
59IMPORT_TARGET_CLASSES += $(JDK_OUTPUTDIR)/classes/_the.$1.classes.imported
60
61$(JDK_OUTPUTDIR)/classes/_the.$1.classes.imported : $$($1_DIST)/lib/classes.jar $$($1_CLASSES_DEP)
62 $(ECHO) Importing $1 classes.jar
63 $(MKDIR) -p $$(@D)
ohair46fcac92012-09-18 11:29:24 -070064 $(RM) $$@ $$@.tmp
erikjaf85fc42012-07-03 16:10:44 -070065 ($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
66 $(MV) $$@.tmp $$@
67endef
68
69define ImportSources
70$1_SOURCES_DEP := $$(IMPORT_TARGET_SOURCES)
71IMPORT_TARGET_SOURCES += $(JDK_OUTPUTDIR)/impsrc/_the.$1.src.imported
72
73$(JDK_OUTPUTDIR)/impsrc/_the.$1.src.imported : $$($1_DIST)/lib/src.zip $$($1_SOURCES_DEP)
74 $(ECHO) Importing $1 src.zip
75 $(MKDIR) -p $$(@D)
ohair46fcac92012-09-18 11:29:24 -070076 $(RM) $$@ $$@.tmp
erikjaf85fc42012-07-03 16:10:44 -070077 ($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
78 $(MV) $$@.tmp $$@
79endef
80
81define ImportBinaries
82$1_BINARIES_DEP := $$(IMPORT_TARGET_BINARIES)
83IMPORT_TARGET_BINARIES += $(JDK_OUTPUTDIR)/_the.$1.binaries.imported
84
85$(JDK_OUTPUTDIR)/_the.$1.binaries.imported : $$($1_DIST)/lib/bin.zip $$($1_BINARIES_DEP)
86 $(ECHO) Importing $1 bin.zip
87 $(MKDIR) -p $$(@D)
ohair46fcac92012-09-18 11:29:24 -070088 $(RM) $$@ $$@.tmp
erikjaf85fc42012-07-03 16:10:44 -070089 ($(CD) $$(@D) && $(JAR) xvf $$< > $$@.tmp)
90 $(MV) $$@.tmp $$@
91endef
92
93#######
94
95$(foreach I,$(IMPORT_CLASSES), $(eval $(call ImportClasses,$I)))
96$(foreach I,$(IMPORT_SOURCES), $(eval $(call ImportSources,$I)))
97$(foreach I,$(IMPORT_BINARIES), $(eval $(call ImportBinaries,$I)))
98
99IMPORT_TARGET_FILES += $(IMPORT_TARGET_CLASSES) $(IMPORT_TARGET_SOURCES) $(IMPORT_TARGET_BINARIES)
100
101#######
102
103ifeq ($(OPENJDK_TARGET_OS),solaris)
104define do-install-file
ohair46fcac92012-09-18 11:29:24 -0700105 $(MKDIR) -p '$$(@D)'
106 $(RM) '$$@'
erikjaf85fc42012-07-03 16:10:44 -0700107 $(CP) -r -P '$$<' '$$(@D)'
108endef
109else ifeq ($(OPENJDK_TARGET_OS),macosx)
110define do-install-file
ohair46fcac92012-09-18 11:29:24 -0700111 $(MKDIR) -p '$$(@D)'
112 $(RM) '$$@'
erikjaf85fc42012-07-03 16:10:44 -0700113 $(CP) -pRP '$$<' '$$@'
114endef
115else
116define do-install-file
ohair46fcac92012-09-18 11:29:24 -0700117 $(MKDIR) -p '$$(@D)'
118 $(RM) '$$@'
erikjaf85fc42012-07-03 16:10:44 -0700119 $(CP) -P '$$<' '$$@'
120endef
121endif
122
123define CopyDir
tbell9eea0b02012-11-12 12:35:20 -0800124 $1_SRC_FILES := $(shell $(FIND) $2 -type f -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE),$4) \))
erikjaf85fc42012-07-03 16:10:44 -0700125 $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
126 IMPORT_TARGET_FILES += $$($1_DST_FILES)
127$3/% : $2/%
ohairb71409c2012-10-26 14:23:29 -0700128 $(ECHO) $(LOG_INFO) Copying $$(@F)
erikjaf85fc42012-07-03 16:10:44 -0700129 $(do-install-file)
130endef
131
132#######
133
134#
135# Import hotspot
136#
tbell9eea0b02012-11-12 12:35:20 -0800137HOTSPOT_IMPORT_FILES:=$(addprefix $(LIBRARY_PREFIX), jvm.* saproc.* jsig.* sawindbg.* jvm_db.* jvm_dtrace.*) \
138 Xusage.txt sa-jdi.jar
139$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE), $(HOTSPOT_IMPORT_FILES)))
140$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib, $(HOTSPOT_IMPORT_FILES)))
erikjaf85fc42012-07-03 16:10:44 -0700141
ohair46fcac92012-09-18 11:29:24 -0700142JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
143 $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
erikjaf85fc42012-07-03 16:10:44 -0700144
145ifneq ($(OPENJDK_TARGET_OS), windows)
146 ifeq ($(JVM_VARIANT_SERVER), true)
147 IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
148 ifneq (,$(JSIG_DEBUGINFO))
149 IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
150 endif
151 endif
152 ifeq ($(JVM_VARIANT_CLIENT), true)
153 IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
154 ifneq (,$(JSIG_DEBUGINFO))
155 IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
156 endif
157 endif
158endif
159
160$(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
ohair46fcac92012-09-18 11:29:24 -0700161 $(MKDIR) -p $(@D)
162 $(RM) $@
erikjaf85fc42012-07-03 16:10:44 -0700163 $(LN) -s ../$(@F) $@
164
165$(INSTALL_LIBRARIES_HERE)/server/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
ohair46fcac92012-09-18 11:29:24 -0700166 $(MKDIR) -p $(@D)
167 $(RM) $@
erikjaf85fc42012-07-03 16:10:44 -0700168 $(LN) -s ../$(@F) $@
169
170$(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
ohair46fcac92012-09-18 11:29:24 -0700171 $(MKDIR) -p $(@D)
172 $(RM) $@
erikjaf85fc42012-07-03 16:10:44 -0700173ifeq (REALLY_WEIRD,1)
174 $(LN) -s ../$(@F) $@
175else
176#
177# TODO: Check if this is what they really want...a zip containing a symlink
178#
ohair46fcac92012-09-18 11:29:24 -0700179 $(RM) $@.tmp $(basename $@).debuginfo
erikjaf85fc42012-07-03 16:10:44 -0700180 $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
ohair46fcac92012-09-18 11:29:24 -0700181 $(ZIP) -q -y $@.tmp $(basename $@).debuginfo
182 $(RM) $(basename $@).debuginfo
183 $(MV) $@.tmp $@
erikjaf85fc42012-07-03 16:10:44 -0700184endif
185
186$(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX) : $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
ohair46fcac92012-09-18 11:29:24 -0700187 $(MKDIR) -p $(@D)
188 $(RM) $@
erikjaf85fc42012-07-03 16:10:44 -0700189 $(LN) -s ../$(@F) $@
190
191$(INSTALL_LIBRARIES_HERE)/client/%.debuginfo : $(INSTALL_LIBRARIES_HERE)/%.debuginfo
ohair46fcac92012-09-18 11:29:24 -0700192 $(MKDIR) -p $(@D)
193 $(RM) $@
erikjaf85fc42012-07-03 16:10:44 -0700194 $(LN) -s ../$(@F) $@
195
196$(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
ohair46fcac92012-09-18 11:29:24 -0700197 $(MKDIR) -p $(@D)
198 $(RM) $@
erikjaf85fc42012-07-03 16:10:44 -0700199ifeq (REALLY_WEIRD,1)
200 $(LN) -s ../$(@F) $@
201else
202#
203# TODO: Check if this is what they really want...a zip containing a symlink
204#
ohair46fcac92012-09-18 11:29:24 -0700205 $(RM) $@.tmp $(basename $@).debuginfo
erikjaf85fc42012-07-03 16:10:44 -0700206 $(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
ohair46fcac92012-09-18 11:29:24 -0700207 $(ZIP) -q -y $@.tmp $(basename $@).debuginfo
208 $(RM) $(basename $@).debuginfo
209 $(MV) $@.tmp $@
erikjaf85fc42012-07-03 16:10:44 -0700210endif
211
212#######
213
214ifeq ($(OPENJDK_TARGET_OS),solaris)
215define install-file
ohair46fcac92012-09-18 11:29:24 -0700216 $(MKDIR) -p '$(@D)'
217 $(RM) '$@'
erikjaf85fc42012-07-03 16:10:44 -0700218 $(CP) -r -P '$<' '$(@D)'
219endef
220else ifeq ($(OPENJDK_TARGET_OS),macosx)
221define install-file
ohair46fcac92012-09-18 11:29:24 -0700222 $(MKDIR) -p '$(@D)'
223 $(RM) '$@'
erikjaf85fc42012-07-03 16:10:44 -0700224 $(CP) -pRP '$<' '$@'
225endef
226else
227define install-file
ohair46fcac92012-09-18 11:29:24 -0700228 $(MKDIR) -p '$(@D)'
229 $(RM) '$@'
erikjaf85fc42012-07-03 16:10:44 -0700230 $(CP) -P '$<' '$@'
231endef
232endif
233
erikjaf85fc42012-07-03 16:10:44 -0700234#######
235
236all: $(IMPORT_TARGET_FILES)